Skip to content

@rafeco /ctags_autocmd.vim
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
My Vim ctags configuration
function! DelTagOfFile(file)
let fullpath = a:file
let cwd = getcwd()
let tagfilename = cwd . "/tags"
let f = substitute(fullpath, cwd . "/", "", "")
let f = escape(f, './')
let cmd = 'sed -i "/' . f . '/d" "' . tagfilename . '"'
let resp = system(cmd)
endfunction
function! UpdateTags()
let f = expand("%:p")
let cwd = getcwd()
let tagfilename = cwd . "/tags"
if filereadable(tagfilename)
let cmd = 'ctags -a -f ' . tagfilename . ' "' . f . '"'
call DelTagOfFile(f)
let resp = system(cmd)
endif
endfunction
autocmd BufWritePost * call UpdateTags()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.