Monday, September 7, 2009

VIM Modeline is your friend

Abstract: Add modeline to a file can help VIM remember file-specific options.

I've got to port some application to another arch these days, so I have to deal with a lot of files that does not follow my usual coding standards, and I don't want to edit my VIM settings now and then, so I turned to modeline for help.

To add modeline to all the files, I simply did a find & echo like this:

for f in `find . -name '*.cpp' -o -name '*.h' -print0| xargs -0i echo {}`;do echo -e "\n/* vim: set ts=2: */" >> $f;done

0 comments:

Post a Comment