Add !! and !$ to fish yo 😆
This commit is contained in:
parent
001d99af84
commit
555eba3b6f
|
@ -1 +1,2 @@
|
||||||
source $HOME/.config/fish/functions/take_skip.fish
|
source $HOME/.config/fish/functions/take_skip.fish
|
||||||
|
source $HOME/.config/fish/functions/history.fish
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Functions needed for !! and !$
|
||||||
|
function __history_previous_command
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t $history[1]; commandline -f repaint
|
||||||
|
case "*"
|
||||||
|
commandline -i !
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_previous_command_arguments
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t ""
|
||||||
|
commandline -f history-token-search-backward
|
||||||
|
case "*"
|
||||||
|
commandline -i '$'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# The bindings for !! and !$
|
||||||
|
if [ "$fish_key_bindings" = "fish_vi_key_bindings" ];
|
||||||
|
bind -Minsert ! __history_previous_command
|
||||||
|
bind -Minsert '$' __history_previous_command_arguments
|
||||||
|
else
|
||||||
|
bind ! __history_previous_command
|
||||||
|
bind '$' __history_previous_command_arguments
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue