How to search the tags file and load it automatically when vim start up
Asked Answered
P

1

11

Vim is my favorite editor, when I open a php or python file in vim, the first command is:

set tags=../../../tags

or

set tags=../../tags

I think vim can do this automatically:

first search ./tags, if it is exists, set it, if not exists

search ../tags,if it is exists, set it, if not exists

search ../../tags,if it is exists, set it, if not exists

until it reaches the / or D: directory

However, I am not so familiar with the vim scripts. Any of your help will be appreciated!_

Puleo answered 9/6, 2011 at 3:17 Comment(0)
E
22

There are a few comments on this particular subject on this question.

Basically, this is supposed to work:

set tags=./tags;/

It starts with a tags file in the current directory and goes up to the root directory.

Type :help tags-option for more details.

Ethereal answered 9/6, 2011 at 8:12 Comment(3)
Placing , does not work on my vim. i used semicolon set tags=./tags;/ which works for me.Seaport
Wow. That was a super bad typo. Thanks for spotting it.Ethereal
Check :h file-searching for this syntax.Foxworth

© 2022 - 2024 — McMap. All rights reserved.