vi 命令行相当于 CTRL-]?
我正在尝试在 vi 中映射我自己的快捷方式。 我希望能够打开一个分割窗口,其中包含我正在调用快捷方式的函数的声明。 我的 vimrc 中是这样的:
nmap
但在命令模式下相当于 C-] 的是什么?
I'm trying to map my own shortcuts in vi.
I want to be able to open a splitted window containing the declaration of the function I'm calling the shortcut on.
something like this in my vimrc:
nmap <unique> <silent> <Leader>tg :exe 'vsplit'\| equivalent of <C-]>
but what's the equivalent of C-] in command mode ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要在包含标签
foobar
的行打开 vim,请在 shell 命令行中键入:要在 vim 命令行上跳转到同一标签,请键入:
如果要拆分窗口并跳转到新窗口在 vim 的命令行中输入:
如果您想要指定“光标下的单词”的击键,则根据 这个问题,可以使用 CTRL+R CTRL+W 得到:
:tag CTRL+ R CTRL+W
您还可以使用:
现在输入
+w
(在我的设置中是 \,所以我按 \w) 与输入:tag
To open vim at the line containing the tag
foobar
type this at the shell commandline:To jump to the same tag on the vim commandline type:
If you want to split the window and jump to the tag in the new window type this in vim's commandline:
If you want a keystroke that specifies "the word under the cursor", then according to this question, you can use the CTRL+R CTRL+W to get that:
:tag CTRL+R CTRL+W
You can also use :
Now typing
<leader>+w
(which is \ in my setup, so I'd press \w) will be the same as typing:tag <word under the cursor>
请参阅:帮助 CTRL-]:
编辑
不确定是否有内置的,但以下内容似乎与光标“下方或之后”的关键字匹配:
See :help CTRL-]:
Edit
Not sure if there is a built-in for this, but the following seems to match the keyword "under or after" the cursor:
您还可以编写(例如将其映射到 Ctrl-Q):
在这种情况下您还可以考虑 :nn[oremap] 以避免嵌套/递归映射。
you could also write (to map it for example to Ctrl-Q):
you could also consider :nn[oremap] in such cases to avoid nested/recursive mappings.
您可以使用
exe "tag " 跳转到光标下单词的定义。展开(“”)
。 Expand 函数用其含义替换特殊标记 - 这包括光标下的文件名、当前文件名等。有关完整集,请参阅 Vim 的 Expand() 函数帮助。或者,您可以使用 :normal 命令,它允许您从 :ex 命令执行正常模式按键序列。
You can jump to the definition of the word under the cursor with
exe "tag " . expand("<cword>")
. The expand function replaces special tokens with their meaning - this includes a filename under the cursor, the current file name, etc. See Vim's help for the expand() function for the full set.Alternatively you could use the :normal command, which lets you execute normal-mode key sequences from an :ex command.