trying to get && and || substitution in fish.
david@hydrogen ~> fish --version 09:42:44
fish, version 2.6.0
david@hydrogen ~> cat ~/.config/fish/functions/fish_user_key_bindings.fish 09:42:24
# trying to get || and &&
# bind control + r to backward search
bind \cr re_search
# substitute && with "; and"
function bind_and
switch (commandline -t)
case "&"
commandline -t "; and"; commandline -f repaint
end
end
# enables !!
function bind_bang
switch (commandline -t)
case "!"
commandline -t $history[1]; commandline -f repaint
case "*"
commandline -i !
end
end
# enables !$
function bind_dollar
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
# enable keybindings
function fish_user_key_bindings
bind ! bind_bang
bind '$' bind_dollar
bind & bind_and
end