Vim is the editor of my choice, I love it a lot. I try to find vim bindings everywhere I can, A few apps which have good vim bindings
- Chrome with vimium
The terminal with a proper
~/.inputrcbelow12345678910111213141516171819202122232425262728293031# ~/.inputrc#vim key bindingsset editing-mode viset keymap vi# do not bell on tab-completionset bell-style bellset expand-tilde offset input-meta offset convert-meta onset output-meta offset horizontal-scroll-mode offset history-preserve-point onset mark-directories onset mark-symlinked-directories onset match-hidden-files off# completion settingsset page-completions offset completion-query-items 2000set completion-ignore-case offset show-all-if-ambiguous onset show-all-if-unmodified onset completion-prefix-display-length 10set print-completions-horizontally offC-n: history-search-forwardC-p: history-search-backward#new stuff"\C-a": history-search-forward
Once you set this up, many repls will respect these bindings. For instance irb, pry respect these. As a matter of fact any good terminal app which use the
readlinelibrary will respect this.
- Tmux is another software that has vim bindings
So, whenever I work with someone people always seem to be impressed that vim can do so much so simply. This is really the power of vim, vim was built for text editing and it is the best for this job. However, learning it can be quite painful and many people will abandon learning it in a few days.
There is a very popular learning curve graph about vim
The part about vim is partially true, in that once it clicks everything falls into place.
Notepad is an editor which is very easy to use, but if you compare it to programming languages it has the capability of a calculator. You put your cursor in a place type stuff and that is all. Vim lets you speak to it, in an intelligent way Anyway, I am rambling at this point.
The reason I am writing this blog post in the middle of the night is because many people ask me “How should I setup vim?”, I’d love to have it look/work like yours.
And many times I point them to my vimrc.
However, if you are planning on learning vim, don’t go there. Start with the following
That is all, no more no less.
To finish the installation, you need to do 2 things:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim +PlugInstallfrom your terminal
A few simple tips on how to learn vim properly:
vimtutoron your terminal 3 to 4 times. Read everything 3 to 4 times and actually practice it.
- Learn about vim movements, commands and modes
- Open your vim editor at the root of the project and have just one instance open, don’t open more than one instance per project. This is very very important. I can’t stress this enough. To open another file from your project, hit Ctrl+P
- Start with a simple vimrc, The one I pasted above is a good start.
- Learn about buffers / windows and tabs in vim and how to navigate them.
- Add 1 extension that you think might help every month. And put a few sticky notes with its shortcuts/mappings on your monitor.
- Use http://vimawesome.com/ to find useful plugins.
Most important of all: Don’t use any plugin other than sensible and CtrlP for the first month
Once you learn to speak the language of vim, using other editors will make you feel dumb.