vim:显示列表字符会更改屏幕环绕
我注意到,当我在文本中显示 EOL 列表字符时,换行符会丢失
。
this is my text of this
message
在设置列表后变为 ..eol
this is my text of this mess
age(EOL CHAR)
我希望看到 EOL 字符而不破坏窗口边框处的单词。 这可能吗?
I noted that when I show up the EOL listchars in a text the linebreaks are losen
p.e.
this is my text of this
message
becomes after set list ..eol
this is my text of this mess
age(EOL CHAR)
I would like to see the EOL characters without breaking the words at window border.
Is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,这听起来像是 Vim 的记录限制。来自 linebreak 的文档(导致每个字换行而不是每个字符的选项):
替代解决方案:突出显示行尾。简单的一次性方法就是搜索它们 (/$)。除此之外,您还可以使用突出显示:
这将为您的 EOL 提供绿色背景。有关如何指定突出显示的更多信息,请参阅
:helphighlight-args
。原始答案
这不是OP的实际问题,但有时可能会发生,所以我将其留在这里供其他人搜索时找到。
来自
'list'
的帮助:来自
'cpoptions'
的帮助:'cpoptions'
与 vi 兼容性有关 - 您是否将vim
作为vi
启动?或者你是手动设置任何这些标志?检查
echo &cpoptions
的输出,确保以vim
启动,如果它仍然设置(不知道为什么会这样),您可以取消设置该标志 (<代码>设置 cpoptions-=L)。当然,请确保
wrap
、wrapmargin
、linebreak
和textwidth
的设置是您想要的。Unfortunately it sounds like this is a documented limitation of Vim. From the documentation of linebreak (the option which causes per-word line breaks instead of per-character):
Alternate solution: highlight end-of-lines. The simple one-time way would be to just search for them (/$). Beyond that, you can use highlighting:
That'll give your EOLs green backgrounds. See
:help highlight-args
for more on how you can specify the highlight.Original answer
This is not the OP's actual problem, but could sometimes happen, so I'll leave it here for others to find when they search.
From the help on
'list'
:From the help on
'cpoptions'
:'cpoptions'
is all about vi-compatibility - are you launchingvim
asvi
? Or are youmanually setting any of those flags? Check the output of
echo &cpoptions
, be sure to launch asvim
, and if it's still set (no idea why it would be) you can unset the flag (set cpoptions-=L
).And of course, make sure that the settings for
wrap
,wrapmargin
,linebreak
, andtextwidth
are what you want.