为什么我不能阻止vim包装我的代码?

我知道必须有一些显而易见的东西,但是我无法阻止vim包装我的python代码。 我进入:set nowrap像冠军,但它仍然包裹。 我可以打J去联合代码的分割线,所以看起来像是一个真正的回车插入,我只是不明白为什么或如何停止它。

 'textwidth' 'tw' number (default 0) local to buffer {not in Vi} Maximum width of text that is being inserted. A longer line will be broken after white space to get this width. A zero value disables this. 'textwidth' is set to 0 when the 'paste' option is set. When 'textwidth' is zero, 'wrapmargin' may be used. See also 'formatoptions' and |ins-textwidth|. When 'formatexpr' is set it will be used to break the line. NOTE: This option is set to 0 when 'compatible' is set. 'wrapmargin' 'wm' number (default 0) local to buffer Number of characters from the right window border where wrapping starts. When typing text beyond this limit, an <EOL> will be inserted and inserting continues on the next line. Options that add a margin, such as 'number' and 'foldcolumn', cause the text width to be further reduced. This is Vi compatible. When 'textwidth' is non-zero, this option is not used. See also 'formatoptions' and |ins-textwidth|. {Vi: works differently and less usefully} 

如果你引用长行自动换行发送给下一个,请尝试

 :set textwidth=0 :set wrapmargin=0 

没有其他答案为我工作(IDK为什么)。

:set wrap! 对我来说(使用GVim for Windows)有诀窍。

set formatoptions-=t应该做的伎俩。 set formatoptions+=t将打开自动换行。

也许这是设置的textwidth,当它达到一定的长度时会自动断行尝试

 :set tw=0 

如果失败了,比如说

 :set wrap linebreak textwidth=0 

 :set virtualedit=insert 

要禁用换行,可以input:set wrap! 或者将这个命令附加到~/.vimrc

为防止vim缠绕长行,我在.vimrc使用这两行:

 set nowrap " do not automatically wrap on load set formatoptions-=t " do not automatically wrap text when typing 

Vim可能必须处于vi兼容模式 。

打开vimrc_example.vim(是的,这是Vim74中的文件)并设置textwidth = 0。