簡體   English   中英

與vim的跳轉列表混淆

[英]confusion with the jumplist of vim

大家,我對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 ... 理解所有這些函數的路徑我認為應該是我想要的理解路徑

在使用和瀏覽代碼時,我得到了一些像這樣的跳轉路徑:

vim的實際跳轉列表

vim的跳轉列表與圖片中第9步我想要的代碼路徑不一致。

我想要的方式是,當我按下函數 hello_world 中的 world() 調用時,我可以跳回 main 中的 hello_world() 調用,但不能跳回 hello1() 的定義。

有誰知道我是否以錯誤的方式使用 vim 的跳轉列表? 或者當我按下 world() 時如何跳回 hello_world?

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

正如評論所說

如果最后使用的條目不在頂部,則通過旋轉堆棧將其放在頂部,直到它位於(較新的條目將在底部)。 在頂部保留一個條目(最后使用的條目)。

通過在 src/Makefile 中添加一行:

EXTRA_DEFS += -DJUMPLIST_ROTATE

並重新編譯vim,我可以得到我想要的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM