我喜欢长线显示在多个终端线;我不喜欢vim插入换行到我的实际文本。我应该修改。vimrc的哪一部分?
当前回答
set formatoptions-=t保持视觉文本宽度,但不会在插入模式中添加新行。
其他回答
我个人认为:
包装, 设置linebreak 设置breakindent 设置showbreak =ͱ。
这里做一些解释:
wrap option visually wraps line instead of having to scroll horizontally linebreak is for wrapping long lines at a specific character instead of just anywhere when the line happens to be too long, like in the middle of a word. By default, it breaks on whitespace (word separator), but you can configure it with breakat. It also does NOT insert EOL in the file as the OP wanted. breakat is the character where it will visually break the line. No need to modify it if you want to break at whitespace between two words. breakindent enables to visually indent the line when it breaks. showbreak enables to set the character which indicates this break.
参见:h <关键字>在vim中获得更多信息。
注意,如果您采用这种方法,则不需要修改textwidth和wrapmargin。
你可能会发现设置换行符很有用;在设置换行时,换行只是在空白处而不是在单词中间。
e.g.
without linebreak the li
ne can be split on
a word
and
with linebreak on the
line will be
split on
whitespace only
我喜欢在多个终端行上显示长行
这种可视/虚拟行换行是由wrap window选项启用的:
:set wrap
默认情况下,这将在窗口中不适合的第一个字符处换行。这意味着如果窗口边界位于单词的中间,它将自动换行。要将其更改为按单词边界换行,您还可以:
:set linebreak
这将导致换行只对换行符设置中的字符进行换行,该设置默认为空格、制表符和一小组标点符号。
:set breatat
breakat= ^I!@*-+;:,./?
我不喜欢vim插入换行到我的实际文本。
要关闭物理行换行,请清除textwidth和wrapmargin缓冲区选项:
:set textwidth=0 wrapmargin=0
我不确定我完全理解,但你可能正在寻找'formatoptions'配置设置。试着这样做:set formatoptions-=t。t选项将插入换行符,使文本按textwidth设置的宽度换行。你也可以把这个命令放在你的.vimrc中,只是去掉冒号(:)。
:设置tw = 0
VIM不会自动插入换行符,但会保持换行。
推荐文章
- 如何在Vim注释掉一个Python代码块
- 如何在可视块模式插入?
- 强迫自己掌握vi的最好方法是什么?
- 如何回到行之前编辑的最后一个在Vim?
- 如何跳转到一个特定的人物在vim?
- 如何删除一个大的文本块而不计算行?
- 在Vim/Vi中,如何将光标移动到前一个单词的末尾?
- 如何在vim中自动删除尾随空格
- 为什么Vim使用~扩展名保存文件?
- 如何在Vim或Linux中将空格转换为制表符?
- 我如何使用vimdiff来解决git合并冲突?
- 在Vim中删除当前缓冲区的文件名/路径
- Git在终端提交时打开VIM,但无法返回终端
- 请参阅编辑器中的换行符和回车
- 如何在NERDTree中显示隐藏文件(以句点开始)?