【问题标题】:confusion with the jumplist of vim与 vim 的跳转列表混淆
【发布时间】:2020-11-18 12:16:10
【问题描述】:

大家,我对 vim 的跳转列表和跳转列表的移动有些困惑。 我认为它不太适合代码理解。假设我们有一些类似的代码:

package main

import "fmt"

func main() {
    fmt.Println("vim-go")
    hello_world()
    final_answer()
}

func hello_world() {
    hello()
    world()
}

func hello() {
    hello1()
}

func hello1() {}

func world() {
    world1()
}

func world1() {}

func final_answer() {
    final()
    answer()
}

func final() {
    final1()
}

func final1() {
}

func answer() {
    answer1()
}

func answer1() {}

现在我想了解主要功能的作用。所以我必须要 弄清楚 hello_world 和 final_answer 函数的作用以及 hello, world, final ... 我认为理解所有这些功能的途径应该是 the understand path i want

在使用和浏览代码时,我得到了一些这样的跳转路径:

the actual jump list of vim

vim的跳转列表和图片中第9步我想要的代码路径不一致。

我想要的方式是,当我从函数 hello_world 中的 world() 调用中按下时,我可以跳回到 main 中的 hello_world() 调用,但不能跳转到 hello1() 的定义。

有人知道我是否以错误的方式使用 vim 的跳转列表吗? 或者当我按下 world() 时如何跳回 hello_world?

【问题讨论】:

  • 好吧,vim 跳转列表与代码完全无关。它会记住您在文本文件中的最后一次跳转(光标位置)。

标签: vim jump-list


【解决方案1】:

最后,我在https://github.com/vim/vim/blob/master/src/mark.c#L155找到了一个宏

如评论所说

如果最后使用的条目不在顶部,则通过旋转将其置于顶部 堆栈直到它是(较新的条目将在底部)。 在顶部保留一个条目(最后使用的条目)。

在 src/Makefile 中添加一行:

EXTRA_DEFS += -DJUMPLIST_ROTATE

重新编译vim,就可以得到我想要的了。

【讨论】:

  • 哇,这太令人惊讶了!今天我学会了。感谢您深入挖掘并找出这种行为的根源。
  • 而,自this commit以来,JUMPLIST_ROTATE 已被删除
猜你喜欢
  • 1970-01-01
  • 2022-01-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-27
  • 2014-07-09
  • 2014-01-20
  • 1970-01-01
相关资源
最近更新 更多