使用 Vim 返回上一行

发布于 2024-10-15 10:10:27 字数 177 浏览 11 评论 0原文

我想知道是否有办法返回到您在 Vim 中所在的上一行。

举例来说,我正在编写 C 代码,我只想在页面顶部添加一个 #include:我按 gg 并转到顶部,添加#include,然后我想返回到我离开的行。

这在 Vim 中可能吗?

I was wondering if there's a way to return to the previous line you were on in Vim.

Say, for example, I'm writing C code and I just wanted to add an #include at the top of the page: I press gg and go to the top, add the #include, and then I want to return to the line I left off of.

Is this possible in Vim?

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

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

发布评论

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

评论(2

南笙 2024-10-22 10:10:27

是的。您可以使用 `` 在最后两个位置之间跳转。

否则, Ctrl+OCtrl+I 可以帮助您。请参阅:help CTRL-I

Yes. You can use `` in order to jump between the last two positions.

Otherwise, Ctrl+O and Ctrl+I can help you. See :help CTRL-I.

风和你 2024-10-22 10:10:27

使用标记:

ma

标记带您返回的地点(在 gg 之前)

`a

Use a mark:

ma

marks the spot (before the gg)

`a

brings you back.

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