config/shell: little improvements and todos

This commit is contained in:
xeruf 2022-07-18 12:09:29 +02:00
parent 17afcc8202
commit 256df9cf71
5 changed files with 9 additions and 3 deletions

View File

@ -53,7 +53,8 @@ cd() {
# LOCATE {{{1 # LOCATE {{{1
# TODO no double heading with bat # TODO no double heading with bat
alias fselect='fzf -0 -1 --reverse --height=40% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s "b \"$f\"" && b "$f"; }; done'; alias fselect='fzf -0 -1 --reverse --height=40% --keep-right |
while read f; do test -d "$f" && cd "$f" || { highlight "$f" && print -s b \"$f\" && b "$f"; }; done';
loci() { loci() {
locate --all --ignore-case --basename --existing "$@" | locate --all --ignore-case --basename --existing "$@" |
command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') |

View File

@ -113,6 +113,7 @@ edshell() {
# Edit a file in the PATH # Edit a file in the PATH
edbin() { edbin() {
# TODO resolve simple alias
if f="$(which $1 2>/dev/null)" && test -f "$f" if f="$(which $1 2>/dev/null)" && test -f "$f"
then edit "$f" then edit "$f"
else edshell -f "$1" else edshell -f "$1"
@ -218,7 +219,9 @@ u() {
if which topgrade >/dev/null if which topgrade >/dev/null
then then
topgrade topgrade
builtin cd $XDG_CONFIG_HOME/emacs && git pull --rebase && doom sync -u test -d "$XDG_CONFIG_HOME/emacs" &&
builtin cd $XDG_CONFIG_HOME/emacs &&
git pull --rebase && doom sync -u
# TODO autodetect failure in emacs and rebuild it completely # TODO autodetect failure in emacs and rebuild it completely
else yadm l else yadm l
sudo apt update && sudo apt upgrade sudo apt update && sudo apt upgrade

View File

@ -16,6 +16,7 @@ if which jrnl >/dev/null; then
compdef jn=jrnl compdef jn=jrnl
alias jnc='jn -contains' alias jnc='jn -contains'
alias jne='jrnl --edit' alias jne='jrnl --edit'
# TODO jump to end
fi fi
test "$DISPLAY" || return 0 test "$DISPLAY" || return 0

View File

@ -4,7 +4,7 @@
test "$1" = "-w" && write=true && shift test "$1" = "-w" && write=true && shift
disk="${1:-$(df --output=source . | tail -1)}" disk="${1:-$(df --output=source . | tail -1)}"
if test "$write" if test "$write"
then exec &> >(tee "disktest-$(date +"%y%m%d")") then exec &> >(tee "disktest-$(date +%F)")
fi fi
# Needs sudo for read test # Needs sudo for read test
sudo hdparm -MWAgt "$disk" sudo hdparm -MWAgt "$disk"

View File

@ -1,3 +1,4 @@
#!/bin/sh -e #!/bin/sh -e
# Emacs in the terminal # Emacs in the terminal
# TODO timeout start because first does not open file
emacsclient --tty --alternate-editor="" "$@" emacsclient --tty --alternate-editor="" "$@"