How to automatically update tag file in vim?

后端 未结 7 650
南旧
南旧 2021-01-30 02:32

I use vim C++ tag file for navigation using Ctrl-]. The problem is whenever some file gets modified, the links are no longer valid and I have to re-run ctags and update the tag

7条回答
  •  心在旅途
    2021-01-30 03:12

    An idea:

    Use Vim autocommands (:help autocommand) to trigger running of a script every time a buffer is saved using the BufWritePost event.

    This script starts the ctags generation and contains some additional small logic to not run while it's already running (or to run at most every 10 minutes, etc.).

    Edit:

    Something similar was asked here beforehand, see Vim auto-generate ctags

提交回复
热议问题