开发者

Vim splits long string into several ones

开发者 https://www.devze.com 2023-01-26 16:32 出处:网络
Whenever i\'ve tried to type开发者_高级运维 something like : void InsertVertices(const std::vector<Vertex> &vertices);

Whenever i've tried to type开发者_高级运维 something like :

void InsertVertices(const std::vector<Vertex> &vertices); 

Vim automatically converts it to:

void
  InsertVertices(const
    std::vector<Vertex>
    &vertices); 

and here is my vimrc:

set wrapmargin=80
set wrap
" for google codestyle
syntax on 
set shiftwidth=2
"set wrap 
set tabstop=2
set softtabstop=2

What should i to to prevent this autoformatting?

set textwidth=80 work for me, thank you for you time!


As far as I know textwidth must be 0 for wrapmargin to take effect. Maybe you could try explicitly setting your textwidth:

set textwidth=0

Or use textwidth instead:

set textwidth=80


You should examine these options to see if they're contributing to the wrapping behaviour that you describe:

set textwidth=0
set wrapmargin=0

If either textwidth or wrapmargin are not zero, they can cause text to wrap to the next line.

set formatoptions

One of the options set by formatoptions may also be having an affect on your wrapping. For reference, my options are set to tcq in a new, blank Vim document. (I haven't modified these options from their defaults.) formatoptions appears to change with filetype, therefore you should examine its value:

set filetype

You may also want to disable the wrap option, just to make sure:

set nowrap
0

精彩评论

暂无评论...
验证码 换一张
取 消