简体   繁体   中英

How to wrap long lines in .vimrc?

I've setup a colorcolumn=80 , but I found I can not wrap long lines in ~/.vimrc.

Is there any method like C's \\ to concatenate?

For example I tried this, but it does not work.

autocmd FileType python setlocal ai si et sta sw=4 \
textwidth=80 backspace=indent,eol,start fo=croql

Lines in the .vimrc file can be wrapped by putting the escaping \\ at the beginning of the continuation line:

autocmd FileType python
    \ setlocal ai si et sta sw=4
    \ textwidth=80 backspace=indent,eol,start fo=croql

See :h line-continuation

This does not appear to work in the middle of a set statement.

set cinoptions=>1s,e0,n0,f0,{0,}0,^0,L0,:0,=0,l1,b0,g0,h0,N0,p0,t0,i1s,+0,
   \ c1s,C0,/0,(1s,u1s,U1,w1,W1s,k0,m1,M0,j1,J1,)100,*100,#0

yields:

Error detected while processing /home/jefbed/.vimrc:
line   18:
E518: Unknown option: c1s,C0,/0,(1s,u1s,U1,w1,W1s,k0,m1,M0,j1,J1,)100,*100,#0
Press ENTER or type command to continue
dell:/home/jefbed/j$ vim
Error detected while processing /home/jefbed/.vimrc:
line   18:
E488: Trailing characters:     c1s,C0,/0,(1s,u1s,U1,w1,W1s,k0,m1,M0,j1,J1,)100,*100,#0
Press ENTER or type command to continue

Instead, in the case of set statements, one should use a += operator:

set cinoptions=>1s,e0,n0,f0,{0,}0,^0,L0,:0,=0,l1,b0,g0,h0,N0,p0,t0,i1s,+0,
set cinoptions+=c1s,C0,/0,(1s,u1s,U1,w1,W1s,k0,m1,M0,j1,J1,)100,*100,#0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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