Archive
Archive for October, 2009

Run as root:
Enjoy

- <Ctrl>-k + e + ! – Write ‘è’ character.
- <Ctrl>-k + e + ‘ – Write ‘é’ character.
- !!date – Insert date in current line.
- g, / g; – Jump back/forward to the locations that have been edited.
- zf – Fold selected text.
- zfa} – Fold the function enclosing the cursor.
- zR / zM – If foldmethod is set, open/close all folds.
- <Ctrl>-w + (-/+) – In splitted views, reduce/increase current zone height.
- <Ctrl>-w + (</>) – In splitted views, reduce/increase current zone width.
- :vimgrep /pattern/ files – Search for pattern in the provided list of files.
- :cn and :cN to jump between vimgrep results.
- :clist to display all vimgrep result and :cc number to jump to a specific one.
- :%s/\<and\>/or/g – Replace all occurences of “and” with “or”, leaving words like “demand” unchanged.
- :%s/foo/bar/gi – Replace case insensitively.
- * / # – Search for the next/previous occurence of the word under the cursor.
- /\cfoo\Cbar/ – Matches “foobar”, “Foobar” and “FOObar”.
- /\([a-z]\)\([a-z]\)\2\1/ – Matches “abba” and “deed”.

- <Ctrl>-o – Switch from insert mode to command mode for one single command.
- vim +linenumber file – Open file at line number.
- vim +/pattern file – Open file at first occurence of pattern.
- :next files – Open a list of files, each in a new buffer.
- :up[date] - Save a modified file.
- “byy + “bp – Copy a line inside named buffer “b” and paste it.
- <Ctrl>-] – Follow green links in documentation pages.
- <Ctrl>-t – Go back to the previous documentation page.
- >ap – Indent whole paragraph.
- 10dd + 2. – Delete 10 lines, repeat twice (delete 20 lines more).
- VU – Make the whole line uppercase.
- V10j + : + !sort – sort alphabetically next 10 lines.
- :!uname -a – Display system information.
- :! wc % – Display information about current file.
- :r!uname -a – Insert system information into the next line.
- gg=G – Reformat whole file.
- <Ctrl>-n – Start autocompletion.