Left/right motions
Nh = Left N = Number of chars to move |
Nl = Right N = Number of chars to move |
0 = First char in line |
^ = First non blank char in ine |
g0 = To first character in screen line |
g^ = To first non-blank character in screen line |
g$ = To last character in screen line |
Nf{char} = To the Nth occurrence of {char} to the right |
NF{char} = To the Nth occurrence of {char} to the left |
Nt{char} = Till before the Nth occurrence of {char} to the right |
NT{char} = Till before the Nth occurrence of {char} to the left |
Up/down motions
Nk = Up N lines |
Nj = Down N lines |
N- = Up N lines, on the first non-blank character |
N+ = Down N lines, on the first non-blank character |
G = Goto line N (default: last line), on the first non-blank character |
Ngg = Goto line N (default: first line), on the first non-blank character |
Ngk = Up N screen lines |
Ngj = Down N screen lines |
Text object motions
Nw = Number of word/s forward |
NW = Number of blank-separated word/s forward |
Ne = Forward to the end of the Nth word/s |
NE = Forward to the end of the Nth blank-separated word/s |
Nb = N word/s backward |
NB = N blank-separated word/s backward |
Nge = backward to the end of the Nth word/s |
NgE = Backward to the end of the Nth blank-separated word/s |
N) = N sentences forward |
N( = N sentences backward |
N} = N paragraphs forward |
N{ = N paragraphs backward |
|
|
Pattern searches
N/{pattern}/{offset} <Enter> = Search forward for the Nth occurrence of {pattern} from {offset} |
N?{pattern}?{offset} <Enter> = Search backward for the Nth occurrence of {pattern} from {offset} |
N/ <Enter> = Repeat last search, in the forward direction to Nth occurrence |
N? <Enter> = Repeat last search, in the backward direction to Nth occurrence |
n = Repeat last search |
N = Repeat last search in opposite direction |
N* = Search forward for the identifier under the cursor to Nth occurrence |
N# = Search backward for the identifier under the cursor to Nth occurrence |
Ng = Like "", but also find partial matches |
Ng# = Like "#", but also find partial matches |
Search pattern special chars
magic = "." non-magic = "\." = Matches any single character |
^ = Matches start of line |
\< = Matches start of word |
\> = Matches end of word |
magic = "[a-z]" non-magic = " \[a-z]" = Matches a single char from the range |
magic = "[a-z]" non-magic = " \[a-z]" = Matches a single char not in the range |
Marks
m{a-zA-Z} = Mark current position with mark {a-zA-Z} |
`{a-z} = Go to mark {a-z} within current file |
`{A-Z} = Go to mark {A-Z} in any file |
`{0-9} = Go to the position where Vim was previously exited |
`` = Go to the position before the last jump |
`" = Go to the position when last editing this file |
`[ = Go to the start of the previously operated or put text |
`] = Go to the end of the previously operated or put text |
`< = Go to the start of the (previous) Visual area |
`> = Go to the end of the (previous) Visual area |
`. = Go to the position of the last change in this file |
:marks = Print the active marks |
N<Ctrl-O> = Go to Nth older position in jump list |
N<Ctrl-I> = Go to Nth newer position in jump list |
:ju = Print the jump list |
|
|
Inserting text
Na = Append text after the cursor (N times) |
NA = Append text at the end of the line (N times) |
Ni = Insert text before the cursor (N times) |
NI = Insert text before the first non-blank in the line |
NgI = Insert text in column 1 (N times) |
No = Open a new line below the current line, append text (N times) |
NO = Open a new line above the current line, append text (N times) |
Deleting text
Nx = Delete N characters under and after the cursor |
NX = Delete N characters before the cursor |
Nd{motion} = Delete the text that is moved over with {motion} |
Ndd = Delete N lines |
ND = Delete to the end of the line (and N-1 more lines) |
NJ = Join N-1 lines (delete <EOL>s) |
NgJ = Like "J", but without inserting spaces |
Copying and moving text
"{char} = Use register {char} for the next delete, yank, or put |
Ny{motion} = yank the text moved over with {motion} into a register |
Nyy = Yank N lines into a register |
NY = Yank N lines into a register |
Np = Put a register after the cursor position (N times) |
NP = Put a register before the cursor position (N times) |
N]p = Like p, but adjust indent to current line |
N[P = Like P, but adjust indent to current line |
Ngp = Like p, but leave cursor after the new text |
NgP = Like P, but leave cursor after the new text |
Changing text
Nr{char} = Replace N characters with {char} |
Ngr{char} = Replace N characters without affecting layout |
NR = Enter Replace mode (repeat the entered text N times) |
NgR = Enter virtual Replace mode: Like Replace mode but without affecting layout |
c{motion} = Change the text that is moved over with {motion} |
Ncc = Change N lines |
NS = Change N lines |
NC = Change to the end of the line (and N-1 more lines) |
Ns = Change N characters |
N~ = Switch case for N characters and advance cursor |
g~{motion} = Switch case for the text that is moved over with |
gu{motion} = Make the text that is moved over with {motion} lowercase |
gU{motion} = Make the text that is moved over with {motion} uppercase |
N<Ctrl-A> = Add N to the number at or after the cursor |
N<Ctrl-X> = Subtract N from the number at or after the cursor |
Repeat
N. = Repeat last change (with count replaced with N) |
q{a-z} = Record typed characters into register {a-z} |
q{A-Z} = Record typed characters, appended to register {a-z} |
q = Stop recording |
N@{a-z} = Execute the contents of register {a-z} (N times) |
Ngs = Goto Sleep for N seconds |
Undo/Redo
Nu = Undo last N changes |
N<Ctrl-R> = Redo last N undone changes |
U = Restore last changed line |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets