Sie sind auf Seite 1von 2

24/8/2019 Home | Vim Cheat Sheet

Vim Cheat Sheet


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

5G - go to line 5 Visual commands N - repeat search in opposite


direction
fx - jump to next occurrence of > - shift text right
character x :%s/old/new/g - replace all
< - shift text left old with new throughout file
tx - jump to before next
occurrence of character x y - yank (copy) marked text :%s/old/new/gc - replace
all old with new throughout file
Fx - jump to previous occurence d - delete marked text with confirmations
of character x
~ - switch case :noh - remove highlighting of
Tx - jump to after previous search matches
occurence of character x Registers
:reg - show registers content Search in multiple files
; - repeat previous f, t, F or T
movement "xy - yank into register x :vimgrep /pattern/
{file} - search for pattern in
, - repeat previous f, t, F or T "xp - paste contents of register multiple files
movement, backwards x
} - jump to next paragraph (or :cn - jump to the next match
function/block, when editing Marks
code) :marks - list of marks :cp - jump to the previous
match
{ - jump to previous paragraph ma - set current position for
(or function/block, when editing mark A :copen - open a window
code) containing the list of matches
https://vim.rtorr.com 1/2
24/8/2019
zz - center cursor on screen `a - jump to position of mark A Home | Vim Cheat Sheet

Ctrl + e - move screen down y`a - yank text to position of


one line (without moving mark A
cursor)
Macros
Ctrl + y - move screen up one
line (without moving cursor) qa - record macro a
Ctrl + b - move back one full q - stop recording macro
screen
@a - run macro a
Ctrl + f - move forward one
full screen @@ - rerun last run macro

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

https://vim.rtorr.com 2/2

Das könnte Ihnen auch gefallen