Wednesday, 13 July 2016

How to set ctags dynamically?

When we are working on same project, but if we maintain different code base for different work, below is the procedure to update .vimrc file to set ctags dynamically.

Prerequisites:
1. ctag file existence in each project folder as given in below example (PROJ*)
  Note: Here to make use of ctags you need not to be in PROJ* folder itself, can be used from its sub folder also

And, edit /home/username/.vimrc as below (if .vimrc file does not exists in home directory, create one)

Linux dynamic ctags

How it worked?
As, .vimrc is known for having initialization commands list, once we modify the file as above, when we open each file under different project, ctags will be set dynamically based on the PWD path.

Have any issues?
If you see any problem with above approach, please enable the comments in the file (lines stared with "), and try to open any file in respective folders, it will print the variables and you can debug further.

No comments:

Post a Comment