问题
I am new to Tcl/Tk, I am using Vim to code and browsing. The syntax highlighting for Tcl/Tk is working fine. The jump into the function using Ctrl] doesnt work it gives me an message saying that "cstag: tag not found
". I have installed ctags and generated tags using "ctags -R *.tcl
". I have extensively used namespaces in Tcl/Tk code. The tags generated in tags file is something like this "namespace1::function1
".
How do i get Ctrl] (and CtrlT for popping from stack) working in Vim?
The function to jump could be in either of the 2 formats shown below
function1
namespace1::function1
回答1:
Found a work around for my problem:
The tags file that generated contained tags in the format namespace::function
.
I just removed namespace::
from generated tags file.
Now Ctrl + ] works!!!
回答2:
Vim said he can't find the tags you generated.
Add set tags=./tags,tags;
in your .vimrc
and try again.
回答3:
Try:
:set isk+=:
Seems like ":" doesn't get recognized as a codeword by default.
To make this work every time, add the line to your '~/.vimrc'.
Source: http://vim.1045645.n5.nabble.com/How-to-have-vim-recognize-in-cursor-for-tcl-namespaces-tp1163540p1163541.html
回答4:
Your .vimrc should have the following line
set tags=tags;/
Paste it, save, restart vim and you're golden.
回答5:
What keyboard layout are you using? I'm not familiar with your particular problem, but I've had problems with Ctrl+] on a Swedish keyboard when navigating the help pages.
There, Ctrl+] doesn't work for me (probably since ] is typed with Altgr+9). However, Ctrl+ 'key to the left of Enter' works (which is where ] is located on an English keyboard layout).
I can add that for my problem with the help pages I first tried to map Ctrl+] to another combination, but this still didn't work (not sure why). So if you are having the same problem, remapping might not solve the problem.
来源:https://stackoverflow.com/questions/11078605/ctrl-is-not-working-for-tcl-code-navigation