Vim which stands for Vi Improved is a text editor program for Unix authored by Bram Moolenaar.
Command | Description |
---|---|
/findme |
Search for the word "findme" |
n |
Move to the next occurrence of the word "findme" |
:s/search/replace/g |
Replace the word "search" with "replace" globally on the current line |
:%s/search/replace/g |
Replace the word "search" with "replace" globally on all lines |
Command | Description |
---|---|
h |
Move one character left |
j |
Move one character down |
k |
Move one character up |
l |
Move one character right |
0 |
Move to the beginning of the current line |
$ |
Move to the end of the current line |
Command | Description |
---|---|
i |
Insert at the current character |
I |
Insert at the beginning of the current line |
o |
Insert a new line following the current line |
O |
Insert a new line before the current line |
Command | Description |
---|---|
x |
Delete the current character (under the cursor) |
u |
Undo deletion |
dd |
Delete the current line |
10dd |
Delete 10 lines |
dw |
Delete from the current cursor to the end of the word |
d5w |
Delete 5 words |
Command | Description |
---|---|
yy |
Yank (copy) the current line |
5yy |
Yank (copy) 5 lines |
p |
Paste to the right |
P |
Paste to the left |
" put this in your .vimrc file and make your life easier
set tabstop=2 " number of visual spaces per TAB
set softtabstop=2 " number of spaces in tab when editing
set expandtab " tabs are spaces
set number " always show line numbers
set showcmd " show command in bottom bar right
" filetype indent on " load filetype spefific indent files
set showmatch " highlight matching [{()}]
set ruler " show file stats / show the cursor position all the time
set visualbell " blink cursor on error instead of beeping
syntax on " turn on syntax highlighting
set showmode " show current mode down the bottom
set mouse=a " enable mouse in all modes
References: D. B. (2002, May 28). Vi/vim notes. Retrieved from http://www.brezeale.com/technical_notes/vim_notes.shtml (n.d.). Retrieved from http://www.rayninfo.co.uk/vimtips.html