Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wrap long lines in .vimrc?

Tags:

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 
like image 503
Daniel YC Lin Avatar asked Nov 04 '11 07:11

Daniel YC Lin


People also ask

How do you wrap lines in Vim?

If you want to wrap lines in a specific area, move the cursor to the text you want to format and type gq followed by the range. For example, gqq wraps the current line and gqip wraps the current paragraph.

How do I turn on word wrap in Vim?

Command to toggle word wrap in Vim While :set wrap will turn on word wrap in Vim and :set nowrap will turn off word wrapping, you can also use both commands with the ! (bang) symbol to toggle word wrap. So using either: :set wrap!

How do I unwrap a line in Vim?

It is better to use the :normal command with ! -specifier in this case to avoid clashes with custom mappings. – ib.


1 Answers

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

like image 123
John Weldon Avatar answered Oct 20 '22 18:10

John Weldon