alias
alias

Reputation: 30460

vim: set tag file name based on file name being edited

I'm in a situation where the tag file for the file (say) a.foo is stored in file a.foo.tags. (Generated by a custom program that I've no control over.)

Is there a way for me to tell vim to look for tags in file a.foo.tags when editing a.foo? I've looked at set tag help, but it decidedly says that the tag file name cannot contain wildcards, nor I was able to use expand('%:p') tricks to set the tag file name appropriately.

Upvotes: 1

Views: 127

Answers (1)

builder-7000
builder-7000

Reputation: 7627

You could update the list of tag files with:

:exe 'set tags+='.expand('%').'.tags'

If the current file is a.foo, this command will add a.foo.tags to the tag file lookup list.

Upvotes: 1

Related Questions