Here’s the list of couple places that I enable vi
mode.
Bash shell
set -o vi
I always enable bash movement mode in my.bashrc
file. With it set, I can switch between normal mode and edit mode by pressingESC
. Editing works as any normal shell, but when switching to normal mode, I can usevi
movement keys likej, k, h, l, w, b, e, $, ^
, editing current line is also faster by using selectors such ascw, dw, C, D...
. One important note is that we are usingvi
mode, notvim
, so selectors likeciw, caw, ci(
does not work.export EDITOR=vim
, yes, another.bashrc
configuration. This allow me to open up a quick vim buffer with current line. So I can do a lot more withvim
to make sure my long command is correct. I don’t use this as often becausevi
mode is already good enough. But in some cases like editing a longcurl
command with multiple headers andjson
payload, using vim is much better. While in command line, press^XE
(^ is ctrl key) to open editor. If you don’t setEDITOR
environment, default editor such asnano
will be used.The
vim
itself. I used to enjoyvim
but I found writingvimscript
is hard. Andneovim
is easier version ofvim
to use. I’m avoiding to sayneovim
is better, because I believe they’re both doing their best. I just findneovim
a bit easier to use (maybe skill issue).Leetcode
vim mode
. You can change Leetcode editor key binding by opening editor settings > Code editor > Key binding > Vim. It work perfectly and you don’t have to:w
to save your code. But if your muscle memory still does so, no problems. The down side ofvim mode
on Leetcode is you cannot copy the code to clipboard. Any time I need to copy code to run debug locally, I have to switch back to Standard mode to copy then paste to my localvim
. 😢 Hope they can change it in the future.Terminal emulator. I use
kitty
terminal emulator. It uses GPU for rendering, displays images, animations in terminal, pdf as well. So I can quickly view many documents without leaving my beloved terminal. It is super customizable, so I usevi
keys to move between split windows. I map custom keys in~/.config/kitty/kitty.conf
like so:map super+k neighboring_window up map super+j neighboring_window down map super+h neighboring_window left map super+l neighboring_window right
ipython
ipython --TerminalInteractiveShell.editing_mode=vi
Browser. Sadly, no, I don’t use any
vi
orvim
key binding plugins in browser. I used to, but I found it can break the modern JavaScript frameworks in different ways. Especially on input fields.