2 quick tips on bash vi-mode and 256 colours for vim
In a previous
article I discussed how you can enable 256 colours for vim and
how that can improve long coding sessions. But that left me with a problem when
ssh'ing to machines where xterm-256color isn't supported.
It turns out you can keep your $TERM env var to xterm, to maintain
compatibility, and just add set t_Co=256 to your .vimrc. That obviously
means that no other app supporting such mode will try use it, but that's
alright as vim is the only one I want that mode for.
The other thing I did was to enable the vi-mode for bash (add set keymap
vi-insert to ~/.inpurc), and that was great if not that it's a bit of a
problem for very frequent and quick things like deleting the last word and
clearing the screen. The solution is to remap those keycombos to the respective
functions and that's it. In your ~/.inputrc:
"\C-l": clear-screen "\C-w": unix-word-rubout