使用 :tjump 而不是 :tag vim 按下 ctrl-] [英] use :tjump instead of :tag vim on pressing ctrl-]

查看:17
本文介绍了使用 :tjump 而不是 :tag vim 按下 ctrl-]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 vim 中,
当我按 ctrl-]

1) 通常的行为:
它转到第一个与光标下的单词匹配的标签,之后,我们需要单独执行 :tjump 以查看所有匹配标签的列表,然后跳转到所需的标签.

1) the usual behavior:
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.

2) 我想要的是:
vim 应该搜索标签文件,
如果有多个匹配项,请显示所有匹配标签的列表
如果有一个匹配,只需跳转到匹配的标签
(就像 :tjump 一样)

2) what i want is:
vim should search the tag file,
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)

这种行为(2) 在我们使用 g-ctrl-] 时已经发生,但我希望它发生在 ctrl-]
我在一些 linuses 的一些 vim 中看到了使用 ctrl-] 的行为(2).

this behavior(2) already happens when we use g-ctrl-], but i want it to happen with ctrl-]
i have seen behavior(2) using ctrl-] in some vims in some linuses.

请告诉我如何获得行为(2).换句话说,
请告诉我如何使用 .vimrc 或其他方式使 ctrl-] 表现得像 g-ctrl-]

please tell me how i can obtain behavior(2). in other words,
please tell me how i can make ctrl-] to behave like g-ctrl-] using .vimrc or whatever

推荐答案

这会将 <c-]> 映射到 g正常模式和视觉模式.

This will map <c-]> to g<c-]> for both normal and visual modes.

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

我建议你将 g<c-]> 映射到 <c-]>.换句话说,只是交换命令.

I suggest you map g<c-]> to <c-]>. In other words just swap the commands.

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

这篇关于使用 :tjump 而不是 :tag vim 按下 ctrl-]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆