If you want Vim's Lisp mode to treat all forms as function calls, so that items of a multi-line expression align with the second element, then simply clear the lispwords
parameter:
:set lispwords=
From your exmaple, you do seem to want a split define
to be treated with indentation rather than alignment. Figure out the set of forms for which you want indenting rather than aligning behavior and put that exact set into your lispwords
:
:set lispwords=define[,... whatever other symbols]
This can be done based on file type with an auto-loaded. In your .vimrc
file you can have:
:au BufRead,BufNewFile *.scm set lispwords=define
After putting that in my .vimrc
temporarily, if I edit a new file:
$ vim foo.scm
and then insert a few lines, they get automatically formatted like thisL
(define fun ()
(if foo
(then ...)
(else ...)
~
~
~
:q!
I just hit Enter there; the auto-indentation kicked in. Vim's config already associates .scm
files with Scheme and sets up Lisp mode. Our au
command customizes that by overriding lispwords
.