如何在 Vim 中不移动光标的情况下移动屏幕? [英] How to move screen without moving cursor in Vim?
本文介绍了如何在 Vim 中不移动光标的情况下移动屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近发现了 Vim 的 Ctrl+E 和 Ctrl+Y 快捷键分别向上移动屏幕然后向下一行,不移动光标.
I recently discovered Ctrl+E and Ctrl+Y shortcuts for Vim that respectively move the screen up and down with a one line step, without moving the cursor.
您是否知道任何将光标留在原处但移动屏幕以使光标所在的行成为第一行的命令?(有最后一行的命令将是一个不错的奖励).
Do you know any command that leaves the cursor where it is but moves the screen so that the line which has the cursor becomes the first line? (having a command for the last line would be a nice bonus).
我可以通过手动按Ctrl+E(或Ctrl+Y)正确的数字来实现有时,但有一个以某种方式直接执行此操作的命令会很好.
I can achieve this by manually pressing Ctrl+E (or Ctrl+Y) the proper number of times, but having a command that somehow does this directly would be nice.
有什么想法吗?
推荐答案
- zz - 将当前行移动到中间屏幕
(小心 zz,如果您碰巧不小心打开了 Caps Lock,您将保存并退出vim
!) - zt - 移动当前行到屏幕顶部
- zb - 移动当前行到底部屏幕
- zz - move current line to the middle
of the screen
(Careful with zz, if you happen to have Caps Lock on accidentally, you will save and exitvim
!) - zt - move current line to the top of the screen
- zb - move current line to the bottom of the screen
这篇关于如何在 Vim 中不移动光标的情况下移动屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文