我知道必须有一些明显我缺少的东西,但我不能阻止vim包装我的python代码.我:set nowrap像冠军一样进入,但它仍然包裹着.我可以点击:set nowrap分割代码行,所以它似乎插入了真正的回车,我只是不明白为什么或如何阻止它.
Ste*_*ini 110
'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}
Run Code Online (Sandbox Code Playgroud)
如果您将长线自动换行发送到下一行,请尝试
:set textwidth=0
:set wrapmargin=0
Run Code Online (Sandbox Code Playgroud)
Kno*_*kei 75
没有其他答案对我有用(IDK为什么).
:set wrap! 为我做了诀窍(使用GVim for Windows).
Eng*_*ero 48
set formatoptions-=t应该做的伎俩.set formatoptions+=t将重新打开自动包装.
gon*_*332 12
为了防止vim包装长行我在我的下面使用这两行.vimrc:
set nowrap " do not automatically wrap on load
set formatoptions-=t " do not automatically wrap text when typing
Run Code Online (Sandbox Code Playgroud)
也许它是设置的文本宽度,当达到一定长度时会自动断行
:set tw=0
Run Code Online (Sandbox Code Playgroud)
如果失败则与例如玩
:set wrap linebreak textwidth=0
Run Code Online (Sandbox Code Playgroud)
和
:set virtualedit=insert
Run Code Online (Sandbox Code Playgroud)