]> Sergey Matveev's repositories - dotfiles.git/blob - vim/.vim/plugin/ctags.vim
g:loaded_* stopper
[dotfiles.git] / vim / .vim / plugin / ctags.vim
1 " Universal Ctags creator
2 " Maintainer: Sergey Matveev <stargrave@stargrave.org>
3 " License: GNU General Public License version 3 of the License or later
4 "
5 " Create "tags" file in your project's root first.
6 " Then :Ctags LANG to fill it.
7
8 if exists("g:loaded_mein_ctags") | finish | endif
9 let g:loaded_mein_ctags = 1
10
11 function! s:ctags(lang, onlyCmd, verbose)
12     let dst = tagfiles()[0]
13     let src = "/" . join(split(dst, "/")[:-2], "/")
14     if dst[0] != "/"
15         let dst = getcwd() . "/tags"
16         let src = getcwd()
17     endif
18     let cmdline = [
19         \"uctags",
20         \"--languages=" . a:lang,
21         \"--python-kinds=-i",
22         \"--c++-kinds=+p",
23         \"--recurse",
24     \]
25     if a:verbose == v:true | let cmdline += ["--verbose"] | endif
26     let cmdline += ["-f", dst, src]
27     if a:onlyCmd == v:true
28         echo join(cmdline, " ")
29         return
30     endif
31     execute "!" . join(cmdline, " ")
32     if a:verbose != v:true | redraw! | endif
33 endfunction
34
35 command! -nargs=1 Ctags silent call s:ctags(<f-args>, v:false, v:false)
36 command! -nargs=1 Ctagsv silent call s:ctags(<f-args>, v:true, v:false)
37 command! -nargs=1 Ctagscmd call s:ctags(<f-args>, v:true, v:true)