Difference between revisions of "Vim"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
m
Line 3: Line 3:
 
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.
 
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.
  
Using vi is easy to learn, using vim is even easier.  Open the editor, then press the i key to put you into INSERT MODE and start typing.  [esc] takes you out of insert mode.  pressing the SHIFT + : key (shift colon) and w to save or q to quit.
+
Using vi is easy to learn, using vim is even easier.  Open the editor, then press the i key to put you into INSERT MODE and start typing.  [esc] takes you out of insert mode.  pressing the SHIFT + : key (shift colon) and w to save or q to quit.  Press SHIFT + : then the h key ENTER for help on all commands.
  
 
== .vimrc ==
 
== .vimrc ==

Revision as of 12:25, 22 February 2019

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.

Using vi is easy to learn, using vim is even easier. Open the editor, then press the i key to put you into INSERT MODE and start typing. [esc] takes you out of insert mode. pressing the SHIFT + : key (shift colon) and w to save or q to quit. Press SHIFT + : then the h key ENTER for help on all commands.

.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

set ignorecase
set nowrap
let loaded_matchparen = 1

some other local vim references