From 1a608ef92a2a8583cc3e934a1122691af5a95b03 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Mon, 18 May 2026 22:20:42 +0800 Subject: bump: fish --- dot-config/fish/conf.d/_binds.conf | 52 ++++++++++++++++++++++ dot-config/fish/conf.d/binds.conf | 50 --------------------- .../fish/functions/fish_user_key_bindings.fish | 4 ++ 3 files changed, 56 insertions(+), 50 deletions(-) create mode 100644 dot-config/fish/conf.d/_binds.conf delete mode 100644 dot-config/fish/conf.d/binds.conf diff --git a/dot-config/fish/conf.d/_binds.conf b/dot-config/fish/conf.d/_binds.conf new file mode 100644 index 00000000..ad090e04 --- /dev/null +++ b/dot-config/fish/conf.d/_binds.conf @@ -0,0 +1,52 @@ +function toggle-sudo + set buf (commandline) + + if test -z "$buf" + set last (history | head -n1) + if test -z "$last" + commandline -r "sudo " + return + end + set buf $last + end + + if string match -rq '^\s*sudo(\s+|$)' -- $buf + set new (string replace -r '^\s*sudo\s*' '' -- $buf) + if test -z "$new" + commandline -r "" + return + end + commandline -r $new + else + commandline -r "sudo $buf" + end +end +function fish_user_key_bindings + for m in default insert + bind -M $m ctrl-f accept-autosuggestion + bind -M $m ctrl-backspace backward-kill-word + end + + for m in default insert normal + bind -M $m alt-left 'commandline -f cancel; cd -; commandline -f repaint' + bind -M $m alt-up 'commandline -f cancel; cd ..; commandline -f repaint' + bind -M $m ctrl-e toggle-sudo + bind -M $m ctrl-r history-pager + end + + bind -M normal U redo + + for m in default insert normal replace replace_one + bind --preset --erase -M $m ctrl-h + bind -M $m ctrl-h backward-char + bind --preset --erase -M $m ctrl-j + bind -M $m ctrl-j down-or-search + bind --preset --erase -M $m ctrl-k + bind -M $m ctrl-k up-or-search + # clear overrode + bind --preset --erase -M $m ctrl-l + bind -M $m ctrl-l forward-char + end +end + +echo a diff --git a/dot-config/fish/conf.d/binds.conf b/dot-config/fish/conf.d/binds.conf deleted file mode 100644 index 7b6e5e6a..00000000 --- a/dot-config/fish/conf.d/binds.conf +++ /dev/null @@ -1,50 +0,0 @@ -function toggle-sudo - set buf (commandline) - - if test -z "$buf" - set last (history | head -n1) - if test -z "$last" - commandline -r "sudo " - return - end - set buf $last - end - - if string match -rq '^\s*sudo(\s+|$)' -- $buf - set new (string replace -r '^\s*sudo\s*' '' -- $buf) - if test -z "$new" - commandline -r "" - return - end - commandline -r $new - else - commandline -r "sudo $buf" - end -end -function fish_user_key_bindings - for m in default insert - bind -M $m ctrl-f accept-autosuggestion - bind -M $m ctrl-backspace backward-kill-word - end - - for m in default insert normal - bind -M $m alt-left 'commandline -f cancel; cd -; commandline -f repaint' - bind -M $m alt-up 'commandline -f cancel; cd ..; commandline -f repaint' - bind -M $m ctrl-e toggle-sudo - bind -M $m ctrl-r history-pager - end - - bind -M normal U redo - - for m in default insert normal replace replace_one - bind --preset --erase -M $m ctrl-h - bind -M $m ctrl-h backward-char - bind --preset --erase -M $m ctrl-j - bind -M $m ctrl-j down-or-search - bind --preset --erase -M $m ctrl-k - bind -M $m ctrl-k up-or-search - # clear overrode - bind --preset --erase -M $m ctrl-l - bind -M $m ctrl-l forward-char - end -end diff --git a/dot-config/fish/functions/fish_user_key_bindings.fish b/dot-config/fish/functions/fish_user_key_bindings.fish index b7fc879e..421369a5 100644 --- a/dot-config/fish/functions/fish_user_key_bindings.fish +++ b/dot-config/fish/functions/fish_user_key_bindings.fish @@ -50,4 +50,8 @@ function fish_user_key_bindings # typeahead bind \cj execute bind -M insert \cj execute + + # bind \ck up-line + # bind \cj down-line + # bind \cm execute end -- cgit v1.2.3