User Tools

Site Tools


vim

Basic Commands

h l k j left, right, line up, down
b w word left, right
^ $ first, last character of line
(n)G (n)gg line n, default the last, first
i a insert before, after cursor
I A insert at beginning, end of line
o O open a new line below, above the current line
R eeplace characters starting at the cursor
x X delete character under, before cursor
d(m) delete text of movement command m
dd D delete current line, to the end of line
J join current line with next
y(m) yank the text of movement command m
yy or Y yank current line into register
p P put register after, before cursor position
u U undo last command, restore last changed line
/s ?s search forward, backward for s
n or / repeat forward last search
N or ? repeat backward last search

Ex Commands

:!(cmd) execute command
:e file edit file, unless changes have been made
:e! file edit file always (by default reload current)
:wn :wN write file and edit next, previous one
:n :N edit next, previous file in list
:q :q! quit & confirm, quit and discard changes
:wq or :x or ZZ write to current file and exit
:sh start shell
:set hls! Turn off highlighting

Advanced Commands

^Ws or :split split window in two
^Wn or :new create new empty window
^Wo or :on make current window one on screen
^Wj ^Wk move to window below, above
^Ww ^W^W move to window below, above (wrap)
vim.txt · Last modified: 2017/11/09 02:49 by mark