Sei sulla pagina 1di 2

Vim Cheat Sheet - English https://vim.rtorr.

com/
Vim Cheat Sheet
Global Editing Cut and paste Working with multiple files Tabs
:help keyword - open r - replace a single yy - yank (copy) a line :e file - edit a file in a :tabnew or :tabnew
help for keyword character new buffer file - open a file in a
2yy - yank (copy) 2 lines new tab
:o file - open file J - join line below to the :bnext or :bn - go to
current one with one yw - yank (copy) the the next buffer Ctrl + wT - move the
:saveas file - save file space in between characters of the word current split window
as from the cursor position :bprev or :bp - go to into its own tab
gJ - join line below to to the start of the next the previous buffer
:close - close current the current one without word gt or :tabnext or :tabn
pane space in between :bd - delete a buffer - move to the next tab
y$ - yank (copy) to end (close a file)
K - open man page for cc - change (replace) of line gT or :tabprev or :tabp
word under the cursor entire line :ls - list all open - move to the previous
p - put (paste) the buffers tab
Cursor movement cw - change (replace) to clipboard after cursor
the end of the word :sp file - open a file #gt - move to tab
h - move cursor left
P - put (paste) before in a new buffer and number #
j - move cursor down c$ - change (replace) to cursor split window
the end of the line :tabmove # - move
k - move cursor up dd - delete (cut) a line :vsp file - open a file current tab to the #th
s - delete character and in a new buffer and position (indexed from
l - move cursor right substitute text 2dd - delete (cut) 2 lines vertically split window 0)
H - move to top of S - delete line and dw - delete (cut) the Ctrl + ws - split :tabclose or :tabc -
screen substitute text (same as characters of the word window close the current tab
cc) from the cursor position
and all its windows
M - move to middle of to the start of the next Ctrl + ww - switch
screen xp - transpose two word windows :tabonly or :tabo -
letters (delete and close all tabs except
L - move to bottom of paste) D - delete (cut) to the Ctrl + wq - quit a
for the current one
screen end of the line window
u - undo :tabdo command - run
w - jump forwards to the d$ - delete (cut) to the Ctrl + wv - split
the command on all tabs
start of a word Ctrl + r - redo end of the line window vertically
(e.g. :tabdo q - closes
W - jump forwards to the . - repeat last command x - delete (cut) Ctrl + wh - move all opened tabs)
start of a word (words character cursor to the left
can contain Marking text (visual mode) window (vertical split)
punctuation) v - start visual mode, Exiting
Ctrl + wl - move
mark lines, then do a :w - write (save) the file,
e - jump forwards to the cursor to the right
command (like y-yank) but don't exit
end of a word window (vertical split)
V - start linewise visual :w !sudo tee % - write
E - jump forwards to the Ctrl + wj - move
mode out the current file
end of a word (words cursor to the window
using sudo
can contain o - move to other end of below (horizontal split)
punctuation) marked area :wq or :x or ZZ - write
Ctrl + wk - move
(save) and quit
b - jump backwards to Ctrl + v - start visual cursor to the window
the start of a word block mode :q - quit (fails if there above (horizontal split)
are unsaved changes)
B - jump backwards to O - move to other corner
the start of a word of block :q! or ZQ - quit and
(words can contain throw away unsaved
punctuation) aw - mark a word changes

% - move to matching ab - a block with () :wqa - write (save) and


character (default quit on all tabs
supported pairs: '()', aB - a block with {}
'{}', '[]' - use :h Search and replace
ib - inner block with ()
matchpairs in vim for
/pattern - search for
more info) iB - inner block with {} pattern
0 - jump to the start of Esc - exit visual mode ?pattern - search
the line
backward for pattern
Visual commands
^ - jump to the first non-
> - shift text right \vpattern - 'very magic'
blank character of the
pattern: non-
line
< - shift text left alphanumeric
$ - jump to the end of characters are
y - yank (copy) marked interpreted as special
the line
text regex symbols (no
g_ - jump to the last escaping needed)
d - delete marked text
non-blank character of
the line n - repeat search in
~ - switch case
same direction
gg - go to the first line
Registers N - repeat search in
of the document
1 of 2 :reg - show registers opposite direction 12/9/17, 9:06 AM
G - go to the last line of content
the document :%s/old/new/g - replace
"xy - yank into register
5G Cheat x all old with new
Vim Sheet
- go to line 5 - English throughout file
https://vim.rtorr.com/
fx - jump to next "xp - paste contents of
occurrence of character register x :%s/old/new/gc -
x replace all old with new
Marks throughout file with
tx - jump to before next :marks - list of marks confirmations
occurrence of character
x ma - set current position :noh - remove
for mark A highlighting of search
Fx - jump to previous matches
occurence of character `a - jump to position of
x mark A Search in multiple files
:vimgrep /pattern/
Tx - jump to after y`a - yank text to
{file} - search for
previous occurence of position of mark A
pattern in multiple files
character x
Macros
; - repeat previous f, t, qa - record macro a :cn - jump to the next
F or T movement match
q - stop recording
, - repeat previous f, t, macro :cp - jump to the
F or T movement, previous match
backwards @a - run macro a
:copen - open a window
} - jump to next @@ - rerun last run containing the list of
paragraph (or macro matches
function/block, when
editing code)

{ - jump to previous
paragraph (or
function/block, when
editing code)

zz - center cursor on
screen

Ctrl + b - move back


one full screen

Ctrl + f - move forward


one full screen

Ctrl + d - move forward


1/2 a screen

Ctrl + u - move back


1/2 a screen

Insert mode -
inserting/appending text
i - insert before the
cursor

I - insert at the
beginning of the line

a - insert (append) after


the cursor

A - insert (append) at
the end of the line

o - append (open) a new


line below the current
line

O - append (open) a new


line above the current
line

ea - insert (append) at
the end of the word

Esc - exit insert mode

2 of 2 12/9/17, 9:06 AM

Potrebbero piacerti anche