我可以使用Ctrl +]跳转到光标下的单词定义,也可以使用Ctrl + O跳转回我的来源。但是,如果我做一些类似的操作,例如单击鼠标右键,则该跳转列表似乎不会记录我的来源。按住Ctrl键并单击时,Ctrl + O不会跳回到原来的位置。

有没有一种方法可以确保跳转列表不会错过这一点?

最佳答案

标记导航

tag stack存储用于跳入/跳出的所有标签。


ctrl]用于跟随光标下方的标签。
ctrlt用于跳转到标签栈中的上一个条目。
:tag用于跳转到标签堆栈中的下一个条目。


跳转导航

jump list存储光标跳转到/来自的所有位置。根据Vim的文档,在以下情况下,运动被视为“跳跃”:

A "jump" is one of the following commands: "'"', "`", "G", "/", "?", "n",
"N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
the commands that start editing a new file.



ctrlo用于将光标移至跳转列表中的较早条目。
ctrli用于将错误信息移动到跳转列表中的较新条目。


参考资料

:help tag-commands

g<LeftMouse>                        *g<LeftMouse>*
<C-LeftMouse>                   *<C-LeftMouse>* *CTRL-]*
CTRL-]          Jump to the definition of the keyword under the
            cursor.  Same as ":tag {ident}", where {ident} is the
            keyword under or after cursor.
            When there are several matching tags for {ident}, jump
            to the [count] one.  When no [count] is given the
            first one is jumped to. See |tag-matchlist| for
            jumping to other matching tags.
            {Vi: identifier after the cursor}


:help tag-stack

g<RightMouse>                       *g<RightMouse>*
<C-RightMouse>                  *<C-RightMouse>* *CTRL-T*
CTRL-T          Jump to [count] older entry in the tag stack
            (default 1).  {not in Vi}

                        *:po* *:pop* *E555* *E556*
:[count]po[p][!]    Jump to [count] older entry in tag stack (default 1).
            See |tag-!| for [!].  {not in Vi}

:[count]ta[g][!]    Jump to [count] newer entry in tag stack (default 1).
            See |tag-!| for [!].  {not in Vi}


:help jump-motions

                            *CTRL-O*
CTRL-O          Go to [count] Older cursor position in jump list
            (not a motion command).  {not in Vi}
            {not available without the |+jumplist| feature}


<Tab>       or                  *CTRL-I* *<Tab>*
CTRL-I          Go to [count] newer cursor position in jump list
            (not a motion command).
            In a |quickfix-window| it takes you to the position of
            the error under the cursor.
            {not in Vi}
            {not available without the |+jumplist| feature}

关于vim - Intellij VIM模式,跳转列表(CTRL-O)不记录导航,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29373765/

10-13 07:15