Vim

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 13:17, 22 February 2019 by Admin (Talk | contribs)

Jump to: navigation, search

vim - Vi IMproved, a programmers text editor

Vim is a hyperefficient text editor and provides an extensive plug-in system which can be configured to user preferences. It also supports hundreds of programming languages and file extensions.

.vimrc

A default Vim installation will feature a file containing Vim’s core global settings called vimrc. This file will be located at either /etc/vim/vimrc or etc/vimrc, depending on your linux distribution.

A file that contains initialization commands is called a "vimrc" file. Each line in a vimrc file is executed as an Ex command line. It is sometimes also referred to as "exrc" file. They are the same type of file, but "exrc" is what Vi always used, "vimrc" is a Vim specific name. Also see |vimrc-intro|.

Places for your personal initializations:

Unix            $HOME/.vimrc or $HOME/.vim/vimrc
OS/2            $HOME/.vimrc, $HOME/vimfiles/vimrc
                or $VIM/.vimrc (or _vimrc)
MS-Windows      $HOME/_vimrc, $HOME/vimfiles/vimrc
                or $VIM/_vimrc
Amiga           s:.vimrc, home:.vimrc, home:vimfiles:vimrc
                or $VIM/.vimrc

The files are searched in the order specified above and only the first one that is found is read.

RECOMMENDATION: Put all your Vim configuration stuff in the $HOME/.vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it easy to copy it to another system.

If Vim was started with "-u filename", the file "filename" is used. All following initializations until 4. are skipped. $MYVIMRC is not set.

"vim -u NORC" can be used to skip these initializations without reading a file. "vim -u NONE" also skips loading plugins. |-u|

If Vim was started in Ex mode with the "-s" argument, all following initializations until 4. are skipped. Only the "-u" option is interpreted.

To disable an annoying behavior, such as bracket matching, you type :NoMatchParen while in the editor. You cannot add that syntax to .vimrc because the behavior is from a plugin called "matchparen.vim". To disable the behavior you can remove the plugin, or disable the plugin from loading by typing the following in .vimrc

let loaded_matchparen = 1

Here is an example .vimrc file located in /home/<username>/.vimrc

# cat .vimrc
set ignorecase
set nowrap
let loaded_matchparen = 1