Search this site


Metadata

Articles

Projects

Presentations

vim - indenting

So rather than start writing my own indent function, I decided to read more about cindent. The option, cinoptions, lets you tell vim how to react to things. What I was looking for was:
When I am typing a function call, and break the line because it's too long, I'd like the new line to start aligned with the open parenthesis, like this:

System.out.println("Hello there, how are you? kthx." + 
                   "Java is fun");
		   ^

I want vim to automatically indent to the column position marked by the caret, ^ - Turns out vim has this functionality already (duh, it has almost evrything).

:set cinoptions=(0

This, when cindent is enabled, will cause vim to auto indent to match your parentheses usage.