Favorite Vim Tips
Posted on July 30th, 2010 in Vim | No Comments »
Quickly Indent Blocks Of Code

- Make sure you have :set cindent
- Put your cursor on an opening { or closing }
- Press =%
- All the code in the block is nicely indented
Searching Through Projects With vimgrep
Search through all the PHP files in a project.
1. Make sure you are at the root of your project in vim (type :pwd to see) if you are in the wrong dir then type :cd /path/to/project
2. :vimgrep pattern **/*.php
Examples:
Find the pattern “findMe” and don’t jump to the first match. Use the j flag to prevent jumping to the first match
:vimgrep /findMe/j **/*.php
Find the pattern “findMe” but match on case as well (case-sensitive)
:vimgrep findMe\C **/*.php
Find the pattern “findMe” without regard to case (case-insensitive)
:vimgrep findMe\c **/*.php
Organize With Pathogen
This is the best plugin ever for keeping your other vim plugins neat and
organized. Gone are the days of shotgunning doc and plugin files in multiple
directories. Now a plugin and all its related files can stay together.
Go here to get pathogen from vim.org
