Showing posts with label indent. Show all posts
Showing posts with label indent. Show all posts

Wednesday, December 2, 2009

Indent From Normal Mode

From normal mode, pressing == will indent the current line.

Monday, November 23, 2009

Indent From Insert

In the comments of my last post, graywh left a great tip that I didn't know about. If you're working in insert mode, you can change the indent level of the current line using <C-t> and <C-d>. These commands work no matter where your cursor is positioned on the current line and adjust the indent level based on your shiftwidth setting.

Wednesday, December 19, 2007

Indent

This is useful for a quick and dirty indent. It works on a variety of file formats, but I typically use it on HTML or XML.

1) open a file
2) issue a :filetype command to see if indenting is ON
3) if it's not, turn it on by doing a :filetype indent on
4) filter the entire file through the program specified by "equalprg" (default is none)
by doing gg=G (no ex mode here).
5) you can set equalprg accordingly if you want to use a 3rd party program:

:setlocal equalprg=tidy\ -quiet\ -m\ -utf8\ %

or if you want to use make rather than equalprg

:setlocal makeprg=tidy\ -quiet\ -errors\ %

then just issue a :make.