aboutsummaryrefslogtreecommitdiff
path: root/modules/vim/vim.dot.link/doc/indexer.txt
blob: 330b486ce62f97600f35b45cd22a27fc62ee58fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
*indexer.txt* Plugin for automatically index project files using ctags
              For Vim 7.x version



                     By Dmitry Frank
		      dimon.frank email-at-sign gmail.com


                                          *indexer* *indexer-plugin*
	Contents:

         Options.....................|indexer-options|
         Commands...................|indexer-commands|

You can use this plugin to automatically index your project files 
using ctags. This can be very useful when it's used together with plugins
omnicppcomplete (for c, c++ development), code_complete.vim
and other plugins that using tags.
You also will able to jump from function call to its definition 
just by pressing Ctrl-] or g]

This plugin can work as add-on for project.tar.gz plugin. 
Indexer reads project file, parses it and builds tags for all files 
in project. But it can also work without this plugin.

Actually, if you using project.vim plugin and you projects file is
default (~/.vimprojects), then setting indexer up is very easily: 
you can just copy indexer.vim to your plugins directory, start Vim 
and open any file from your project.
The indexer plugin will detect that opened file from project 
and automatically start ctags for each file in this project. 
It also set &path and &tags options for Vim.

If you are using project.vim but you have another projects file,
you should set option g:indexer_projectsSettingsFilename in your
vimrc. See |indexer-options| for details

If you don't use project.vim then you can use ".indexer_files" to 
define projects to index. 
Default location of this file is "~/.indexer_files". You can change
it by modifying variable g:indexer_indexerListFilename

Note that this file overrides "~/.vimprojects". If both files exists
only "~/.indexer_files" will be used.

Syntax of this file is very easy. Propably the best way to explain it
is show an example.

Example file "~/.indexer_files" >
   [CoolProject]

   /home/user/myproject/src/*.c
   /home/user/myproject/src/*.h
   /home/user/myproject/inc/*.h

   [AnotherProject]

   /home/user/myproject2**/*.c
   /home/user/myproject2**/*.h


I think, there's all obvious:
there's two projects: CoolProject and AnotherProject.
in CoolProject there's all *.c files in "myproject/src" and all header 
files in "myproject/inc". in AnotherProject there's both *.c and *.h 
files in "myproject2" and all subdirectories recursively. 
( "**" means recursively )
It's able to use environment variables in your paths.

You can define the same AnotherProject simplier: 
      >
   [AnotherProject]

   /home/user/myproject2**/*.[ch]

And, finally, it can autodetect project root. So, you can move your 
project to another place in filesystem, and all files will indexed anyway.
More detailed see in options, variable "g:indexer_lookForProjectDir".

========================================================================
OPTIONS                                                  *indexer-options*

You can set these variables in your vimrc file before the plugin is loaded to
change its default behavior

g:indexer_lookForProjectDir (default: 1)

   if on, then plugin will recursively-up search for ".vimprj" directory.
   If it will be found, then plugin will source all "*.vim" files in it,
   and also will set environment variable $INDEXER_PROJECT_ROOT to
   directory in which is ".vimprj" directory.
   
   Your directory tree example:

      | home
      | | user
      | | | myproject
      | | | | src
      | | | | |-file1.c
      | | | | |-file2.c
      | | | | |-file3.c
      | | | | |
      | | | | inc
      | | | | |-file1.h
      | | | | |-file2.h
      | | | | |-file3.h
      | | | | |
      | | | | .vimprj
      | | | | |-conf.vim

   For example, you typing: >
      $ gvim /home/user/myproject/src/file1.c
----

   Then indexer will detect your /home/user/myproject/.vimprj directory
   and source all files *.vim from it,
   and set $INDEXER_PROJECT_ROOT="/home/user/myproject"

   so, you can define any settings that are individual for
   your project, such as another .vimprojects file, or any other.

   This is great for people like me, that likes when ALL project files
   is in only one directory.

   When i need to copy project to another computer i just copying the
   whole folder, and all is done. I using $INDEXER_PROJECT_ROOT variable
   in my .vimprojects file, so that i can put project in any place in
   filesystem, and all files will be indexed, because 
   $INDEXER_PROJECT_ROOT will be always my real project root.

g:indexer_dirNameForSearch (default: ".vimprj")

   directory name with project settings for search (".vimprj" by default)

g:indexer_recurseUpCount (default: 10)

   count of recurse-up for search ".vimprj" directory

g:indexer_indexerListFilename (default: "~/.indexer_files")

   indexer filename. If this file exists then projects file are ignored.

g:indexer_projectsSettingsFilename (default: "~/.vimprojects")

   project filename. (the project file that plugin project.vim using)

g:indexer_projectName (default: '')

   if you don't wand to index any project, you can define one name.
   If it is empty, then indexes any found projects.
   By default is empty.

g:indexer_enableWhenProjectDirFound (default: 1)

   If this option is set, then if gvim started from project directory, this project
   will be indexed. Otherwise project will be indexed only if there's file 
   from this project opened 

g:indexer_tagsDirname (default: "~/.vimtags")

   directory to save tags file. (this is directory because there's propably
   several files in next versions)

   Note: If ".vimprj" directory is found, then this option is ignored and tags
   directory becomes ".vimprj/tags"   

g:indexer_ctagsCommandLineOptions

   ctags command line options. By default is: 
   "--c++-kinds=+p+l --fields=+iaS --extra=+q"

g:indexer_ctagsJustAppendTagsAtFileSave (default: 1)

   when there's project file saving, we need to update tags.
   If this option is on, then ctags will be started just for 
   current file with "-a" key, otherwise tags for all project 
   files will be rebuild.

   There is different sides:
   If just append tags, then old tags will not be removed until 
   you rebuild all tags by typing ":IndexerRebuild" or just restart 
   Vim. If rebuild tags every time, it would take long time 
   (depending on project size, of course)

   By default this option is on.

========================================================================
COMMANDS                                                  *indexer-commands*

:IndexerInfo
   
   prints information about current state of plugin, such as projects file
   using, files not found, and other.

   The first thing you should do if plugin doesn't work is type this command :)
   
:IndexerFiles

   prints list of indexed files

:IndexerRebuild

   rebuild tags for all files in project

:IndexerFilesAvail

   prints list of all available files that has been read from projects file


 vim:ft=help:tw=78: