Vim-Galore – All things Vim!

Categories:

Recommended

What is Vim? 

Vim is a text editor with a long line of ancestors that goes back to qed. Bram Moolenaar released it in 1991.

The project is hosted online at vim.org.

Getting Vim: Use your favourite package manager or visit the download page from vim.org.

Discussions and user questions are best done on the vim_use mailing list or using IRC (Freenode) in the #vim channel.

Development happens on GitHub, discussions on the vim_dev mailing list.

Read Why, oh WHY, do those #?@! nutheads use vi? to see common misconceptions about Vim explained.

The Vim Philosophy 

Vim adheres to the modal editing philosophy. This means that it provides multiple modes and the meaning of keys changes according to the mode. You navigate files in normal mode, you insert text in insert mode, you select lines in visual mode, you access commands in command-line mode and so on. This might sound complicated at first, but has a huge advantage: you don’t have to break your fingers by holding several keys at once, most of the time you simply press them one after the other. The more common the task, the fewer keys are needed.

A related concept that works well with modal editing are operators and motions. Operators start a certain action, e.g. changing, removing, or selecting text. Afterwards you specify the region of text you want to act on using a motion. To change everything between parentheses, use ci( (read change inner parentheses). To remove an entire paragraph of text, use dap (read delete around paragraph).

If you see advanced Vim users working, you’ll notice that they speak the language of Vim as well as pianists handle their instruments. Complex operations are done using only a few key presses. They don’t even think about it anymore as muscle memory took over already. This reduces cognitive load and helps to focus on the actual task.

First steps 

Vim comes bundled with an interactive tutorial that teaches the most basic things you need to know about. You can start it from the shell: Don’t be put off by how boring it looks like and work through the exercises.

$ vimtutor

The editors or IDEs you used before were most probably all non-modal, so working by switching modes will seem awkward at first, but the more you use Vim, the more it becomes muscle memory.

Vim was bolted on Stevie, a vi clone, and supports two operating modes: “compatible” and “nocompatible”. Using Vim in compatible mode means using vi defaults for all options, opposed to Vim defaults. As long as you didn’t create a user vimrc yet or started Vim with vim -N , compatible mode is assumed! Don’t use Vim in compatible mode. Just don’t.

Next steps:

  1. Create your own vimrc.
  2. Have some cheatsheets ready for the first weeks.
  3. Read through the basics section to learn what is even possible.
  4. Learn on demand! You never finish learning Vim. If you encounter any problems, just look for it on the internet. Your problem was solved already. Vim comes with great documentation and knowing how to navigate it is a must: Getting help offline.
  5. Have a look at the additional resources.

One last advice: Please learn how to use Vim properly before starting to add all kinds of hyped plugins that only implement features that Vim already supports natively.

Minimal vimrc

The user vimrc can be put into ~/.vimrc or for the sake of better separation into ~/.vim/vimrc . The latter makes it easy to put the entire configuration under version control and upload it to, let’s say GitHub.

You find many “minimal vimrcs” all over the net, and maybe my version isn’t as minimal as it should be, but it provides a good set of sane settings that I deem to be useful for starting out.

Eventually you have to read up on all the mentioned settings anyway and decide for yourself. 🙂

So here it is: minimal-vimrc

In case you’re interested, here’s my vimrc.

TIP: Most plugin authors maintain several plugins and also publish their vimrc on GitHub (often in a repository called “vim-config” or “dotfiles”), so whenever you find a plugin you like, look up its maintainer’s GitHub page and look through the repositories.

Category:

Attribution

Marco Hinz, Vim-Galore – All things Vim!, URL: https://github.com/mhinz/vim-galore#readme

This work is licensed under Attribution-ShareAlike 4.0 International license:  (https://creativecommons.org/licenses/by-sa/4.0/).

VP Flipbook Maker

When reading documents online, it may be bored if they are presented in a long pages. In this case, converting them to digital flipbook is a good way for you to make it be more interesting. Try to do it with VP Online now!