gVim - What is ctags, and how do I use it?
I am a regular gVim user on Windows, but don't do much more than install it, set up my small _vimrc
file, and go.
Now I am trying to both understand gVim Omni completion, and get it to work (I found out about it via haXe).
Reading :help new-omni-completion
, I saw something about ctags
.
But going to the ctags site, their site confused me.
What does ctags
do, why do I want it?
And the most important part: how do I install it?
The page and docs that came with the source + binary archive I downloaded are confusing about installing (and seem to focus mostly on Linux, though I'm using Windows). Most of them talk about compiling from source, and don't say what to do with the resulting binary (which the archive I downloaded already contained, pre-compiled).
Solution 1:
ctags
is a tool which is able to create a so called tags
files. a tags
file is essentially an index. vim is able to parse that file and knows, where certain patterns are.
eg.: you have a file foo.h
where a function foo_world()
is declared. ctags
parses foo.h
and puts a mark into the index-file tags
where it stores the file and linenumber to foo_world()
. in vim you are then able to jump directly to that mark. or autocomplete structures, classes, function names etc.
ctags is able to extract such information for a wide variety of programming languages. you only need ctags
if you are a programmer and if you find that 'jump to that position in that other file' usefull.