vim9script # Universal Ctags creator # Maintainer: Sergey Matveev # License: GNU General Public License version 3 of the License or later # # Create "tags" file in your project's root first. # Then :Ctags LANG to fill it. export def Do(lang: string, onlyCmd: bool, verbose: bool) var dsts = tagfiles() if len(dsts) == 0 echohl WarningMsg | echomsg "No tagfiles" | echohl None return endif var dst = sort(dsts, (a, b) => len(a) > len(b) ? 1 : len(a) == len(b) ? 0 : -1)[0] var src = "/" .. join(split(dst, "/")[: -3], "/") if dst[0] != "/" dst = getcwd() .. "/.tags/tags" src = getcwd() endif var cmdline = [ "uctags", "--languages=" .. lang, "--python-kinds=-i", "--c++-kinds=+p", "--recurse", ] if verbose == v:true | cmdline += ["--verbose"] | endif cmdline += ["-f", dst, src] if onlyCmd == v:true echo join(cmdline, " ") return endif execute "!" .. join(cmdline, " ") if verbose != v:true | redraw! | endif enddef