tomkersten-vixploder 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +105 -0
- data/PostInstall.txt +21 -0
- data/README.rdoc +131 -0
- data/Rakefile +21 -0
- data/bin/256colors2.pl +63 -0
- data/bin/colortest +365 -0
- data/bin/vixplode +10 -0
- data/lib/dotfiles/aliases +30 -0
- data/lib/dotfiles/gvimrc +20 -0
- data/lib/dotfiles/vim/.VimballRecord +2 -0
- data/lib/dotfiles/vim/after/ftplugin/actionscript_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/aspvbs_snippets.vim +17 -0
- data/lib/dotfiles/vim/after/ftplugin/c_snippets.vim +58 -0
- data/lib/dotfiles/vim/after/ftplugin/css_snippets.vim +30 -0
- data/lib/dotfiles/vim/after/ftplugin/django_model_snippets.vim +61 -0
- data/lib/dotfiles/vim/after/ftplugin/django_template_snippets.vim +32 -0
- data/lib/dotfiles/vim/after/ftplugin/f-script_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/haskell_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/html_snippets.vim +57 -0
- data/lib/dotfiles/vim/after/ftplugin/java_snippets.vim +52 -0
- data/lib/dotfiles/vim/after/ftplugin/javascript_snippets.vim +10 -0
- data/lib/dotfiles/vim/after/ftplugin/latex_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/logo_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/markdown_snippets.vim +10 -0
- data/lib/dotfiles/vim/after/ftplugin/movable_type_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/objc_snippets.vim +53 -0
- data/lib/dotfiles/vim/after/ftplugin/ocaml_snippets.vim +26 -0
- data/lib/dotfiles/vim/after/ftplugin/perl_snippets.vim +23 -0
- data/lib/dotfiles/vim/after/ftplugin/php_snippets.vim +30 -0
- data/lib/dotfiles/vim/after/ftplugin/phpdoc_snippets.vim +19 -0
- data/lib/dotfiles/vim/after/ftplugin/propel_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/python_snippets.vim +202 -0
- data/lib/dotfiles/vim/after/ftplugin/rails_snippets.vim +54 -0
- data/lib/dotfiles/vim/after/ftplugin/ruby_snippets.vim +32 -0
- data/lib/dotfiles/vim/after/ftplugin/sh_snippets.vim +12 -0
- data/lib/dotfiles/vim/after/ftplugin/slate_snippets.vim +19 -0
- data/lib/dotfiles/vim/after/ftplugin/smarty_snippets.vim +35 -0
- data/lib/dotfiles/vim/after/ftplugin/symfony_snippets.vim +21 -0
- data/lib/dotfiles/vim/after/ftplugin/tcl_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/template_toolkit_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/tex_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/xhtml_snippets.vim +48 -0
- data/lib/dotfiles/vim/autoload/fakeclip.vim +253 -0
- data/lib/dotfiles/vim/autoload/rails.vim +4377 -0
- data/lib/dotfiles/vim/autoload/rubycomplete.vim +802 -0
- data/lib/dotfiles/vim/colors/inkpot.vim +212 -0
- data/lib/dotfiles/vim/colors/ir_black.vim +212 -0
- data/lib/dotfiles/vim/colors/ir_black_mod.vim +213 -0
- data/lib/dotfiles/vim/colors/railscasts.vim +100 -0
- data/lib/dotfiles/vim/colors/rubyblue.vim +74 -0
- data/lib/dotfiles/vim/colors/twilight.vim +75 -0
- data/lib/dotfiles/vim/colors/twilight2.vim +74 -0
- data/lib/dotfiles/vim/colors/wombat256.vim +302 -0
- data/lib/dotfiles/vim/compiler/eruby.vim +41 -0
- data/lib/dotfiles/vim/compiler/ruby.vim +68 -0
- data/lib/dotfiles/vim/compiler/rubyunit.vim +35 -0
- data/lib/dotfiles/vim/doc/NERD_tree.txt +1235 -0
- data/lib/dotfiles/vim/doc/fakeclip.txt +190 -0
- data/lib/dotfiles/vim/doc/matchit.txt +406 -0
- data/lib/dotfiles/vim/doc/project.txt +710 -0
- data/lib/dotfiles/vim/doc/rails.txt +1123 -0
- data/lib/dotfiles/vim/doc/snippets_emu.txt +354 -0
- data/lib/dotfiles/vim/doc/surround.txt +218 -0
- data/lib/dotfiles/vim/doc/tags +433 -0
- data/lib/dotfiles/vim/filetype.vim +13 -0
- data/lib/dotfiles/vim/ftdetect/gist.vim +3 -0
- data/lib/dotfiles/vim/ftdetect/ruby.vim +14 -0
- data/lib/dotfiles/vim/ftplugin/eruby.vim +101 -0
- data/lib/dotfiles/vim/ftplugin/ruby.vim +230 -0
- data/lib/dotfiles/vim/indent/eruby.vim +73 -0
- data/lib/dotfiles/vim/indent/ruby.vim +373 -0
- data/lib/dotfiles/vim/plugin/NERD_tree.vim +3536 -0
- data/lib/dotfiles/vim/plugin/comments.vim +321 -0
- data/lib/dotfiles/vim/plugin/fakeclip.vim +174 -0
- data/lib/dotfiles/vim/plugin/fuzzyfinder.vim +1676 -0
- data/lib/dotfiles/vim/plugin/fuzzyfinder_textmate.vim +150 -0
- data/lib/dotfiles/vim/plugin/gist.vim +241 -0
- data/lib/dotfiles/vim/plugin/gitdiff.vim +141 -0
- data/lib/dotfiles/vim/plugin/matchit.vim +812 -0
- data/lib/dotfiles/vim/plugin/mru.vim +787 -0
- data/lib/dotfiles/vim/plugin/rails.vim +310 -0
- data/lib/dotfiles/vim/plugin/rspec.vim +12 -0
- data/lib/dotfiles/vim/plugin/snippets.vim +17 -0
- data/lib/dotfiles/vim/plugin/snippetsEmu.vim +973 -0
- data/lib/dotfiles/vim/plugin/supertab.vim +531 -0
- data/lib/dotfiles/vim/plugin/surround.vim +632 -0
- data/lib/dotfiles/vim/ref_vimrc +80 -0
- data/lib/dotfiles/vim/ruby/fuzzy_file_finder.rb +353 -0
- data/lib/dotfiles/vim/syntax/eruby.vim +85 -0
- data/lib/dotfiles/vim/syntax/haml.vim +113 -0
- data/lib/dotfiles/vim/syntax/mkd.vim +86 -0
- data/lib/dotfiles/vim/syntax/ruby.vim +324 -0
- data/lib/dotfiles/vim/syntax/sass.vim +93 -0
- data/lib/dotfiles/vimrc +269 -0
- data/lib/vixplode/cli.rb +73 -0
- data/lib/vixploder.rb +6 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/vixplode_cli_spec.rb +15 -0
- data/spec/vixploder_spec.rb +7 -0
- data/tasks/rspec.rake +21 -0
- metadata +202 -8
@@ -0,0 +1,710 @@
|
|
1
|
+
*project.txt* Plugin for managing multiple projects with multiple sources
|
2
|
+
For Vim version 6.x and Vim version 7.x.
|
3
|
+
Last Change: Fri 13 Oct 2006 10:20:13 AM EDT
|
4
|
+
|
5
|
+
|
6
|
+
By Aric Blumer
|
7
|
+
aricvim email-at-sign charter.net
|
8
|
+
|
9
|
+
*project* *project-plugin*
|
10
|
+
Contents:
|
11
|
+
|
12
|
+
Commands...................|project-invoking|
|
13
|
+
Inheritance.............|project-inheritance|
|
14
|
+
Mappings...................|project-mappings|
|
15
|
+
Adding Mappings.....|project-adding-mappings|
|
16
|
+
Settings...................|project-settings|
|
17
|
+
Example File................|project-example|
|
18
|
+
Tips...........................|project-tips|
|
19
|
+
|
20
|
+
|
21
|
+
You can use this plugin's basic functionality to set up a list of
|
22
|
+
frequently-accessed files for easy navigation. The list of files will be
|
23
|
+
displayed in a window on the left side of the Vim window, and you can press
|
24
|
+
<Return> or double-click on filenames in the list to open the files. I find
|
25
|
+
this easier to use than having to navigate a directory hierarchy with the
|
26
|
+
|file-explorer|.
|
27
|
+
|
28
|
+
You can also instruct the Plugin to change to a directory and to run Vim
|
29
|
+
scripts when you select a file. These scripts can, for example, modify the
|
30
|
+
environment to include compilers in $PATH. This makes it very easy to use
|
31
|
+
quickfix with multiple projects that use different environments.
|
32
|
+
|
33
|
+
Other features include:
|
34
|
+
o Loading/Unloading all the files in a Project (\l, \L, \w, and \W)
|
35
|
+
o Grepping all the files in a Project (\g and \G)
|
36
|
+
o Running a user-specified script on a file (can be used to launch an
|
37
|
+
external program on the file) (\1 through \9)
|
38
|
+
o Running a user-specified script on all the files in a Project
|
39
|
+
(\f1-\f9 and \F1-\F9)
|
40
|
+
o High degree of user-configurability
|
41
|
+
o Also works with |netrw| using the XXXX://... notation where XXXX is
|
42
|
+
ftp, rcp, scp, or http.
|
43
|
+
|
44
|
+
All of this is specified within a simple text file and a few global variables
|
45
|
+
in your vimrc file.
|
46
|
+
|
47
|
+
You must set 'nocompatible' in your |vimrc| file to use this plugin. You can
|
48
|
+
stop the plugin from being loaded by setting the "loaded_project" variable: >
|
49
|
+
:let loaded_project = 1
|
50
|
+
|
51
|
+
|
52
|
+
==============================================================================
|
53
|
+
COMMANDS *project-invoking*
|
54
|
+
|
55
|
+
You can use the plugin by placing it in your plugin directory (e.g.,
|
56
|
+
~/.vim/plugin). See |add-global-plugin|. When you start vim the next time, you
|
57
|
+
then enter the command >
|
58
|
+
:Project
|
59
|
+
or >
|
60
|
+
:Project {file}
|
61
|
+
|
62
|
+
If you do not specify the filename, $HOME/.vimprojects is used.
|
63
|
+
|
64
|
+
To have Vim come up with the Project Window enabled automatically (say, from a
|
65
|
+
GUI launcher), run Vim like this: [g]vim +Project
|
66
|
+
|
67
|
+
Note that you can invoke :Project on only one file at a time. If you wish to
|
68
|
+
change the Project File, do a :bwipe in the Project Buffer, then re-invoke the
|
69
|
+
Plugin as described above.
|
70
|
+
|
71
|
+
Several Projects can be kept and displayed in the same file, each in a fold
|
72
|
+
delimited by { and } (see |fold.txt|). There can be any number of nested
|
73
|
+
folds to provide you with a Project hierarchy. Any line without a { or a } in
|
74
|
+
the file is considered to be a filename. Blank lines are ignored, and any
|
75
|
+
text after a # is ignored.
|
76
|
+
|
77
|
+
Because the plugin uses standard Vim folds, you can use any of the
|
78
|
+
|fold-commands|. You can double-click on the first line of a fold to open and
|
79
|
+
close it. You can select a file to open by putting the cursor on its name and
|
80
|
+
pressing <Return> or by double-clicking on it. The plugin will create a new
|
81
|
+
window to the right or use the |CTRL-W_p| equivalent if it exists.
|
82
|
+
|
83
|
+
*project-syntax*
|
84
|
+
Each Project Entry has this form:
|
85
|
+
|
86
|
+
project_entry ::=
|
87
|
+
<Description>={projpath} [{options}] {
|
88
|
+
[ filename ]
|
89
|
+
[ project_entry ]
|
90
|
+
}
|
91
|
+
|
92
|
+
{options} is one or more of the following (on the same line):
|
93
|
+
CD={path}
|
94
|
+
in={filename}
|
95
|
+
out={filename}
|
96
|
+
filter="{pat}"
|
97
|
+
flags={flag}
|
98
|
+
|
99
|
+
Note that a project_entry can reside within a project_entry. This allows you
|
100
|
+
to set up a hierarchy within your Project.
|
101
|
+
|
102
|
+
The <Description> will be displayed in the foldtext and cannot contain "=".
|
103
|
+
There can be no space character directly on either side of the =.
|
104
|
+
|
105
|
+
The {projpath} is the path in which the files listed in the Project's fold
|
106
|
+
will be found, and it may contain environment variables. If the path is a
|
107
|
+
relative path, then the plugin constructs the whole path from the Project's
|
108
|
+
parent, grandparent, etc., all the way up the hierarchy. An outermost
|
109
|
+
project_entry must have an absolute path. See the |project-inheritance|
|
110
|
+
example below. {projpath} may contain spaces, but they must be escaped like
|
111
|
+
normal Vim escapes. Here are two examples of the same directory:
|
112
|
+
>
|
113
|
+
Example=/my/directory/with\ spaces {
|
114
|
+
}
|
115
|
+
Example="/my/directory/with spaces" {
|
116
|
+
}
|
117
|
+
|
118
|
+
I recommend this for Windows�: >
|
119
|
+
|
120
|
+
Example="c:\My Documents" {
|
121
|
+
}
|
122
|
+
|
123
|
+
But Vim is smart enough to do this, too: >
|
124
|
+
|
125
|
+
Example=c:\My\ Documents {
|
126
|
+
}
|
127
|
+
|
128
|
+
CD= provides the directory that Vim will change to when you select a file in
|
129
|
+
that fold (using |:cd|). This allows you, for example, to enter |:make| to use
|
130
|
+
the local Makefile. A CD=. means that Vim will make {projpath} or its
|
131
|
+
inherited equivalent the current working directory. When CD is omitted, the
|
132
|
+
directory is not changed. There can be no space on either side of the =. The
|
133
|
+
value of CD can also be a relative path from a parent's CD. See the
|
134
|
+
|project-inheritance| example below. This directive is ignored for |netrw|
|
135
|
+
projects. Spaces are allowed in the path as for {projpath}.
|
136
|
+
|
137
|
+
in= and out= provide the means to run arbitrary Vim scripts whenever you enter
|
138
|
+
or leave a file's buffer (see the |BufEnter| and |BufLeave| autocommand
|
139
|
+
events). The idea is to have a Vim script that sets up or tears down the
|
140
|
+
environment for the Project like this:
|
141
|
+
|
142
|
+
in.vim: >
|
143
|
+
let $PROJECT_HOME='~/my_project'
|
144
|
+
" Put the compiler in $PATH
|
145
|
+
if $PATH !~ '/path/to/my/compiler'
|
146
|
+
let $PATH=$PATH.':/path/to/my/compiler'
|
147
|
+
endif
|
148
|
+
|
149
|
+
out.vim: >
|
150
|
+
" Remove compiler from $PATH
|
151
|
+
if $PATH =~ '/path/to/my/compiler'
|
152
|
+
let $PATH=substitute($PATH, ':/path/to/my/compiler', '', 'g')
|
153
|
+
endif
|
154
|
+
|
155
|
+
Then you can use :make with the proper environment depending on what file you
|
156
|
+
are currently editing. If the path to the script is relative, then it is
|
157
|
+
relative from {projpath}. These directives are inherited by Subprojects
|
158
|
+
unless the Subproject specifies its own. For use with |netrw| projects, the
|
159
|
+
paths specified for in= and out= must be absolute and local.
|
160
|
+
|
161
|
+
filter= specifies a |glob()| file pattern. It is used to regenerate the list
|
162
|
+
of files in a Project fold when using the \r (<LocalLeader>r) map in the
|
163
|
+
Project Window. The filter value must be in quotes because it can contain
|
164
|
+
multiple file patterns. If filter is omitted, then the * pattern is used.
|
165
|
+
There can be no space on either side of the =. A Subproject will inherit the
|
166
|
+
filter of its parent unless it specifies its own filter.
|
167
|
+
|
168
|
+
flags= provides the means to enable/disable features for a particular fold.
|
169
|
+
The general mnemonic scheme is for lower case to turn something off and upper
|
170
|
+
case to turn something on. {flag} can contain any of the following
|
171
|
+
characters:
|
172
|
+
|
173
|
+
flag Description ~
|
174
|
+
|
175
|
+
l Turn off recursion for this fold for \L. Subfolds are also
|
176
|
+
blocked from the recursion.
|
177
|
+
|
178
|
+
r Turn off refresh. When present, do not refresh this fold when
|
179
|
+
\r or \R is used. This does not affect subfold recursion.
|
180
|
+
|
181
|
+
S Turn on sorting for refresh and create.
|
182
|
+
|
183
|
+
s Turn off sorting for refresh and create.
|
184
|
+
|
185
|
+
T Turn on top gravity. Forces folds to the top of the current
|
186
|
+
fold when refreshing. It has the same affect as the 'T' flag
|
187
|
+
in g:proj_flags, but controls the feature on a per-fold basis.
|
188
|
+
|
189
|
+
t Turn off top gravity. Forces folds to the bottom of the
|
190
|
+
current fold when refreshing.
|
191
|
+
|
192
|
+
w Turn off recursion for this fold for \W. Subfolds are also
|
193
|
+
blocked from the recursion.
|
194
|
+
|
195
|
+
|
196
|
+
Flags are not inherited by Subprojects.
|
197
|
+
|
198
|
+
Any text outside a fold is ignored.
|
199
|
+
|
200
|
+
|
201
|
+
==============================================================================
|
202
|
+
INHERITANCE *project-inheritance*
|
203
|
+
|
204
|
+
It's best to show inheritance by comparing these two Project Files:
|
205
|
+
>
|
206
|
+
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
|
207
|
+
Child1=c_code {
|
208
|
+
}
|
209
|
+
Child2=include CD=. filter="*.h" {
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
Child1's path is "~/my_project/c_code" because ~/my_project is inherited. It
|
214
|
+
also inherits the CD from Parent. Since Parent has CD=., the Parent's cwd is
|
215
|
+
"~/my_project". Child1 therefore inherits a CD of "~/my_project". Finally,
|
216
|
+
Child1 inherits the filter from Parent. The flags are not inherited.
|
217
|
+
|
218
|
+
Child2 only inherits the "~/my_project" from Parent.
|
219
|
+
|
220
|
+
Thus, the example above is exactly equivalent to this:
|
221
|
+
>
|
222
|
+
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
|
223
|
+
Child1=~/my_project/c_code CD=~/my_project filter="Make* *.mk" {
|
224
|
+
}
|
225
|
+
Child2=~/my_project/include CD=~/my_project/include filter="*.h" {
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
(For a real Project, Child1 would not want to inherit its parent's filter, but
|
230
|
+
this example shows the concept.) You can always enter \i to display what the
|
231
|
+
cursor's project inherits.
|
232
|
+
|
233
|
+
|
234
|
+
==============================================================================
|
235
|
+
MAPPINGS *project-mappings*
|
236
|
+
|
237
|
+
Map Action ~
|
238
|
+
|
239
|
+
\r Refreshes the Project fold that the cursor is in by placing in the
|
240
|
+
fold all the files that match the filter. The Project is refreshed
|
241
|
+
using an indent of one space for every foldlevel in the hierarchy.
|
242
|
+
|
243
|
+
You may place a "# pragma keep" (without the quotes) at the end of a
|
244
|
+
line, and the file entry on that line will not be removed when you
|
245
|
+
refresh. This is useful, for example, when you have . as an entry so
|
246
|
+
you can easily browse the directory.
|
247
|
+
|
248
|
+
Note that this mapping is actually <LocalLeader>r, and the default of
|
249
|
+
|<LocalLeader>| is \.
|
250
|
+
|
251
|
+
This does not work for Projects using |netrw|.
|
252
|
+
|
253
|
+
\R Executes \r recursively in the current fold and all folds below.
|
254
|
+
This does not work for Projects using |netrw|.
|
255
|
+
|
256
|
+
\c Creates a Project fold entry. It asks for the description, the path
|
257
|
+
to the files, the CD parameter, and the filename |glob()| pattern.
|
258
|
+
From this information, it will create the Project Entry below the
|
259
|
+
cursor.
|
260
|
+
|
261
|
+
This does not work for Projects using |netrw|.
|
262
|
+
|
263
|
+
\C Creates a Project fold entry like \c, but recursively includes all the
|
264
|
+
subdirectories.
|
265
|
+
|
266
|
+
<Return>
|
267
|
+
Select a file to open in the |CTRL-W_p| window or in a new window. If
|
268
|
+
the cursor is on a fold, open or close it.
|
269
|
+
|
270
|
+
<S-Return>
|
271
|
+
\s
|
272
|
+
Same as <Return> but horizontally split the target window.
|
273
|
+
<LocalLeader>s is provided for those terminals that don't recognize
|
274
|
+
<S-Return>.
|
275
|
+
|
276
|
+
\S
|
277
|
+
Load all files in a project by doing horizontal splits.
|
278
|
+
|
279
|
+
<C-Return>
|
280
|
+
\o
|
281
|
+
Same as <Return> but ensure that the opened file is the only other
|
282
|
+
window. <LocalLeader>o is provided for those terminals that don't
|
283
|
+
recognize <C-Return>.
|
284
|
+
|
285
|
+
<M-Return>
|
286
|
+
\v
|
287
|
+
Same as <Return> but only display the file--the cursor stays in the
|
288
|
+
Project Window.
|
289
|
+
|
290
|
+
<2-LeftMouse>
|
291
|
+
(Double-click) If on a closed fold, open it. If on an open fold
|
292
|
+
boundary, close it. If on a filename, open the file in the |CTRL-W_p|
|
293
|
+
window or in a new window.
|
294
|
+
|
295
|
+
<S-2-LeftMouse>
|
296
|
+
Same as <S-Return>.
|
297
|
+
|
298
|
+
<C-2-LeftMouse>
|
299
|
+
Same as <C-Return>.
|
300
|
+
|
301
|
+
<RightMouse>
|
302
|
+
Increase the width of the Project Window by g:proj_window_increment or
|
303
|
+
toggle between a width of
|
304
|
+
g:proj_window_width + g:proj_window_increment
|
305
|
+
and
|
306
|
+
g:proj_window_width.
|
307
|
+
|
308
|
+
Whether you toggle or monotonically increase the width is determined
|
309
|
+
by the 't' flag of the g:proj_flags variable (see |project-flags|).
|
310
|
+
|
311
|
+
Note that a Right Mouse click will not automatically place the cursor
|
312
|
+
in the Project Window if it is in a different window. The window will
|
313
|
+
go back to the g:proj_window_width width when you leave the window.
|
314
|
+
|
315
|
+
<space> Same as <RightMouse>
|
316
|
+
|
317
|
+
<CTRL-Up>
|
318
|
+
\<Up>
|
319
|
+
Move the text or fold under the cursor up one row. This may not work
|
320
|
+
in a terminal because the terminal is unaware of this key combination.
|
321
|
+
<LocalLeader><Up> is provided for those terminals that don't recognize
|
322
|
+
<C-Up>.
|
323
|
+
|
324
|
+
|
325
|
+
<CTRL-Down>
|
326
|
+
\<Down>
|
327
|
+
Move the text or fold under the cursor down one row. This may not work
|
328
|
+
in a terminal because the terminal is unaware of this key combination.
|
329
|
+
<LocalLeader><Down> is provided for those terminals that don't
|
330
|
+
recognize <C-Down>.
|
331
|
+
|
332
|
+
\i Show in the status line the completely resolved and inherited
|
333
|
+
parameters for the fold the cursor is in. This is intended for
|
334
|
+
debugging your relative path and inherited parameters for manually
|
335
|
+
entered Projects.
|
336
|
+
|
337
|
+
\I Show in the status line the completely resolved filename. Uses the
|
338
|
+
Project_GetFname(line('.')) function.
|
339
|
+
|
340
|
+
\1 - \9
|
341
|
+
Run the command specified in g:proj_run{x} where {x} is the number
|
342
|
+
of the key. See the documentation of g:proj_run1 below.
|
343
|
+
|
344
|
+
\f1-\f9
|
345
|
+
Run the command specified in g:proj_run_fold{x} where {x} is the
|
346
|
+
number of the key. The command is run on the files at the current
|
347
|
+
Project level. See the |project-settings| below.
|
348
|
+
|
349
|
+
\F1-\F9
|
350
|
+
Run the command specified in g:proj_run_fold{x} where {x} is the
|
351
|
+
number of the key. The command is run on the files at the current
|
352
|
+
Project level and all Subprojects. See the |project-settings| below.
|
353
|
+
|
354
|
+
\0 Display the commands that are defined for \1 through \9.
|
355
|
+
|
356
|
+
\f0 Display the commands that are defined for \f1 through \f9 and \F1
|
357
|
+
through \F0. Same as \F0.
|
358
|
+
|
359
|
+
\l Load all the files in the current Project level into Vim. While files
|
360
|
+
are being loaded, you may press any key to stop.
|
361
|
+
|
362
|
+
\L Load all the files in the current Project and all Subprojects into
|
363
|
+
Vim. Use this mapping with caution--I wouldn't suggest using \L to
|
364
|
+
load a Project with thousands of files. (BTW, my Project file has more
|
365
|
+
than 5,300 files in it!) While files are being loaded, you may press
|
366
|
+
any key to stop.
|
367
|
+
|
368
|
+
\w Wipe all the files in the current Project level from Vim. (If files
|
369
|
+
are modified, they will be saved first.) While files are being wiped,
|
370
|
+
you may press any key to stop.
|
371
|
+
|
372
|
+
\W Wipe all the files in the current Project and all Subprojects from
|
373
|
+
Vim. (If files are modified, they will be saved first.) While files
|
374
|
+
are being wiped, you may press any key to stop.
|
375
|
+
|
376
|
+
\g Grep all the files in the current Project level.
|
377
|
+
|
378
|
+
\G Grep all the files in the current Project level and all Subprojects.
|
379
|
+
|
380
|
+
\e Set up the Environment for the Project File as though you had selected
|
381
|
+
it with <Return>. This allows you to do a \e and a :make without
|
382
|
+
having to open any files in the project.
|
383
|
+
|
384
|
+
\E Explore (using |file-explorer|) the directory of the project the
|
385
|
+
cursor is in. Does not work with netrw.
|
386
|
+
|
387
|
+
<F12> When the 'g' flag is present in g:proj_flags (see |project-flags|)
|
388
|
+
this key toggles the Project Window open and closed. You may remap
|
389
|
+
this toggle function by putting the following in your vimrc and
|
390
|
+
replacing <Leader>P with whatever key combination you wish:
|
391
|
+
|
392
|
+
nmap <silent> <Leader>P <Plug>ToggleProject
|
393
|
+
|
394
|
+
Note that the Project Plugin remaps :help because the Help Window and the
|
395
|
+
Project Window get into a fight over placement. The mapping avoids the
|
396
|
+
problem.
|
397
|
+
|
398
|
+
==============================================================================
|
399
|
+
ADDING MAPPINGS *project-adding-mappings*
|
400
|
+
|
401
|
+
You can add your own mappings or change the mappings of the plugin by placing
|
402
|
+
them in the file $HOME/.vimproject_mappings. This file, if it exists, will be
|
403
|
+
sourced when the plugin in loaded. Here is an example that will count the
|
404
|
+
number of entries in a project when you press \K (Kount, C is taken :-): >
|
405
|
+
|
406
|
+
function! s:Wc()
|
407
|
+
let b:loadcount=0
|
408
|
+
function! SpawnExec(infoline, fname, lineno, data)
|
409
|
+
let b:loadcount = b:loadcount + 1
|
410
|
+
if getchar(0) != 0 | let b:stop_everything=1 | endif
|
411
|
+
endfunction
|
412
|
+
call Project_ForEach(1, line('.'), "*SpawnExec", 0, '')
|
413
|
+
delfunction SpawnExec
|
414
|
+
echon b:loadcount." Files\r"
|
415
|
+
unlet b:loadcount
|
416
|
+
if exists("b:stop_everything")
|
417
|
+
unlet b:stop_everything
|
418
|
+
echon "Aborted.\r"
|
419
|
+
endif
|
420
|
+
endfunction
|
421
|
+
|
422
|
+
nnoremap <buffer> <silent> <LocalLeader>K :call <SID>Wc()<CR>
|
423
|
+
|
424
|
+
Here's another example of how I integrated the use of perforce with the plugin
|
425
|
+
in my $HOME/.vimproject_mappings:
|
426
|
+
>
|
427
|
+
function! s:DoP4(cmd)
|
428
|
+
let name=Project_GetFname(line('.'))
|
429
|
+
let dir=substitute(name, '\(.*\)/.*', '\1', 'g')
|
430
|
+
exec 'cd '.dir
|
431
|
+
exec "!".a:cmd.' '.Project_GetFname(line('.'))
|
432
|
+
cd -
|
433
|
+
endfunction
|
434
|
+
|
435
|
+
nmap <buffer> <silent> \pa :call <SID>DoP4("p4add")<CR>
|
436
|
+
nmap <buffer> <silent> \pe :call <SID>DoP4("p4edit")<CR>
|
437
|
+
<
|
438
|
+
(Note that I CD to the directory the file is in so I can pick of the $P4CONFIG
|
439
|
+
file. See the perforce documentation.)
|
440
|
+
|
441
|
+
This creates the mappings \pe to check out the file for edit and \pa to add
|
442
|
+
the file to the depot.
|
443
|
+
|
444
|
+
Here is another example where I remap the <Return> mapping to use an external
|
445
|
+
program to launch a special kind of file (in this case, it launches ee to view
|
446
|
+
a jpg file). It is a bit contrived, but it works.
|
447
|
+
>
|
448
|
+
let s:sid = substitute(maparg('<Return>', 'n'), '.*\(<SNR>.\{-}\)_.*', '\1', '')
|
449
|
+
function! s:LaunchOrWhat()
|
450
|
+
let fname=Project_GetFname(line('.'))
|
451
|
+
if fname =~ '\.jpg$'
|
452
|
+
exec 'silent! !ee "'.fname.'"&'
|
453
|
+
else
|
454
|
+
call {s:sid}_DoFoldOrOpenEntry('', 'e')
|
455
|
+
endif
|
456
|
+
endfunction
|
457
|
+
nnoremap <buffer> <silent> <Return> \|:call <SID>LaunchOrWhat()<CR>
|
458
|
+
<
|
459
|
+
If the file ends in .jpg, the external program is launched, otherwise the
|
460
|
+
original mapping of <Return> is run.
|
461
|
+
|
462
|
+
==============================================================================
|
463
|
+
SETTINGS *project-settings*
|
464
|
+
|
465
|
+
You can set these variables in your vimrc file before the plugin is loaded to
|
466
|
+
change its default behavior
|
467
|
+
|
468
|
+
g:proj_window_width
|
469
|
+
The width of the Project Window that the plugin attempts to maintain.
|
470
|
+
Default: 24
|
471
|
+
|
472
|
+
The Project Plugin is not always successful in keeping the window
|
473
|
+
where I want it with the size specified here, but it does a decent
|
474
|
+
job.
|
475
|
+
|
476
|
+
g:proj_window_increment
|
477
|
+
The increment by which to increase the width of the Project Window
|
478
|
+
when pressing <space> or clicking the <LeftMouse>. Default: 100
|
479
|
+
(See |project-mappings|.)
|
480
|
+
|
481
|
+
*project-flags*
|
482
|
+
g:proj_flags
|
483
|
+
Default: "imst"
|
484
|
+
Various flags to control the behavior of the Project Plugin. This
|
485
|
+
variable can contain any of the following character flags.
|
486
|
+
|
487
|
+
flag Description ~
|
488
|
+
|
489
|
+
b When present, use the |browse()| when selecting directories
|
490
|
+
for \c and \C. This is off by default for Windows, because
|
491
|
+
the windows browser does not allow you to select directories.
|
492
|
+
|
493
|
+
c When present, the Project Window will automatically close when
|
494
|
+
you select a file.
|
495
|
+
|
496
|
+
F Float the Project Window. That is, turn off automatic
|
497
|
+
resizing and placement. This allows placement between other
|
498
|
+
windows that wish to share similar placement at the side of
|
499
|
+
the screen. It is also particularly helpful for external
|
500
|
+
window managers.
|
501
|
+
|
502
|
+
g When present, the mapping for <F12> will be created to toggle
|
503
|
+
the Project Window open and closed.
|
504
|
+
|
505
|
+
i When present, display the filename and the current working
|
506
|
+
directory in the command line when a file is selected for
|
507
|
+
opening.
|
508
|
+
|
509
|
+
l When present, the Project Plugin will use the |:lcd| command
|
510
|
+
rather than |:cd| to change directories when you select a file
|
511
|
+
to open. This flag is really obsolete and not of much use
|
512
|
+
because of L below.
|
513
|
+
|
514
|
+
L Similar to l, but install a BufEnter/Leave |:autocommand| to
|
515
|
+
ensure that the current working directory is changed to the
|
516
|
+
one specified in the fold CD specification whenever that
|
517
|
+
buffer is active. (|:lcd| only changes the CWD for a window,
|
518
|
+
not a buffer.)
|
519
|
+
|
520
|
+
m Turn on mapping of the |CTRL-W_o| and |CTRL-W_CTRL_O| normal
|
521
|
+
mode commands to make the current buffer the only visible
|
522
|
+
buffer, but keep the Project Window visible, too.
|
523
|
+
|
524
|
+
n When present, numbers will be turned on for the project
|
525
|
+
window.
|
526
|
+
|
527
|
+
s When present, the Project Plugin will use syntax highlighting
|
528
|
+
in the Project Window.
|
529
|
+
|
530
|
+
S Turn on sorting for refresh and create.
|
531
|
+
|
532
|
+
t When present, toggle the size of the window rather than just
|
533
|
+
increase the size when pressing <space> or right-clicking.
|
534
|
+
See the entry for <RightMouse> in |project-mappings|.
|
535
|
+
|
536
|
+
T When present, put Subproject folds at the top of the fold when
|
537
|
+
refreshing.
|
538
|
+
|
539
|
+
v When present, use :vimgrep rather than :grep when using \G.
|
540
|
+
|
541
|
+
g:proj_run1 ... g:proj_run9
|
542
|
+
Contains a Vim command to execute on the file. See the
|
543
|
+
mappings of \1 to \9 above.
|
544
|
+
|
545
|
+
%f is replaced with the full path and filename
|
546
|
+
%F is replaced with the full path and filename with spaces
|
547
|
+
quoted
|
548
|
+
%n is replaced with the filename alone
|
549
|
+
%N is replaced with the filename alone with spaces quoted
|
550
|
+
%h is replaced with the home directory
|
551
|
+
%H is replaced with the home directory with spaces quoted
|
552
|
+
%r is replaced with the directory relative to the CD path
|
553
|
+
%R is replaced with the directory relative to the CD path
|
554
|
+
with spaces quoted
|
555
|
+
%d is replaced with the CD directory.
|
556
|
+
%D is replaced with the CD directory.with spaces quoted
|
557
|
+
%% is replaced with a single % that is not used in
|
558
|
+
expansion.
|
559
|
+
|
560
|
+
(Deprecated: %s is also replaced with the full path and
|
561
|
+
filename for backward compatibility.)
|
562
|
+
|
563
|
+
For example, gvim will be launched on the file under the
|
564
|
+
cursor when you enter \3 if the following is in your vimrc
|
565
|
+
file: >
|
566
|
+
let g:proj_run3='silent !gvim %f'
|
567
|
+
< Here are a few other examples: >
|
568
|
+
let g:proj_run1='!p4 edit %f'
|
569
|
+
let g:proj_run2='!p4 add %f'
|
570
|
+
let g:proj_run4="echo 'Viewing %f'|sil !xterm -e less %f &"
|
571
|
+
<
|
572
|
+
On Windows systems you will want to put the %f, %h, and %d in
|
573
|
+
single quotes to avoid \ escaping.
|
574
|
+
|
575
|
+
g:proj_run_fold1 ... g:proj_run_fold9
|
576
|
+
Contains a Vim command to execute on the files in a fold. See
|
577
|
+
the mappings of \f1 to \f9 and \F1 to \F9 above.
|
578
|
+
|
579
|
+
%f is the filename, %h is replaced with the project home
|
580
|
+
directory, and %d is replaced with the CD directory. Multiple
|
581
|
+
filenames can be handled in two ways:
|
582
|
+
|
583
|
+
The first (default) way is to have %f replaced with all the
|
584
|
+
absolute filenames, and the command is run once. The second
|
585
|
+
is to have the command run for each of the non-absolute
|
586
|
+
filenames (%f is replaced with one filename at a time). To
|
587
|
+
select the second behavior, put an '*' character at the
|
588
|
+
beginning of the g:proj_run_fold{x} variable. (The '*' is
|
589
|
+
stripped before the command is run.)
|
590
|
+
|
591
|
+
For example, note the difference between the following: >
|
592
|
+
let g:proj_run_fold3="*echo '%h/%f'"
|
593
|
+
let g:proj_run_fold4="echo '%f'"
|
594
|
+
<
|
595
|
+
Note that on Windows systems, you will want the %f, %h, and %c
|
596
|
+
within single quotes, or the \ in the paths will cause
|
597
|
+
problems. The alternative is to put them in |escape()|.
|
598
|
+
|
599
|
+
|
600
|
+
==============================================================================
|
601
|
+
PROJECT EXAMPLE FILE *project-example*
|
602
|
+
|
603
|
+
Here is an example ~/.vimprojects file: >
|
604
|
+
|
605
|
+
1 My Project=~/c/project CD=. in=in.vim out=out.vim flags=r {
|
606
|
+
2 Makefile
|
607
|
+
3 in.vim
|
608
|
+
4 out.vim
|
609
|
+
5 GUI Files=. filter="gui*.c gui*.h" {
|
610
|
+
6 gui_window.c
|
611
|
+
7 gui_dialog.c
|
612
|
+
8 gui_list.c
|
613
|
+
9 gui.h # Header file
|
614
|
+
10 }
|
615
|
+
11 Database Files=. filter="data*.c data*.h" {
|
616
|
+
12 data_read.c
|
617
|
+
13 data_write.c
|
618
|
+
14 data.h
|
619
|
+
15 }
|
620
|
+
16 OS-Specific Files {
|
621
|
+
17 Win32=. filter="os_win32*.c os_win32*.h" {
|
622
|
+
18 os_win32_gui.c
|
623
|
+
19 os_win32_io.c
|
624
|
+
20 }
|
625
|
+
21 Unix=. filter="os_unix*.c os_unix*.h" {
|
626
|
+
22 os_unix_gui.c
|
627
|
+
23 os_unix_io.c
|
628
|
+
24 }
|
629
|
+
25 }
|
630
|
+
26 }
|
631
|
+
|
632
|
+
(Don't type in the line numbers, of course.)
|
633
|
+
|
634
|
+
|
635
|
+
==============================================================================
|
636
|
+
TIPS ON USING PROJECT PLUGIN *project-tips*
|
637
|
+
|
638
|
+
1. You can create a Project Entry by entering this: >
|
639
|
+
|
640
|
+
Label=~/wherever CD=. filter="*.c *.h" {
|
641
|
+
}
|
642
|
+
<
|
643
|
+
Then you can put the cursor in the fold and press \r. The script will fill
|
644
|
+
in the files (C files in this case) from this directory for you. This is
|
645
|
+
equivalent to \c without any dialogs.
|
646
|
+
|
647
|
+
2. You can edit the Project File at any time to add, remove, or reorder files
|
648
|
+
in the Project list.
|
649
|
+
|
650
|
+
3. If the Project Window ever gets closed, you can just enter >
|
651
|
+
:Project
|
652
|
+
< to bring it back again. (You don't need to give it the filename; the
|
653
|
+
plugin remembers.)
|
654
|
+
|
655
|
+
If you have the 'm' flag set in g:proj_flags, then you get the Project
|
656
|
+
Window to show up again by pressing |CTRL-W_o|. This, of course, will
|
657
|
+
close any other windows that may be open that the cursor is not in.
|
658
|
+
|
659
|
+
4. Adding files to a Project is very easy. To add, for example, the 'more.c'
|
660
|
+
file to the Project, just insert the filename in the Project Entry then
|
661
|
+
hit <Return> on it.
|
662
|
+
|
663
|
+
5. When |quickfix| loads files, it is not equivalent to pressing <Return> on
|
664
|
+
a filename, so the directory will not be changed and the scripts will not
|
665
|
+
be run. (If I could make this otherwise, I would.) The solution is to use
|
666
|
+
the \L key to load all of the files in the Project before running
|
667
|
+
quickfix.
|
668
|
+
|
669
|
+
6. If the Project window gets a bit cluttered with folds partially
|
670
|
+
open/closed, you can press |zM| to close everything and tidy it up.
|
671
|
+
|
672
|
+
7. For advanced users, I am exporting the function Project_GetAllFnames()
|
673
|
+
which returns all the filenames within a fold and optionally all its
|
674
|
+
Subprojects. Also, I export Project_ForEach() for running a function for
|
675
|
+
each filename in the project. See the code for examples on how to use
|
676
|
+
these. Finally, I export Project_GetFname(line_number) so that you can
|
677
|
+
write your own mappings and get the filename for it.
|
678
|
+
|
679
|
+
8. Some people have asked how to do a global mapping to take the cursor to
|
680
|
+
the Project window. One of my goals for the plugin is for it to be as
|
681
|
+
self-contained as possible, so I'm not going to add it by default. But you
|
682
|
+
can put this in your vimrc:
|
683
|
+
>
|
684
|
+
nmap <silent> <Leader>P :Project<CR>
|
685
|
+
|
686
|
+
<
|
687
|
+
9. You can put the . entry in a project, and it will launch the
|
688
|
+
|file-explorer| plugin on the directory. To avoid removal when you
|
689
|
+
refresh, make the entry look like this:
|
690
|
+
>
|
691
|
+
. # pragma keep
|
692
|
+
<
|
693
|
+
==============================================================================
|
694
|
+
THANKS
|
695
|
+
|
696
|
+
The following people have sent me patches to help with the Project
|
697
|
+
Plugin development:
|
698
|
+
|
699
|
+
Tomas Zellerin
|
700
|
+
Lawrence Kesteloot
|
701
|
+
Dave Eggum
|
702
|
+
A Harrison
|
703
|
+
Thomas Link
|
704
|
+
Richard Bair
|
705
|
+
Eric Arnold
|
706
|
+
Peter Jones
|
707
|
+
Eric Van Dewoestine
|
708
|
+
|
709
|
+
|
710
|
+
vim:ts=8 sw=8 noexpandtab tw=78 ft=help:
|