On macOS Vim is also already installed, but it's quite an onld version and
has no python support built in. Therefore it's suggested to install a recent
version using Homebrew:
brew install vim
Every Linux distribution brings a Vim package that is installable by using the distribution's package manager.
Besides Vim also consider to use Neovim right away. This is a modern drop-in replacement for Vim. That means it function almost identical, can almost be identically configured, but feature Lua support and a lot more possibilities and features. Neovim can also be installed using Homebrew or from a pre-built package. See Neovim releases for the download links.
When beginning the journey of master Vim, a first stop might the built in
vimtutor to start this "interactive document".
There is huge Vim tutorial in 5 pieces targetting beginners and builds up to veterans:
- Is Vim Really Not For You? A Beginner Guide
- A Vim Guide for Intermediate Users
- A Vim Guide for Advanced Users
- A Vim Guide for Adept Users
- A Vim Guide for Veteran Users
And other Tutorials with its strengths and weaknesses:
And espcially about Text Objects:
And Vimscript which also covers customizing Vim and not only plugin development:
And finally one from the Vim project leader Bram Moolenaar himself, though not for beginners but those that already know Vim for some time but want to get better:
There's even a browser game vim-adventures that teaches Vim.
The Vim Tutorial (beginner)
Mastering the Vim Language (advanced)
How to Do 90% of What Plugins Do (With Just Vim) (advanced)
In vim, how do I...
replace line breaks?
As a command, type
To get ^M, press Ctrl+V followd by Ctrl+M
search and replace over all project files
This recipe is copied and condensed from jdhao's blog.
We can use
vimgrep command to populate the Vim quickfix list with files
matching our specific pattern. The
cfdo command can then be utilized to
perform replacement operation for each file in the quickfix list.
To find all files containing Neovim under current directory using
can use the following the command:
:vimgrep /Neovim/gj **/*
In the above command, Neovim is our search pattern. The meanings of g and j flags are as follows:
- g: Add all matches in a line to the quickfix list.
- j: Do not jump the cursor to the location of first pattern match.
**/* specify the files to search for the pattern. In this case, it means
to search recursively under the current directory and for all files types. You
can also search only in certain files types by adding a file type to the search
After this step, the quickfix will be populated with the matching files, lines
and column number (use
copen to open the quickfix list):
After the quickfix list is filled with files containing the search pattern, we
cfdo command to perform replace operation on each file:
:cfdo %s/Neovim/Nvim/ge | update
cfdo command can be followed by one command or a series of commands
|). In the above example, we first perform substitution, then
followed by update command so that the replacement change is saved.
There's a good write-up on using markdown in Vim
If using ciritic markup, this plugin adds vim functions to approve or reject changes, though obviously not maintained anymore. Recommended by vim-markdown.
Another good blog post is Markdown Writing and Previewing in Neovim - A Complete Guide
Vim/Nvim useful tricks: Lots of short tips on shortcuts