Take the 2-minute tour ×

I'd like to autoindent a range of lines in a Vim plugin I'm writing, but there doesn't seem to be an easy way. Short of an actual vimscript command, I've been looking for ex-mode commands I could use to trigger autoindenting, but I haven't found a way there either.

Is there any way to trigger the autoindentation of a range of lines in Vim, besides hitting just hitting "="?

share|improve this question
why can't you use =? you could do normal! 3G=10G –  Kent May 9 '13 at 21:12
normal is what I was missing, didn't realize I could use it to execute normal mode commands in ex mode. If you write an answer instead of a comment I'll give it to you. Thanks! –  Michael May 9 '13 at 22:14

1 Answer 1

up vote 3 down vote accepted

why can't you use =? you could do

:normal! 3G=10G

to auto-indent 3,10 lines

share|improve this answer

Your Answer


