长行水平导航 [英] Horizontal navigation in long lines
问题描述
如何执行以下操作:
- 向右移动得更快,类似于
zw
(类似于zl
,但会跳动单词) - 仅移动光标所在的长行.文件的其余部分将保持在原来的位置
- shift faster to the right, something like
zw
(analogy tozl
but jump on words) - shift only the one long line where is the cursor. The rest of the file will remain in its position
我有.vimrc
设置set nowrap
.那是因为代码看起来比换行更好.但是水平导航存在问题.
I have .vimrc
settings set nowrap
. That's because the code looks nicer than wrapped lines. But there is a problem with horizontal navigation.
我注意到zl
(不要将l(L)与1混淆)快捷方式向右移动(向左zh
).
I noticed that zl
(don't confuse l (L) with 1) shortcut which shifts to the right (zh
to the left).
推荐答案
您尝试 :help scroll-horizontal
?
您可以使用映射来滚动,例如向左或向右滚动20个字符:
You could use a mapping to scroll, for example, 20 characters to the left or to the right:
map <C-L> 20zl " Scroll 20 characters to the right
map <C-H> 20zh " Scroll 20 characters to the left
如果不应用映射,则可以使用zL
将视图向右移动半个屏幕宽度,并使用zH
将视图向左移动半个屏幕.
Without applying a mapping, you could use zL
to move the view a half screenwidth to the right and zH
to do it to the left.
关于您问题的第二部分:我认为这是不可能的.您可以拉整整行,将其粘贴到第二个(临时)缓冲区中并在其中滚动.只要您正在阅读台词,这就可以工作.您想要更改某些内容时,就会出现问题.但这很麻烦...
Regarding the second part of your question: I don't think that this is possible. You could yank the whole line, paste it into a second (scratch) buffer and scroll there. This would work as long as you're just reading the lines. Problems will arise as soon as you want to change something. But it's quite cumbersome...
这篇关于长行水平导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!