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

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

问题描述

在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)

当我们使用 g-ctrl-] 时,这种行为 (2) 已经发生了,但我希望它发生在 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

推荐答案

这会将 映射到 g正常模式和视觉模式.

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

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

我建议你将 g 映射到 .换句话说,只需交换命令.

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

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

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

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