Vi Improved, a.k.a Vim
To manipulate code at the speed of thought.
It is the same reason that we learn to touch-type — to write at the speed of thought.
gg
: go to the top of the fileG
: go to the bottom of the fileb
: go back a wordf
: go forward a word$
: teleport to the start of the line,0
: teleport to the end.- replace everything within 2 parenthesis? no worries, it's natural: change in ( = "change in brackets" – duh!
Beyond being able to manipulate code on your own computer very quickly, the benefit of learning Vim is that you can manipulate code on any machine really quickly.
Vim is available everywhere, and if it isn't where you are, then Vi certainly is.
My Experience
I have been using Vim for approximately 5 years now, I cannot remember why I started, but perhaps it just seemed obviously better to me. In my youth I was certainly a fan of memorising shortcuts to navigate the PC faster.
These days I use Vim the same way I use my bicycle, when I need it I use it! Simple enough right? But I can do more because I have a bicycle and I know how to use it. I do use Emacs more often, but that is because I need a little more firepower these days.
Vimtutor
Anyways, all you really need to get started is to type in vimtutor
on the terminal, and with that you can produce a site as simple, yet effective as my friends': Andrew Laurence Wood.
One thing to learn immediately is that typing ESC
followed by ZQ
will get you out of the editor. Then you should understand that you are working in a Modal Editor, one with 4 different modes:
Portability
Mastering Vim
This takes a long time, even I currently am not there, but I certainly know enough to be useful - that's the magic of Vim.
These days, NeoVim exists, which improves Vim further by treating Lua as a first-class plugin language. NeoVim allows LSP integration and asynchronous executions which not only makes it as fast as Vim, but in real codebases, makes it even faster.
Evolution
Briefly it is worth understanding the evolution of these 3 editors:
The original vi editor was created in the late 1970s as a visual mode for the ex
line editor on UNIX. Later in 1991, Vim (“Vi IMproved”) was released by Bram Moolenaar as an extended clone of vi, adding features vi lacked, namely multi-level undo, no help menus, no syntax highlighting, no window management, no code completion, and not even a visual
mode. Then 23 years later comes Neovim. A fork of Vim begun in 2014 to modernize the codebase for better extensibility and to add new capabilities such as asynchronous job control and IDE-like enhancements such as built-in LSP support.
By way of peformance comparisons, all three are lightweight and very fast. vi has the smallest footprint and runs the fastes, followed probably by NeoVim, and then lastly Vim.
Plugin-wise, Vim offers hundreds of plugins due to the 23 years that elapsed between its conception and NeoVim's existence. Vim's plugins rely on Vimscript which is reasonably archaic and slow. Whilst Neovim is backwards compatible (yay!) with Vim plugins, most are rewritten in the embedded language of Lua which is treated as a first-class plugin language in our newest and most hipster Vi, NeoVim :^].