When defining or calling functions with enough arguments to span multiple lines, I want vim to line them up. For example,
def myfunction(arg1, arg2, arg, ...
argsN-1, argN)
The idea is for argsN-1 to have its 'a' lined up with args1.
Does anyone have a way to have this happen automatically in vim? I've seen the align plugin for lining equal signs (in assignment statements) and such, but I'm not sure if it can be made to solve this problem?
you might get some good mileage out of using a language-specific external tool as a Vim filter. for example, if you can write a Perltidy config file to generate the formatting you want (it looks like you would want the -lp -vtc=2 flags), you can then pipe your existing Vim buffer through it with
if you're going to be running this sort of command frequently, you can define an command by putting something like the following in your .vimrc:
I believe you have to issue the command:
This is when using cindent of course.
edit: I missed "set"
The previous poster had it, but forgot the
set
From
:help cinoptions-values
Try the Align http://www.vim.org/scripts/script.php?script_id=294 and AutoAlign http://www.vim.org/scripts/script.php?script_id=884 scripts.