No edit summary |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipImported |
||
− | {{review}} |
||
− | {{Tip |
||
|id=804 |
|id=804 |
||
+ | |previous=803 |
||
− | |title=single 'tags' file for a source tree |
||
+ | |next=805 |
||
− | |created= |
+ | |created=2004 |
|complexity=intermediate |
|complexity=intermediate |
||
|author=Dubhead |
|author=Dubhead |
||
|version=6.0 |
|version=6.0 |
||
|rating=94/37 |
|rating=94/37 |
||
+ | |category1=Navigation |
||
− | |text= |
||
+ | |category2= |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
+ | </pre> |
||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
+ | </pre> |
||
⚫ | The last semicolon is the key here. When Vim tries to locate the 'tags' file, it first looks at the current directory, then the parent directory, then the parent of the parent, and so on. This setting works nicely with 'set autochdir', because then Vim's current directory is the same as the directory of the file. If you do not like using 'autochdir' but want the same upward search, use: |
||
⚫ | |||
+ | <pre> |
||
+ | set tags=./tags; |
||
+ | </pre> |
||
+ | Here, the leading "./" tells Vim to use the directory of the current file rather than Vim's working directory. |
||
+ | Regardless of the specific search used, you need the <code>+path-extra</code> feature for this tip. |
||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
− | This setting works nicely together with 'set autochdir'. You need +path-extra feature for this tip. Also see *file-searching* . |
||
− | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
− | commands like these in _vimrc: |
||
+ | ==References== |
||
⚫ | |||
+ | * {{help|file-searching}}, which also gives details about adding "stop directories" to end the upward search |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | <pre> |
||
⚫ | |||
⚫ | |||
+ | </pre> |
||
− | perci merci |
||
− | , October 27, 2004 14:12 |
||
---- |
---- |
||
− | <!-- parsed by vimtips.py in 0.538344 seconds--> |
Revision as of 05:49, 13 July 2012
created 2004 · complexity intermediate · author Dubhead · version 6.0
At the top of a source tree, create a tags file by
% ctags -R
This assumes Exuberant Ctags. The -R (or --recurse) option tells ctags to recurse into directories.
Then, set the tags option in vimrc as:
set tags=tags;
The last semicolon is the key here. When Vim tries to locate the 'tags' file, it first looks at the current directory, then the parent directory, then the parent of the parent, and so on. This setting works nicely with 'set autochdir', because then Vim's current directory is the same as the directory of the file. If you do not like using 'autochdir' but want the same upward search, use:
set tags=./tags;
Here, the leading "./" tells Vim to use the directory of the current file rather than Vim's working directory.
Regardless of the specific search used, you need the +path-extra
feature for this tip.
References
- :help file-searching, which also gives details about adding "stop directories" to end the upward search
Comments
You can also tag help/man files, and access it from Vim with commands like these in vimrc:
au FileType perl set tags^=$DOC/perl/tags au FileType cpp set tags^=$DOC/cpp/tags