gpt4 book ai didi

vim - 为什么我无法阻止 vim 包装我的代码?

转载 作者:行者123 更新时间:2023-12-03 04:48:18 26 4
gpt4 key购买 nike

我无法阻止 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

关于vim - 为什么我无法阻止 vim 包装我的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1290285/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com