I've got a line in my .vimrc
that is more than 80 chars long:
autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
I find this rather annoying, so I want to break it into multiple lines, but I don't know how to do that. I tried \
since that does the trick in Python and the Bourne shell, but apparently that's not valid syntax in Vim:
autocmd FileType python set smartindent \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
gives
E492: Not an editor command
Can anyone tell me how to split this line?
(Bonus points if someone can tell me how to add to cinwords
instead of resetting it entirely; the only thing I wanted to achieve is add the with
keyword to it.)
Show activity on this post. then just press Ctrl-J whenever you want to split a line.
Opening vimrc Using file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes "Startup Settings" which will use $MYVIMRC to edit your vimrc file.
Sourcing it is the same as typing each command in order. You source with the command :source (usually shortened to :so ). The only file sourced by default is the . vimrc ( _vimrc on windows) so that's a place you can keep all the commands you use to set up Vim every time.
Hit :help line-continuation
.
Basically you have to add \
at the beginning of the continued line.
So instead of writing
autocmd FileType python set smartindent \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
you have to write
autocmd FileType python set smartindent \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With