Vi improved
I use VIM for almost all text editing ranging from development, report writing to editing of configuration files.
I'll show how to do search and replace, using multiple windows etc.
.vimrc - Vim config file
"" proper title bar set title "" tab setup set expandtab set tabstop=4 set shiftwidth=4 "" C-style indenting set cindent "" allow us to backspace before an insert ""set backspace=2 "" Nicer status bar set ls=2 set ruler let mysyntaxfile = "~/.vimrc-highlight" syntax on "" Map keys "" Delete current line without copying to clipboard and the remove hlsearch map øø :s/.//g:nohlsearch map ææ :nohlsearch "" Abbreviations ab Sop System.out.println
Copy/Cut/Paste text
To copy or cut paste you first need to select it which is done using the VISUAL mode. Hit escape and then v and select the text you want to copy/cut.
Copy
After having selected some text hit "y", which will copy the selected text to the buffer.
Cut
If you want to move the selected text to another location you can cut it instead of copying it. hit "x" and the text is moved to the buffer.
Paste
When you have copied or cut some text to the buffer, you can paste it using "p" or "P".
Search for text
In command mode you can press / and enter the search string.
Search strings can be entered as a regular expression e.g. /<td[^>] if we would like to search for td tags with extra options.
Search and replace
Search and replacing text in VIM is done using regular expressions.
:s/search/replace/
Indent whole buffer
If you have copied a piece of code from some where, it proberly is not indented correctly in the current context. To re-indent the complete buffer use the command below
g g V G =
g g: go to start of buffer
V: switch to virtual line mode
G =: indent selection
Bracket matching
:set showmatch
this will enable displaying which brachets, {}, () and [] match when you close one.
To jump between two matching brackets press
shift+5 (%)