Created
April 16, 2010 05:45
-
-
Save adeleinr/368073 to your computer and use it in GitHub Desktop.
Vim Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
general | |
/ Finds a word forwards | |
? Finds a word backwards | |
Shift + g Goes to end of file | |
Shift + m Goes to Middle of screen | |
Shift + h Goes to the Top of the screen | |
Shift + l Goes to Bottom of the screen | |
. Repeat last command | |
:f Displays line and file name | |
% If at one parenthesis, will jump to its mate | |
:!’cmd’ Will execute a command in the shell | |
:set number | |
:set nonumer | |
ma Create a marker in a line | |
:’a Go to the a marker | |
:tabnew filename Opens a new tab | |
:e filename Opens a new buffer | |
tabs | |
vim -p file1 file2 file3 Open several tabs at once | |
:set tabpagemax=15 Change default max number of tabs that can be opened (default is 10) | |
:tabf inven* if you want to open a file called inventory.txt that’s in your current path | |
:tabn or : tabp To change to the next or previous tab. | |
working with multiple files | |
:e filename - Edit a file in a new buffer | |
:bnext (or :bn) - go to next buffer | |
:bprev (of :bp) - go to previous buffer | |
:bd - delete a buffer (close a file) | |
:sp filename - Open a file in a new buffer and split window | |
ctrl+ws - Split windows | |
ctrl+ww - switch between windows | |
ctrl+wq - Quit a window | |
ctrl+wv - Split windows vertically | |
configuration | |
To place in your ~/.vimrc file | |
syntax on | |
set syn=cpp | |
set autoindent | |
set cindent | |
set nu | |
set expandtab | |
set sw=2 | |
set smarttab | |
set vb t_vb= | |
set nowritebackup | |
set nobackup | |
set tags=/vbs/engn/cscope/tags | |
set ts=2 | |
set is | |
set hls | |
set ru | |
map :bn | |
map :bp | |
colors morning | |
set ic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment