'writtenctags: "tags" doesn't look like a tag file; I refuse to overwrite it

I am using vim with ctags. every once in a while I get the next error message:

writtenctags: "tags" doesn't look like a tag file; I refuse to overwrite it.

my vimrc has the next line:

au BufWritePost *.c,*.cpp,*.h,*.go,*.py,*.m silent! !ctags -R --exclude="*.symbolsmap.h" . &

not sure why and what this error message means ?

> ctags --version
Exuberant Ctags Development, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Apr 18 2022, 11:57:30
  Addresses: <[email protected]>, http://ctags.sourceforge.net
  Optional compiled features: +wildcards, +regex


Solution 1:[1]

Not sure, but I think that running the ctags command (when saving the buffer) again before the first ctags command finishes is messing up the ctags file, and than you will get this error message... I found out that the next command is better (didn't see this error again):

au BufWritePost *.c,*.cpp,*.h,*.go,*.py,*.m silent! !eval 'ctags -R --exclude="*.symbolsmap.h" -o newtags .; mv newtags tags' &

its is running the ctags on the repo but output it to newtags file... and only than override the orig tags file...

hope it helps someone...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yehudahs