In my opinion, the Vim editor has the following benefits:
- It keeps your finger on the keyboard throughout the development and moving the cursor without the arrow keys keeps your fingers in the best position for typing.
- Convenient file switching and panel controls allow you to edit multiple files simultaneously or even different locations of the same file.
- Vim's macros can batch repeat operations (e.g. add tabs to multi-lines, etc.)
- Vim is well-suited for Linux servers without GUI. When you connect to a remote server through
ssh, you can only develop from the command line because there is no GUI (of course, many IDEs such as PyCharm now provide
sshplugins to solve this problem).
- A rich ecology of plugins gives you the world's most fancy command-line editor.
How to learn Vim
Unfortunately Vim does have a pretty steep learning curve and it took me a few weeks to get used to developing with Vim. You'll feel very uncomfortable at first, but once you get past the initial stages, trust me, you'll fall in love with Vim.
There is a vast amount of learning material available on Vim, but the best way to master it is to use it in your daily development, no need to learn all the fancy advanced Vim tricks right away. The recommended learning path is as follows:
- Read This tutorial first to understand the basic Vim concepts and usage.
- Use Vim's own
vimtutorto practice. After installing Vim, type
vimtutordirectly into the command line to enter the practice program.
- Then you can force yourself to use Vim for development, and you can install Vim plugins in your favorite IDE.
- Once you're fully comfortable with Vim, a new world opens up to you, and you can configure your own Vim on demand (by modifying the
.vimrcfile), and there are countless resources on the Internet to learn from.
- If you want to know more about how to customize Vim to suit your needs, Learn Vim Script the Hard Way is a perfect start point.
Ctrl and Esc keys are probably two of the most used keys in Vim. However, these two keys are pretty far away from home row. In order to make it easier to reach these keys, you can remap CapsLock to Esc or Ctrl.
On Windows, Powertoys or AutoHotkey can be used to achieve this goal.
On macOS, you can remap keys in system settings, see this page. Karabiner-Elements also works.
A better solution is to make CapsLock function as Esc and Ctrl simultaneously. Click CapsLock to send Esc, hold CapsLock to use it as Ctrl key. Here's how to do it on different systems:
- Neil, Drew. Practical Vim: Edit Text at the Speed of Thought. N.p., Pragmatic Bookshelf, 2015.
- Neil, Drew. Modern Vim: Craft Your Development Environment with Vim 8 and Neovim. United States, Pragmatic Bookshelf.