在 Vim 中点击 gg 后如何回到之前的状态?

发布于 2024-10-10 23:28:19 字数 103 浏览 0 评论 0原文

例如,假设我正在 Vim 中愉快地编辑文档,这时我不小心按了 gg。然后我最终到达文档的第一行,当然我不知道我上次编辑的确切行是哪一行。有什么方法可以神奇地回到 gg 跳转之前最后编辑的行吗?

For example, let's say I am happily editing a document in Vim when I accidentally hit gg. I then end up on the first row of the document, and of course I have no idea which was the exact row that I last edited. Is there any way of magically get back to the last edited row before the gg jump?

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

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

发布评论

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

评论(2

流云如水 2024-10-17 23:28:19

快捷键是Ctrl+O(即字母“O”)可移回到上一个位置。

然后按 Ctrl+I 撤消该操作(移回按 Ctrl+O 之前的位置)。

这些可以多次使用,就像浏览器上的后退和前进按钮一样,可以转到之前“跳转到”的位置。

The shortcut is Ctrl+O (that's the letter 'O') to move back to previous position.

And Ctrl+I to undo that (move back to the position before you pressed Ctrl+O).

These can be used multiple times like the back and forward buttons on your browser to travel to previously "jumped to" positions.

秋千易 2024-10-17 23:28:19

要在当前位置和上次跳转位置之间来回跳动,可以使用 `` (两个反引号)。请参阅 :h `` 以获取此快捷方式和其他跳转快捷方式的列表。

To bounce back and forth between your current position and the last place you jumped from, you can use `` (two backticks). See :h `` for a list of this and other shortcuts for jumping around.

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