0% found this document useful (0 votes)
172 views2 pages

Vim Cheat Sheet

This document is a Vim cheat sheet that provides basic commands for navigating and editing text in Vim. It outlines commands for inserting and deleting text, copying and pasting, searching and replacing text, and saving and quitting files. Movement basics include keys to move the cursor left, down, up, right, to the beginning or end of lines, words, and files.

Uploaded by

rafae.haak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views2 pages

Vim Cheat Sheet

This document is a Vim cheat sheet that provides basic commands for navigating and editing text in Vim. It outlines commands for inserting and deleting text, copying and pasting, searching and replacing text, and saving and quitting files. Movement basics include keys to move the cursor left, down, up, right, to the beginning or end of lines, words, and files.

Uploaded by

rafae.haak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like