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

4 comments:

  1. Great blog! All posts have something to learn. Your work is very good and i appreciate you and hoping for some more informative posts. thanks

    www.n8fan.net

    ReplyDelete
  2. I like your post a lot! You should write some more on this!Great job coming with such terrific post!


    alchemist
    www.inspgift.com

    ReplyDelete
  3. ?I was more than happy to find this web-site.I needed to thanks for your time for this excellent learn!! I undoubtedly having fun with every little bit of it and I've you bookmarked to check out new stuff you blog post. casino blackjack

    ReplyDelete