长线水平导航
我该如何执行以下操作:
- 更快地向右移动,例如
zw
(类似于zl
但跳转到单词) - 仅移动光标所在的一长行。文件的其余部分将保留在其位置,
我有 .vimrc
设置 set nowrap
。这是因为代码看起来比换行更好。但水平导航存在问题。
我注意到 zl
(不要将 l (L) 与 1 混淆)快捷方式向右移动(zh
向左移动)。
How can I do the following:
- 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
I have .vimrc
settings set nowrap
. That's because the code looks nicer than wrapped lines. But there is a problem with horizontal navigation.
I noticed that zl
(don't confuse l (L) with 1) shortcut which shifts to the right (zh
to the left).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您是否尝试过
:help roll-horizontal
?您可以使用映射来滚动,例如向左或向右滚动 20 个字符:
在不应用映射的情况下,您可以使用
zL
将视图向右移动半个屏幕宽度,然后zH
向左执行。关于你问题的第二部分:我认为这是不可能的。您可以拉出整行,将其粘贴到第二个(临时)缓冲区中并滚动到那里。只要你只是阅读台词,这就会起作用。一旦你想改变什么,问题就会出现。但实在是太麻烦了...
Did you try
:help scroll-horizontal
?You could use a mapping to scroll, for example, 20 characters to the left or to the right:
Without applying a mapping, you could use
zL
to move the view a half screenwidth to the right andzH
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...
添加到其他答案还要注意
ze
和zs
,意思是:将屏幕移动到下面光标的左/右我粘贴我的助记词进行滚动
还要查看键盘上
h
和l
(以及t
和b
)的位置,以记住屏幕在移动adding to other answers also pay attention to
ze
andzs
, meaning: move screen to the left/right of the cursorbelow I paste my mnemonic for scrolling
also look at the position of
h
andl
(andt
andb
) on the keyboard to remember where the screen is moving使用 Shift + 滚动键可以更快地浏览文本
Use shift + scrolling keys to move faster through text
对于问题的第一部分,如评论中所示,
zL
和zH
是完美的,所以我将在此处添加它。For the first part of your question, as in the comments,
zL
andzH
are perfect, so I'll add this here.为了更舒适的滚动,类似于插入模式下 ctrl-x,ctrl-e 或 ctrl-x,ctrl-y 触发的滚动模式,这是我在 vimrc 中添加的内容:
这样,您可以平滑滚动(使用h 或 l)或在您方便时快速(使用 H 或 L),而无需每次都按 z。您只需按一次 z 即可触发“水平滚动模式”,一旦您按任何其他键,该模式就会停止。
For a more comfortable scrolling, similar to the scrolling mode triggered by ctrl-x,ctrl-e or ctrl-x,ctrl-y in insert mode, here is what I added in my vimrc:
This way, you can scroll smoothly (with h or l) or rapidly (with H or L) at your convenience without pressing z again and again each time. You just press z once in order to trigger the "horizontal scrolling mode", which stop as soon as you press any other key.
使用
w
向前滚动,使用b
向后滚动。这可能是最简单的方法。Use
w
to scroll forward andb
to scroll backward. This is probably the easiest way.