feat(fish): add nickeb96/puffer-fish

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-06-11 13:40:36 +03:00
parent 90020a4998
commit a3f35b2d18
5 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
status is-interactive || exit
function _puffer_fish_key_bindings --on-variable fish_key_bindings
set -l modes
if test "$fish_key_bindings" = fish_default_key_bindings
set modes default insert
else
set modes insert default
end
bind --mode $modes[1] . _puffer_fish_expand_dots
bind --mode $modes[1] ! _puffer_fish_expand_bang
bind --mode $modes[1] '$' _puffer_fish_expand_lastarg
bind --mode $modes[2] --erase . ! '$'
end
_puffer_fish_key_bindings
set -l uninstall_event puffer_fish_key_bindings_uninstall
function _$uninstall_event --on-event $uninstall_event
bind -e .
bind -e !
bind -e '$'
end

View File

@@ -6,3 +6,4 @@ danhper/fish-ssh-agent
halostatue/fish-brew@v3
edc/bass
meaningful-ooo/sponge
nickeb96/puffer-fish

View File

@@ -0,0 +1,9 @@
function _puffer_fish_expand_bang
switch (commandline -t)
case '!'
commandline -t $history[1]
case '*'
commandline -i '!'
end
end

View File

@@ -0,0 +1,9 @@
function _puffer_fish_expand_dots -d 'expand ... to ../.. etc'
set -l cmd (commandline --cut-at-cursor)
set -l split (string split -- ' ' $cmd)
if string match --quiet --regex -- '^(\.\./)*\.\.$' $split[-1]
commandline --insert '/..'
else
commandline --insert '.'
end
end

View File

@@ -0,0 +1,9 @@
function _puffer_fish_expand_lastarg
switch (commandline -t)
case '!'
commandline -t ""
commandline -f history-token-search-backward
case '*'
commandline -i '$'
end
end