跳到导航 跳到搜索

Vim is an editor to create or edit a text file.

VIM Editor Commands






$ mkdir -p ~/.vim/{ftdetect,indent,syntax} && for d in ftdetect indent syntax ; do curl -o ~/.vim/$d/scala.vim$d/scala.vim; done

Then edit ~/.vimrc, add:

syntax on

cd ~/.vim/ftdetect:

$ wget


For basic searching:

  • /pattern - search forward for pattern
  • ?pattern - search backward
  • n - repeat forward search
  • N - repeat backward

Some variables you might want to set:

  • :set ignorecase - case insensitive
  • :set smartcase - use case if any caps used
  • :set incsearch - show match as search


Text Entry

Used to start text entry

a Append text following current cursor position
A Append text to the end of current line
i Insert text before the current cursor position
I Insert text at the beginning of the cursor line
o Open up a new line following the current line and add text there
O Open up a new line in front of the current line and add text there

Cursor Movement

Help for MediaWiki Table: here

h Moves the cursor one character to the left
l Moves the cursor one character to the right
k Moves the cursor up one line
j Moves the cursor down one line
nG or :n Cursor goes to the specified (n) line (ex. 10G goes to line 10)
^f One page forward
^b One page backward
$ Move cursor to the end of current line
0 (zero) Move cursor to the beginning of current line
w Forward one word
b Backward one word

Text Deletion Commands

Used to delete text

x Delete character
dw Delete word from cursor on
db Delete word backward
dd Delete line
d$ Delete to end of line


Used to exit text editing

:wq Write file to disk and quit the editor
:q! Quit (no warning)
:q Quit (a warning is printed if a modified file has not been saved)
ZZ Save workspace and quit the editor (same as :wq)