简体   繁体   English

使用:tjump代替:按下ctrl-标签vim-]

[英]use :tjump instead of :tag vim on pressing ctrl-]

in vim, 在vim中,
when i press ctrl-] 当我按ctrl-]

1) the usual behavior: 1)通常的行为:
it goes to the first matching tag with the word under the cursor, after that we need to do :tjump separately to see a list of all matching tags and then jump to the desired tag. 它转到第一个匹配的标签,其中包含光标下的单词,之后我们需要这样做:tjump单独查看:tjump以查看所有匹配标签的列表,然后跳转到所需的标签。

2) what i want is: 2)我想要的是:
vim should search the tag file, vim应该搜索标签文件,
if there are multiple matches, show me a list of all the matching tags 如果有多个匹配项,请显示所有匹配标记的列表
if there is one match, simply jump to the matching tag 如果有一个匹配,只需跳转到匹配的标签
(just like :tjump does) (就像:tjump一样)

this behavior(2) already happens when we use g-ctrl-] , but i want it to happen with ctrl-] 当我们使用g-ctrl-] ,这种行为(2)已经发生了,但是我想用ctrl-]来实现它
i have seen behavior(2) using ctrl-] in some vims in some linuses. 我已经在一些线索的某些vims中看到了使用ctrl-]行为(2)。

please tell me how i can obtain behavior(2). 请告诉我如何获得行为(2)。 in other words, 换一种说法,
please tell me how i can make ctrl-] to behave like g-ctrl-] using .vimrc or whatever 请告诉我如何使用.vimrc或其他方法使ctrl-]表现得像g-ctrl-]

This will map <c-]> to g<c-]> for both normal and visual modes. 这将为正常模式和可视模式将<c-]>映射到g<c-]>

nnoremap <c-]> g<c-]>
vnoremap <c-]> g<c-]>

I suggest you map g<c-]> to <c-]> . 我建议你将g<c-]>映射到<c-]> In other words just swap the commands. 换句话说,只需交换命令即可。

nnoremap g<c-]> <c-]>
vnoremap g<c-]> <c-]>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM