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

如何在.vimrc文件中拆分长行?,vim,Vim,我的.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

我的
.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
给予

有人能告诉我怎么分割这条线吗


(如果有人能告诉我如何添加到
cinwords
,而不是完全重置它,那么就可以获得额外的积分;我唯一想做的就是添加带有
关键字的

点击
:帮助行继续

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

因此,与其写作

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

关闭的副本。@CodeGnome:未搜索换行,因为我认为这意味着其他内容,但您是对的。如果您正在执行某些特定于文件类型的操作,则应使用
:setlocal
,而不是
:set
。您发布的命令将
with
添加到“cinwords”中,并在每个后续缓冲区中设置“smartindent”,而不仅仅是python,除非该缓冲区文件类型插件覆盖它。是的,为了使您的问题对其他人有所帮助,这应该是可以接受的答案。@shime我们也可以使用\as在
if\elif…
中分隔
cinwords=if…
行吗?
autocmd FileType python set smartindent
       \ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd FileType python set smartindent
    \ cinwords+=with