Another 17 Vim Tips

Posted by Arkham on October 6th, 2009

success_vim

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

This entry was posted on Tuesday, October 6th, 2009 at 23:44 and is filed under computers. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Tags: , , , ,

Comments are closed.