Sunteți pe pagina 1din 2

Vim Cheat Sheet

Basic Commands

Started with Vim Delete

Insert mode: d to start deleting


i to enter insert mode & enter text normally dw to delete a word
o to enter insert mode & open a line below cursor d0 to delete from the cursor to the beginning of the line
O to enter insert mode & open a line above cursor d$ to delete from the cursor to the end of the line
dgg to delete to the beginning of the file
Command mode: dG to delete to the end of the file
Escape to enter command mode u to undo
CTRL-r to redo the last undo
Lat-line mode:
Copying and Pasting
: from command mode to enter last-line mode
v will highlight one character at a time
V will highlight one line at a time
Movement basics in Vim CTRL-v will highlith by colummns
p will paste text after the current line
h moves the cursor left P will paste text on the current line
j moves the cursor down one line y will yank text into the copy buffer
k moves the cursor up one line
l moves the cursor to the right “+y will yank text into the copy to the clipboard
0 moves the cursor to the beginning of the line “+p
$ moves the cursor to the end of the line
w moves the cursor forward one word
b moves the cursor backwards one word Saving and Quitting
G moves to the end of file :w [filename] to write
gg moves to the beginning of the file :wq [filename] to write and then quit
:q! to quit without saving
Searching and replacing :w! [filename] to write over a file
CTRL-z Can leave Vim in the background
/ to search forward
? to search backwards
n to move to the next instance of the search term use
N to move to the previous instance

%s/text/replacement/g to search and replace


%s/text/replacement/gc with confirmation (recommended)
Vim Cheat Sheet
Basic Commands

A Great Vim Sheet


http://vimsheet.com

Copy text to the system clipboard


http://vi.stackexchange.com/questions/84/how-can-i-copy-text-to-the-
system-clipboard-from-vim

S-ar putea să vă placă și