[ProgSoc] Indenting with vim

Nicholas FitzRoy-Dale wzdd at progsoc.org
Sat Nov 14 23:22:12 EST 2009


On 14/11/2009, at 10:32 AM, John Elliot wrote:

> 
> In most sophisticated text editors I can highlight an area of text and 
> press the Tab key to indent the section per the text editors tab 
> settings (e.g. pad with two spaces).
> 
> I'm wondering if anyone knows how to do something similar in vim?

Other people have mentioned > and <, but it's also useful to highlight a section (V, then j or k) and press = to auto-indent. To get back the highlight you just lost, type 'gv'.

You can also position the cursor over a brace, then press '=%' to auto-indent to the matching brace, as a short cut (does the equivalent of 'v%=')

Nicholas




More information about the Progsoc mailing list