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
# 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() {
locate --all --ignore-case --basename --existing "$@" |
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
edbin() {
# TODO resolve simple alias
if f="$(which $1 2>/dev/null)" && test -f "$f"
then edit "$f"
else edshell -f "$1"
@ -218,7 +219,9 @@ u() {
if which topgrade >/dev/null
then
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
else yadm l
sudo apt update && sudo apt upgrade

View File

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

View File

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

View File

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