3 ms·
I recently had a revelation: When typing longer shell commands it can be time-consuming to go back and make changes, turns out you can use Vim style cursor move
by mxschumacher 6y ago
I recently had a revelation: When typing longer shell commands it can be time-consuming to go back and make changes, turns out you can use Vim style cursor movements within the Fish:
https://stackoverflow.com/questions/28444740/how-to-use-vi-mode-in-fish-shell https://stackoverflow.com/questions/28444740/how-to-use-vi-m...
- slim 6y agoyou can do that in bash too, and any cli that uses readline library
- chrisweekly 6y agoalso zsh (tho it doesn't use readline per se)
- kadonoishi 6y agoset -o vi Starts you in insert mode. To go back to the usual command-line editing, set -o emacs
- HouseOfStairs 6y agoThis was a revelation for me as well. I also didn't realize that if you haven't configured vi keybindings, the default is Emacs (in bash or anything using readline). Even though Vim's my main editor, I found modal editing a bit too heavyweight on the commandline, so I prefer the default Emacs (most useful by far: C-b to go back one word and C-k to delete everything right of cursor).
- vivekkalyan 6y agoI prefer the emacs bindings for the command line such as C-A, C-U (mostly due to muscle memory), but have set up my $EDITOR as vim. This allows me to do C-X C-E, which opens the current command in vim to be edited. If you are using zsh, you need to add this to ur .zshrc autoload -z edit-command-line zle -N edit-command-line bindkey "^X^E" edit-command-line