繁体   English   中英

如何在.vimrc文件中拆分长行?

[英]How do I split long lines in a .vimrc file?

我的.vimrc中有一行超过80个字符:

autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with

我觉得这很烦人,所以我想把它分成多行,但我不知道怎么做。 我试过\\因为它在Python和Bourne shell中做了诀窍,但显然在Vim中这不是有效的语法:

autocmd FileType python set smartindent \
    cinwords=if,elif,else,for,while,try,except,finally,def,class,with

E492: Not an editor command

谁能告诉我如何分割这条线?

(如果有人可以告诉我如何添加到cinwords而不是完全重置它,那么奖励点;我唯一想要实现的就是添加with关键字。)

命中:help line-continuation

基本上你必须在续行的开头添加\\

所以不要写作

autocmd FileType python set smartindent \
    cinwords=if,elif,else,for,while,try,except,finally,def,class,with

你必须写

autocmd FileType python set smartindent
       \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd FileType python set smartindent
    \ cinwords+=with

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM