Using Tim Popes Effortless Ctags with Git I had the problem that tags for definitions in submodules where missing.
As I usually don’t make changes in submodules and these submodules are quite big I don’t want to run Ctags on them every time I commit, I choose a manually approach to get tags inside submodules.
Tim Pope removed the feature to add
.git to the tags path in recent versions of
We need to set it manually.
set tags^=.git/sub.tags set tags^=.git/tags
ctags --tag-relative -f .git/sub.tags -R $submodule-dirs
$submodule-dirs are your directories containing submodules to create a separate tags file.
If you want to run Ctags every time on the submodules use the following approach:
After digging a little bit I saw that he is using
git ls-files to find files to pass to
A quick study of
man git-ls-files showed that you need to pass
git ls-files in order to get all files included in the submodules.
ctags-script to be
Note the extra
This will give you all definitions from submodules in your tags file. Note though, that this will take very long in large projects with many/big submodules. Especially when doing quick commits. A Ctags process will be spawned every time you commit, even if there is already one running. This may result in heavy loads.