,
,
,
[operator][count][motion] gg
:h up-down-motions
:h i_cmd <Tab>
first
line Insert mode cmd help ^i \t Tab
:h v_cmd <C-n>
W
count as motions, too! d/
delete/cut foo will delete from the
cursor to the next instance
s
[, ]
sentence
[ ] block ^b use tabs only n n 0 off softtabstop sts Spaces per tab Visual mode cmd help ^n Ctrl-n
IS
<Tab> inserts spaces
RIGHT OUT.
:h c_cmd Command-line editing cmd help
:h tags-and-searches <M-n> Alt-n
^u
(t h a t m e an s don 't do i t . )
:h :cmd Command-line cmd help ^] Jump to tag under cursor,
including [tags] in help files <Esc> ^[ Escape
iw k fileformat ff Try changing this if your line-endings are messed up :helpgrep Search through all help docs!
g^] Jump to tag if it's the only
match; else list matching tags <Del> Delete
<
shift left
=
indent
i( iW up 1
line
list Display whitespace visibly according to listchars
7 words
:h left-right-motions
:h word-motions
beginning
of line
0
first
non-blank
character ^
previous
WORD B previous
word b previous
character h next
character l end of
word e beginning
of next
word
w end of
WORD E beginning
of next
WORD
W end of
line $ http://www.vimcheatsheet.com
1 WORD
j
:h pattern-searches
:set opt?
Prev Next Forward Backward Matches hidden hid Lets you switch buffers without saving Use a instead
1 line
u undo
^r redo
. repeat
View current value of opt
of i when
/foo ?foo foo laststatus ls Show status line never (0), always (2) or with 2+ windows (1) beginning text-
^d :set noopt
file-searching
N n find file under
:set opt
down
or surrounding
; ,
tx Tx upto x ½ page
x delete character
after cursor % jump to
matching paren r replace char
under cursor
Turn on flag opt number nu Show line numbers
whitespace.
:set opt=val
For example,
fx Fx find x showcmd sc Show commands as you type them
:set opt+=val
set mark M jump to first down align top of align bottom
mm set mark m
(a-z) in file mM (A-Z) across
files '[ char of just-
changed text
1 page
zz center screen on
cursor zt screen with
cursor zb of screen with
cursor
Append to value of opt
backspace bs Set to ‘2’ to make backspace work like sane editors
“()”, but
will delete the
da(
'm
jump to first
char of line
containing m
`m jump to exact
character of m '' jump back to
last jump
G == auto-indent
current line << shift current line
left by shiftwidth >>
shift current
line right by
shiftwidth
:echo &opt Access opt as a variable wrap
background bg
Control line wrapping
last line
:h buffers
Pass a directory to the :edit command to open a directory explorer. Using ^[ to return to Normal mode lets you keep your fingers on the home
REGISTERS CLIPBOARDS
:ls
Instructions for usage are at the top of the screen. row. It’s even easier if you map Caps Lock to Control! are Use :map to
List all open files
:h insert.txt All commands that delete, copy, or paste text use registers. To change which register view all current
is used by a command, type the register before the command. The default register is custom key
ENTERING INSERT MODE COOL INSERT MODE STUFF
:b path Jump to unique file matching path. Use
<Tab> to scroll through available completions! called “the unnamed register”, and it is invoked with a pair of double-quotes (""). Typ- mappings. Read
:h map-which-
beginning
of line I before
cursor i after
cursor a end of
line A ^w delete word before cursor
^u delete line before cursor
previous
line O next
line o substitute
character s substitute
line S line from
cursor C ^rr insert the contents of
register r ^r=
use the expression register
(try ^r=5+10)
:bnext Jump to next file
:registers View all current registers
are best for your
own custom
mappings. Get
v V ^v
within a line. Visual Line mode to that happens to be
:h cmdline.txt
:edit "_
select one or more conveniently aligned.
The black hole Use this to delete without clobbering any
Open a file for editing
COMMAND-LINE MODE ONLY
lines. Visual Block mode
can be used to select register register ("_dd)
boxes across lines.
switch cursor
to start/end o re-select
previous area gv prepend to each
Visual block line
I jump to start
of prior area
'<
edit using
Normal mode
cmdwin ^f
insert word
under cursor
cmdline-editing ^r^w completion
suggestions
cmdline-completion ^d :enew Open a blank new file for editing
"0 Last yank
register
Contains the last text you yanked
1st Edition
funded by...
MML
Adam.
"1
jdiemz
:h v_o :h gv :h v_b_I :h '<
Last big delete Lin Qiu
Put cnoremap %% <C-R>=expand(‘%:h’).’/’<CR> in your .vimrc so you can type %% in Command-line :h windows Contains the last line(s) you deleted @webjoe
register grantok
"2 - "9
and quit changes (like :q!) Big delete Every time "1 is written to, its content is
Digininja
Dave Remy
Supply % as a range to the :substitute command to run it on every line in the file. register stack pushed to "2, then "2 to "3, and so on Ralph Bean
:write :vsplit
Arve Løken
Rajat Ghai
Write current file :%s/Scribbl/Design/ “Scribbled” -> “Designed” Split current window vertically
"-
Paul-Kenji
Small delete Contains the last text you deleted within a Mark Dizon
Specify the “g” flag to apply the substitution to every match on a line.
Neil Munro
register single line Kyle Verma
:wq ^w hjkl Move cursor to window left, below, above or to Guy Bensky
Write current file and quit :s/[dla]//g “badly” -> “by” :h s_flags, :h /[] Ross Timson
"+
the right of the current window If the OS integration gods smile upon Abdul Qabiz
Vim supports many regular expression features. System clipboard you, this register reads and writes to your Daniel Beck
Hazel Smith
^w HJKL Move current window to left, bottom, top, or system clipboard. Kelly Raila
Use :scriptnames to list all files sourced during initialization. :s/..k/ax/ “Mook” -> “Max”
:h usr_27, :h /.
right of screen
Charles Chen
Pivotal Labs
"a - "z
Eric Sporkin
Use \_. instead of . if you want to search across multiple lines. Named registers 26 registers for you to play with M. Adam Price
:syntax ^w r
Daniel Hahler
Enable and configure syntax highlighting Rauli Silvola
:make ^w +-<>
:h quickfix Infonautic.de
Run a compiler and enter quickfix mode :h sub-replace-special Increase/decrease current window height/width @andersosthus
:s_\(f..\)_\U\1\E_ “foobar” -> “FOObar” Damon Jablons
:! ! ^w T
Rouven Hernier
Execute external shell Filter motion with shell Digital Gnomes
Move current window to a new tab Sam Napolitano
command command :g/foobar/delete Delete all lines containing “foobar”
@r
Jens O. Meiert
:only
Hurricane Labs
Use :earlier and :later to quickly jump backward and forward in a file's history. Close all windows except current window Michael Schmidt
@@
:s_Data/Lore_Brent Spiner_ Repeat last Repeat the last @r, this is particularly
Matthew Datcher
Arya Reais-Parsi
David Macfarlane
playback useful with a count
:read :bufdo
Use \= to evaluate expressions with replacement groups. Christer Edvartsen
Read external program output into current file Execute a command in each open file
St. Louis Vim Geeks
Haraldur Tristan Gunnarsson
“10 25” -> “21 36” :h sub-replace-\=
:s_\d_\=submatch(0) + 1_g vim one-liner used to sort the list of names by length:
:exe 'g/^/let @x = len(getline(".")) | normal "xPa ' | sort n | :g//normal dw
and others!