Search code examples
vimtagsprojectfzfvim-fzf

Force fzf :Tags to use a specific file with vim


I'm using fzf for a few weeks now and it really changed my workflow. I'm working on a big project with multiple things interconnected.

I'd like to use :Tags command to have an overview of all existing tags in the whole project (not to have multiple tags files) in the folder /home/ctags/ (ctags bin being here).

My command in the vimrc is

let g:fzf_tags_command='/home/ctags/bin/ctags -R --extra=+qf --excmd=pattern --exclude=Makefile -f /home/ctags/tags /home/work/project/'

Because of something I don't understand, while I use :Tags, tags file is generated where I want to, but the error "Failed to create tags" occurs..

The question becomes more simple : how to force fzf to use a specific tag file ?

Bonus I added

set tags=./tags;
set tags+=/usr/include

To also include import tags, but it doesn't seem to work. Any idea ?


Solution

  • EDIT

    Found the solution !

    This has to be added on top of .vimrc file

    set autochdir
    set tags=/home/work/tags,tags;
    

    And the command for :Tags is

    let g:fzf_tags_command='/home/ctags/bin/ctags -R -f /home/work/tags --extra=+qf --excmd=pattern --exclude=Makefile /home/work/project/'
    

    This way, only one tag file will be generated and it will be updated each time you invoke fzf.