让 gvim 将换行视为新行

发布于 2024-08-12 17:52:05 字数 245 浏览 3 评论 0原文

当我在 vim/gvim 中按“j”或向下箭头时,光标移动到下一行。这有利于编写代码。

然而,在书写文本时,行通常比文本长得多。因此我不能轻易地得到这个词上面的词。因此,在几乎所有编辑器和文本处理器中,按向上箭头 HERE ↑ 会将光标置于“word”前面。但在 gvim 中,光标移动到“code”之间的空行。和“何时”。

我使用换行(设置:wrap)和换行(设置:lbr)。

凭借 vim 的所有功能 - 这必须是直接的吗?

When I press "j" or arrow down in vim/gvim the cursor moves to the next line. which is good for writing code.

When writing text however the lines are usually much longer then the text with. Therefore I can not easily get the word just above THIS word. So in almost all editors and text processors pressing the up arrow HERE ↑ would put the cursor in front of "word". But in gvim the cursor moves to the blank line between "code." and "When".

I use wrap (set: wrap) and linebreak (set: lbr).

With all the power of vim - this has to be straight forward?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦屿孤独相伴 2024-08-19 17:52:05

gkgj 通过视觉行而不是文本行上下移动。您可以使用 jk 映射到这些。

noremap j gj
noremap k gk

有些人喜欢只为特定文件类型设置这些映射,在这种情况下,您需要类似的东西

au FileType html,tex noremap <buffer> j gj
au FileType html,tex noremap <buffer> k gk

gk and gj move up/down by visual line instead of text line. You could map j and k to these using

noremap j gj
noremap k gk

Some people prefer to only setup those maps for specific filetypes, in which case you'd want something like

au FileType html,tex noremap <buffer> j gj
au FileType html,tex noremap <buffer> k gk
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文