首页 > 解决方案 > VIM中'wordwrap'设置中的'Cursorline'

问题描述

我正在使用 VIM 编写一些文档,但我不喜欢创建自己的换行符。相反,我只使用 ":set nowrap&" & "set lbr"。我还激活了“设置光标线”。

问题是光标线会在整个文本块而不是我正在处理的行下划线。

有没有办法让 cursorline 假装我的软包装线只是常规线?

标签: vimneovim

解决方案


来自:h cursorlinopt

'cursorlineopt' 'culopt' string (default: "number,line")
          local to window
          {not available when compiled without the +syntax
          feature}
  Comma separated list of settings for how 'cursorline' is displayed.
  Valid values:
  "line"      Highlight the text line of the cursor with
          CursorLine hl-CursorLine.
  "screenline"    Highlight only the screen line of the cursor with
          CursorLine hl-CursorLine.
  "number"    Highlight the line number of the cursor with
          CursorLineNr hl-CursorLineNr.

你可以用它set cursorlineopt=number,screenline来完成你想要的。


推荐阅读