01-05-2021



Vim Installation

Mac OS come with a vim, which might not be the latest version. Using Homebrew1, latest version of vim can be obtained by running

I tried to update my vim using homebrew by typing brew install vim and everything seemed to be fine. When I type vim I still see the system vim loading (version 7.3). I feel like I'm missing a step that's keeping me from using the updated vim I got from homebrew. Install vim on Mac OSX. June 23, 2017 Amber. App name: vim; App description: Vi “workalike”” with many additional features. Brew install vim.

For Linux, for example, Ubuntu,

For Windows, installers could be obtained at the offical website. And one famous vim plugin YouCompleteMe also provides a vim build with Lua, Perl, Python, Racket, Ruby support.

vimtutor

Shipped with vim, vimtutor is one of the most effective tutorials to vim. It covers many actions and commands that help beginners to become productive using vim. After installation of vim, one could enter vimtutor by running the following command in terminal (for windows, it can be located at the vim installation folder):

It may take 25 to 30 minutes for one to complete the tutorial. But it will definitely take more time to get used to the modal editing philosophy of vim. In my opinion, all editors are trying to solve one core issue:

How to be (more) productive with a limited number of keys provided by a keyboard?

One typical way to solve this is using modifier keys like ctrl and alt. A daily usage case is we use ctrl + c to copy and ctrl + p to paste. And some times one need to chain multiple key chords to archive certain task. For example, one need to press ctrl + cctrl + xctrl + l in org-mode to preview LaTex math equations.

Instead of heavily relying on the modifier key, vim uses different modals to assign different “meanings” to the same key. For example,

  • In insert mode, d and w will enter the character.
  • But in normal mode, d means “delete” and w actually moves the cursor to the “word”

I am not saying the second approach (vim) is better than the first approach (emacs). They are just different “answers” to the issue above.

Simple Setups for a Better Look

Install Vim Mac Brew

After entering vim, one could type the following commands to:

  1. Show the line number

  2. Use syntax highlighting

  3. Use relative line number

  4. Not compatible to vi

In most cases, we put configurations of vim in a file named .vimrc (_vimrc on Windows) and vim will execute commands in the configuration file when it starts. The file is located at

And we can put the following lines in the .vimrc file:

With some practices and usage of some plugins, you can be really productive using vim. Happy Vimming!

And here is the link to the Chinese version of this post.

Vim Macro Vimrc

Some Great Vim Tutorials

  • vimtutor

Vim Installation

Mac OS come with a vim, which might not be the latest version. Using Homebrew1, latest version of vim can be obtained by running

For Linux, for example, Ubuntu,

For Windows, installers could be obtained at the offical website. And one famous vim plugin YouCompleteMe also provides a vim build with Lua, Perl, Python, Racket, Ruby support.

vimtutor

Shipped with vim, vimtutor is one of the most effective tutorials to vim. It covers many actions and commands that help beginners to become productive using vim. After installation of vim, one could enter vimtutor by running the following command in terminal (for windows, it can be located at the vim installation folder):

It may take 25 to 30 minutes for one to complete the tutorial. But it will definitely take more time to get used to the modal editing philosophy of vim. In my opinion, all editors are trying to solve one core issue:

How to be (more) productive with a limited number of keys provided by a keyboard?

One typical way to solve this is using modifier keys like ctrl and alt. A daily usage case is we use ctrl + c to copy and ctrl + p to paste. And some times one need to chain multiple key chords to archive certain task. For example, one need to press ctrl + cctrl + xctrl + l in org-mode to preview LaTex math equations.

Instead of heavily relying on the modifier key, vim uses different modals to assign different “meanings” to the same key. For example,

  • In insert mode, d and w will enter the character.
  • But in normal mode, d means “delete” and w actually moves the cursor to the “word”

I am not saying the second approach (vim) is better than the first approach (emacs). They are just different “answers” to the issue above.

Vim Mac Vimrc

Simple Setups for a Better Look

Vim Setup Mac

After entering vim, one could type the following commands to:

  1. Show the line number

  2. Use syntax highlighting

  3. Use relative line number

  4. Not compatible to vi

In most cases, we put configurations of vim in a file named .vimrc (_vimrc on Windows) and vim will execute commands in the configuration file when it starts. The file is located at

And we can put the following lines in the .vimrc file:

With some practices and usage of some plugins, you can be really productive using vim. Happy Vimming!

And here is the link to the Chinese version of this post.

Some Great Vim Tutorials

Vim Mac Os

  • vimtutor