如何在 Vim 中恢复滚动、选择或 PgUp/PgDn 之前的光标位置?
我已经厌倦了搜索我之前所在的位置,然后才向上滚动查看顶部的内容。
是否有类似“上一个光标位置”和“下一个光标位置”的命令(如用于常规撤消/重做的“u”和“R”)?
示例:查看源文件中间的某个位置(未编辑),然后跳转到顶部(1G
),然后无法找到之前的位置。当然,没有设置标记。(我知道我可以使用“:sp”同时查看多个位置)。
更新。问题仍然悬而未决,我收到了后续回复:
The answerers didn't understand your question and the answers were too weak of a solution. c-o & c-i don't work for movements.
If I understood correctly, I find that your question was un-answered and that you were looking for a solution for a scenario like this:
As I am vim beginner I frequently do incorrect movements and actions and would like to undo them as though I had never pressed anything, returning to my previous editing location before I started messing up.
那么,是否有任何标准或非标准(涉及 Vim 或 Vim 扩展的补丁)方法可以让它记住光标移动历史记录?
答案1
- Ctrlo返回跳转列表
- Ctrli在跳转列表中前进
此外,我会考虑通过设置标记,m'并在完成后通过滚动按压''。