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

编程入门 行业动态 更新时间:2024-10-26 13:26:34
本文介绍了为什么我不能阻止 vim 包装我的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我无法阻止 vim 包装我的 Python 代码.如果我像冠军一样输入 :set nowrap,但它仍然会换行.

I can't stop vim from wrapping my Python code. If I enter :set nowrap like a champ, but it still wraps.

我可以按 J 来合并分割的代码行,所以看起来像是插入了真正的回车符.我只是不明白为什么或如何阻止它.

I can hit J to unite the split lines of code, so it seems like a real carriage return is being inserted. I just don't understand why or how to stop it.

推荐答案

'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}

如果您指的是自动换行将它们发送到下一行,请尝试

If you refer to auto wrapping of long lines sending them to the next one, try

:set textwidth=0 
:set wrapmargin=0

这篇关于为什么我不能阻止 vim 包装我的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-27 18:44:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1159812.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   vim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!