[plug] vim and programming languages
Russell Steicke
russells at plug.linux.org.au
Tue Sep 3 15:32:08 WST 2002
In my continuing quest to become as fluent with vim as with emacs, I
have another two questions...
Can I get vim to do automatic source code indenting?
I can do ":set autoindent" to have it indent a new line just like the
last one, but what I'm after is a way to make it search backwards a
way, and indent the new line in an intelligent way for the programming
language I'm working in. Which means that it should add a standard
indent after a left brace, and un-indent after a right brace etc.
And if that's possible:
Can vim read per-file settings?
At the bottom of all my .java files there exists something like this:
// This section is for emacs.
// Local variables: ***
// c-hanging-comment-ender-p:nil ***
// c-basic-offset:2 ***
// fill-column:95 ***
// indent-tabs-mode:nil ***
// End: ***
which customises the source code style per-file. I find this very
useful when working with different people who use different styles
(although they complain about those extra lines). Can vim do a
similar thing?
TIA
Russell
PS Yes, I've searched through the :help stuff and vim.org but can't
find the answers there. That doesn't mean they're not there, of
course.
More information about the plug
mailing list