Manoj Srivatsav
Manoj Srivatsav

Reputation: 280

ctrl-] is not working for tcl code navigation

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

  1. function1
  2. namespace1::function1

Upvotes: 5

Views: 2136

Answers (5)

Malik Alimoekhamedov
Malik Alimoekhamedov

Reputation: 428

Your .vimrc should have the following line

set tags=tags;/

Paste it, save, restart vim and you're golden.

Upvotes: 1

Finomnis
Finomnis

Reputation: 22476

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

Upvotes: 3

fileunderwater
fileunderwater

Reputation: 1125

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.

Upvotes: 0

Manoj Srivatsav
Manoj Srivatsav

Reputation: 280

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!!!

Upvotes: 3

xdazz
xdazz

Reputation: 160833

Vim said he can't find the tags you generated.

Add set tags=./tags,tags; in your .vimrc and try again.

Upvotes: 2

Related Questions