xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

All files listed in Tag File are relative to current directory, not Tag File Location #45

Open duckworthd opened 11 years ago

duckworthd commented 11 years ago

Action: Running :UpdateTags with a directory containing python files

Symptom: all file names referenced in my tag file have paths relative to the location where I executed :UpdateTags, e.g.

n_topics_test   run_crossval_nyt.py     /^def n_topics_test(n_topics):$/;"      f       language:Python
n_topics_test   run_crossval_synthetic.py       /^def n_topics_test(n_topics):$/;"      f       language:Python

Observed Output Vim interprets the file's location as relative to the tag file,

E433: No tags file
E426: tag not found: n_topics_test
tag 1 of 2 or more
File "/Users/dux/.vimetc/run_crossval_nyt.py" does not exist
tag 2 of 2 or more
tag 2 of 2
E429: File "/Users/dux/.vimetc/run_crossval_synthetic.py" does not exist 

Expected Output Jumping to the relevant file

xolox commented 11 years ago

Thanks for the bug report! I have some questions:

  1. Do you run the exact command :UpdateTags or do you pass it one or more arguments?
  2. I assume you have configured the vim-easytags plug-in to use a global tags file?
  3. Is the easytags_autorecurse option enabled? You can check by executing the command :let g:easytags_autorecurse (it will print a 0 or 1).
duckworthd commented 11 years ago
  1. I use the --recurse=yes and --file-scope=no options
  2. Indeed, I have set g:easytags_cmd, g:easytags_file, and have disabled g:easytags_on_cursorhold
  3. g:easytags_autorecurse is not defined

I just tried running :UpdateTags without any options and setting g:easytags_autorecurse = 1 and absolute paths did appear in my tag file (yay!). Problem solved! Could you describe how this behavior manifested for my benefit?

xolox commented 11 years ago

The vim-easytags plug-in executes Exuberant Ctags in one of two modes:

  1. The tags for a single file (the current buffer) are updated;
  2. The tags for a directory of files are (possibly recursively) updated (think of this as "batch" mode).

The two modes are not handled in exactly the same way so it could be that one of the two modes normalizes pathnames while the other does not. I'll see if I can find out and fix it (vim-easytags should work regardless of how you execute Exuberant Ctags).