I use the fish
shell, and I added a function that expands variables, like it works by default in Zsh. That is, I can type e.g. $PWD
, press the keyboard shortcut, and it will be expanded to the current path.
For some reason though, Option-Control-E doesn’t work, whereas Control-E works fine. What might be a reason?
~/.config/fish/functions/fish_user_key_bindings.fish
:
function fish_user_key_bindings
# option-control-e, doesn't work
# bind \e\ce bind_expand_all
# control-e, works
bind \ce bind_expand_all
end
~/.config/fish/functions/bind_expand_all.fish
:
# $__fish_config_dir/functions/bind_expand_all.fish
function bind_expand_all
set -l expanded
for token in (commandline --tokenize)
set expanded $expanded (eval echo $token)
end
set -l new (string join " " $expanded)
commandline -r $new
commandline -C (string length $new)
end