我知道必须有一些明显我缺少的东西,但我不能阻止vim包装我的python代码.我:set nowrap
像冠军一样进入,但它仍然包裹着.我可以点击:set nowrap
分割代码行,所以它似乎插入了真正的回车,我只是不明白为什么或如何阻止它.
'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, anwill 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
将重新打开自动包装.
为了防止vim包装长行我在我的下面使用这两行.vimrc
:
set nowrap " do not automatically wrap on load set formatoptions-=t " do not automatically wrap text when typing
要禁用换行,您可以输入
:set wrap!
或附加此命令~/.vimrc
.
也许它是设置的文本宽度,当达到一定长度时会自动断行
:set tw=0
如果失败则与例如玩
:set wrap linebreak textwidth=0
和
:set virtualedit=insert