Global abbreviation on fish
zsh
ではできるグローバルエイリアス。
これを fish
でもできるようにしたプラグインが
ryotako/fish-global-abbreviation
設定の方法は、 fishでグローバルエイリアスっぽいもの - Qiita を見るといい感じ。
ただ、この設定だと、 Space とかでは展開されるんだけど、 zsh
みたいに Enter
で展開することができなかった。
なので、以下の設定を fish_user_key_bindings.fish
に実施した。
function fish_user_key_bindings # Additional bind for fish_vi_key_bindings. bind -M insert \cf accept-autosuggestion bind -M insert \cn down-or-search bind -M insert \cp up-or-search # global abbreviation. bind -M insert ' ' '__gabbr_expand; commandline -i " "' bind -M insert ';' '__gabbr_expand; commandline -i ";"' bind -M insert '>' '__gabbr_expand; commandline -i ">"' bind -M insert '<' '__gabbr_expand; commandline -i "<"' bind -M insert '(' '__gabbr_expand; commandline -i "("' bind -M insert ')' '__gabbr_expand; commandline -i ")"' bind -M insert \cj '__gabbr_expand; commandline -f execute' bind -M insert \cm '__gabbr_expand; commandline -f execute' bind -M insert \r '__gabbr_expand; commandline -f execute' end
重要なのは、一番下3行。
__gabbr_expand
だけじゃなくて、 commandline -f execute
を追加するのいいみたい。
参考
Thanks for reading! Read other posts?