utils 0.0.67 → 0.0.68
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/edit +3 -1
- data/lib/utils/editor.rb +14 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +3 -3
- metadata +3 -74
- data/lib/utils/config/vim/after/syntax/haml.vim +0 -9
- data/lib/utils/config/vim/after/syntax/html.vim +0 -11
- data/lib/utils/config/vim/autoload/Align.vim +0 -1029
- data/lib/utils/config/vim/autoload/AlignMaps.vim +0 -330
- data/lib/utils/config/vim/autoload/ctrlp/bookmarkdir.vim +0 -139
- data/lib/utils/config/vim/autoload/ctrlp/buffertag.vim +0 -238
- data/lib/utils/config/vim/autoload/ctrlp/changes.vim +0 -96
- data/lib/utils/config/vim/autoload/ctrlp/dir.vim +0 -90
- data/lib/utils/config/vim/autoload/ctrlp/line.vim +0 -63
- data/lib/utils/config/vim/autoload/ctrlp/mixed.vim +0 -83
- data/lib/utils/config/vim/autoload/ctrlp/mrufiles.vim +0 -119
- data/lib/utils/config/vim/autoload/ctrlp/quickfix.vim +0 -62
- data/lib/utils/config/vim/autoload/ctrlp/rtscript.vim +0 -49
- data/lib/utils/config/vim/autoload/ctrlp/tag.vim +0 -112
- data/lib/utils/config/vim/autoload/ctrlp/undo.vim +0 -154
- data/lib/utils/config/vim/autoload/ctrlp/utils.vim +0 -72
- data/lib/utils/config/vim/autoload/ctrlp.vim +0 -1772
- data/lib/utils/config/vim/autoload/rails.vim +0 -4570
- data/lib/utils/config/vim/autoload/rubycomplete.vim +0 -801
- data/lib/utils/config/vim/autoload/sqlcomplete.vim +0 -741
- data/lib/utils/config/vim/autoload/vimball.vim +0 -750
- data/lib/utils/config/vim/colors/flori.vim +0 -116
- data/lib/utils/config/vim/compiler/coffee.vim +0 -68
- data/lib/utils/config/vim/compiler/eruby.vim +0 -40
- data/lib/utils/config/vim/compiler/ruby.vim +0 -67
- data/lib/utils/config/vim/compiler/rubyunit.vim +0 -34
- data/lib/utils/config/vim/doc/Decho.txt +0 -372
- data/lib/utils/config/vim/doc/coffee-script.txt +0 -116
- data/lib/utils/config/vim/doc/ctrlp.txt +0 -1113
- data/lib/utils/config/vim/doc/fugitive.txt +0 -257
- data/lib/utils/config/vim/doc/rails.txt +0 -1022
- data/lib/utils/config/vim/doc/xml-plugin.txt +0 -226
- data/lib/utils/config/vim/ftdetect/coffee.vim +0 -8
- data/lib/utils/config/vim/ftdetect/eco.vim +0 -1
- data/lib/utils/config/vim/ftdetect/ragel.vim +0 -2
- data/lib/utils/config/vim/ftdetect/ruby.vim +0 -17
- data/lib/utils/config/vim/ftdetect/slim.vim +0 -2
- data/lib/utils/config/vim/ftplugin/coffee.vim +0 -221
- data/lib/utils/config/vim/ftplugin/eruby.vim +0 -100
- data/lib/utils/config/vim/ftplugin/ruby.vim +0 -260
- data/lib/utils/config/vim/ftplugin/xml.vim +0 -941
- data/lib/utils/config/vim/indent/IndentAnything_html.vim +0 -35
- data/lib/utils/config/vim/indent/coffee.vim +0 -338
- data/lib/utils/config/vim/indent/eruby.vim +0 -77
- data/lib/utils/config/vim/indent/javascript.vim +0 -116
- data/lib/utils/config/vim/indent/ruby.vim +0 -377
- data/lib/utils/config/vim/indent/slim.vim +0 -75
- data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +0 -242
- data/lib/utils/config/vim/plugin/AlignPlugin.vim +0 -41
- data/lib/utils/config/vim/plugin/Decho.vim +0 -592
- data/lib/utils/config/vim/plugin/IndentAnything.vim +0 -675
- data/lib/utils/config/vim/plugin/bufexplorer.vim +0 -1144
- data/lib/utils/config/vim/plugin/cecutil.vim +0 -508
- data/lib/utils/config/vim/plugin/ctrlp.vim +0 -61
- data/lib/utils/config/vim/plugin/fugitive.vim +0 -2041
- data/lib/utils/config/vim/plugin/lusty-explorer.vim +0 -1509
- data/lib/utils/config/vim/plugin/rails.vim +0 -339
- data/lib/utils/config/vim/plugin/rubyextra.vim +0 -193
- data/lib/utils/config/vim/plugin/surround.vim +0 -628
- data/lib/utils/config/vim/plugin/taglist.vim +0 -4546
- data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +0 -131
- data/lib/utils/config/vim/plugin/vimballPlugin.vim +0 -40
- data/lib/utils/config/vim/syntax/Decho.vim +0 -101
- data/lib/utils/config/vim/syntax/coffee.vim +0 -217
- data/lib/utils/config/vim/syntax/eco.vim +0 -62
- data/lib/utils/config/vim/syntax/eruby.vim +0 -73
- data/lib/utils/config/vim/syntax/javascript.vim +0 -246
- data/lib/utils/config/vim/syntax/ragel.vim +0 -165
- data/lib/utils/config/vim/syntax/ruby.vim +0 -367
- data/lib/utils/config/vim/syntax/slim.vim +0 -117
- data/lib/utils/config/vimrc +0 -540
@@ -1,330 +0,0 @@
|
|
1
|
-
" AlignMaps.vim : support functions for AlignMaps
|
2
|
-
" Author: Charles E. Campbell, Jr.
|
3
|
-
" Date: Mar 03, 2009
|
4
|
-
" Version: 41
|
5
|
-
" ---------------------------------------------------------------------
|
6
|
-
" Load Once: {{{1
|
7
|
-
if &cp || exists("g:loaded_AlignMaps")
|
8
|
-
finish
|
9
|
-
endif
|
10
|
-
let g:loaded_AlignMaps= "v41"
|
11
|
-
let s:keepcpo = &cpo
|
12
|
-
set cpo&vim
|
13
|
-
|
14
|
-
" =====================================================================
|
15
|
-
" Functions: {{{1
|
16
|
-
|
17
|
-
" ---------------------------------------------------------------------
|
18
|
-
" AlignMaps#WrapperStart: {{{2
|
19
|
-
fun! AlignMaps#WrapperStart(vis) range
|
20
|
-
" call Dfunc("AlignMaps#WrapperStart(vis=".a:vis.")")
|
21
|
-
|
22
|
-
if a:vis
|
23
|
-
norm! '<ma'>
|
24
|
-
endif
|
25
|
-
|
26
|
-
if line("'y") == 0 || line("'z") == 0 || !exists("s:alignmaps_wrapcnt") || s:alignmaps_wrapcnt <= 0
|
27
|
-
" call Decho("wrapper initialization")
|
28
|
-
let s:alignmaps_wrapcnt = 1
|
29
|
-
let s:alignmaps_keepgd = &gdefault
|
30
|
-
let s:alignmaps_keepsearch = @/
|
31
|
-
let s:alignmaps_keepch = &ch
|
32
|
-
let s:alignmaps_keepmy = SaveMark("'y")
|
33
|
-
let s:alignmaps_keepmz = SaveMark("'z")
|
34
|
-
let s:alignmaps_posn = SaveWinPosn(0)
|
35
|
-
" set up fencepost blank lines
|
36
|
-
put =''
|
37
|
-
norm! mz'a
|
38
|
-
put! =''
|
39
|
-
ky
|
40
|
-
let s:alignmaps_zline = line("'z")
|
41
|
-
exe "'y,'zs/@/\177/ge"
|
42
|
-
else
|
43
|
-
" call Decho("embedded wrapper")
|
44
|
-
let s:alignmaps_wrapcnt = s:alignmaps_wrapcnt + 1
|
45
|
-
norm! 'yjma'zk
|
46
|
-
endif
|
47
|
-
|
48
|
-
" change some settings to align-standard values
|
49
|
-
set nogd
|
50
|
-
set ch=2
|
51
|
-
AlignPush
|
52
|
-
norm! 'zk
|
53
|
-
" call Dret("AlignMaps#WrapperStart : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
|
54
|
-
endfun
|
55
|
-
|
56
|
-
" ---------------------------------------------------------------------
|
57
|
-
" AlignMaps#WrapperEnd: {{{2
|
58
|
-
fun! AlignMaps#WrapperEnd() range
|
59
|
-
" call Dfunc("AlignMaps#WrapperEnd() alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
|
60
|
-
|
61
|
-
" remove trailing white space introduced by whatever in the modification zone
|
62
|
-
'y,'zs/ \+$//e
|
63
|
-
|
64
|
-
" restore AlignCtrl settings
|
65
|
-
AlignPop
|
66
|
-
|
67
|
-
let s:alignmaps_wrapcnt= s:alignmaps_wrapcnt - 1
|
68
|
-
if s:alignmaps_wrapcnt <= 0
|
69
|
-
" initial wrapper ending
|
70
|
-
exe "'y,'zs/\177/@/ge"
|
71
|
-
|
72
|
-
" if the 'z line hasn't moved, then go ahead and restore window position
|
73
|
-
let zstationary= s:alignmaps_zline == line("'z")
|
74
|
-
|
75
|
-
" remove fencepost blank lines.
|
76
|
-
" restore 'a
|
77
|
-
norm! 'yjmakdd'zdd
|
78
|
-
|
79
|
-
" restore original 'y, 'z, and window positioning
|
80
|
-
call RestoreMark(s:alignmaps_keepmy)
|
81
|
-
call RestoreMark(s:alignmaps_keepmz)
|
82
|
-
if zstationary > 0
|
83
|
-
call RestoreWinPosn(s:alignmaps_posn)
|
84
|
-
" call Decho("restored window positioning")
|
85
|
-
endif
|
86
|
-
|
87
|
-
" restoration of options
|
88
|
-
let &gd= s:alignmaps_keepgd
|
89
|
-
let &ch= s:alignmaps_keepch
|
90
|
-
let @/ = s:alignmaps_keepsearch
|
91
|
-
|
92
|
-
" remove script variables
|
93
|
-
unlet s:alignmaps_keepch
|
94
|
-
unlet s:alignmaps_keepsearch
|
95
|
-
unlet s:alignmaps_keepmy
|
96
|
-
unlet s:alignmaps_keepmz
|
97
|
-
unlet s:alignmaps_keepgd
|
98
|
-
unlet s:alignmaps_posn
|
99
|
-
endif
|
100
|
-
|
101
|
-
" call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
|
102
|
-
endfun
|
103
|
-
|
104
|
-
" ---------------------------------------------------------------------
|
105
|
-
" AlignMaps#StdAlign: some semi-standard align calls {{{2
|
106
|
-
fun! AlignMaps#StdAlign(mode) range
|
107
|
-
" call Dfunc("AlignMaps#StdAlign(mode=".a:mode.")")
|
108
|
-
if a:mode == 1
|
109
|
-
" align on @
|
110
|
-
" call Decho("align on @")
|
111
|
-
AlignCtrl mIp1P1=l @
|
112
|
-
'a,.Align
|
113
|
-
elseif a:mode == 2
|
114
|
-
" align on @, retaining all initial white space on each line
|
115
|
-
" call Decho("align on @, retaining all initial white space on each line")
|
116
|
-
AlignCtrl mWp1P1=l @
|
117
|
-
'a,.Align
|
118
|
-
elseif a:mode == 3
|
119
|
-
" like mode 2, but ignore /* */-style comments
|
120
|
-
" call Decho("like mode 2, but ignore /* */-style comments")
|
121
|
-
AlignCtrl v ^\s*/[/*]
|
122
|
-
AlignCtrl mWp1P1=l @
|
123
|
-
'a,.Align
|
124
|
-
else
|
125
|
-
echoerr "(AlignMaps) AlignMaps#StdAlign doesn't support mode#".a:mode
|
126
|
-
endif
|
127
|
-
" call Dret("AlignMaps#StdAlign")
|
128
|
-
endfun
|
129
|
-
|
130
|
-
" ---------------------------------------------------------------------
|
131
|
-
" AlignMaps#CharJoiner: joins lines which end in the given character (spaces {{{2
|
132
|
-
" at end are ignored)
|
133
|
-
fun! AlignMaps#CharJoiner(chr)
|
134
|
-
" call Dfunc("AlignMaps#CharJoiner(chr=".a:chr.")")
|
135
|
-
let aline = line("'a")
|
136
|
-
let rep = line(".") - aline
|
137
|
-
while rep > 0
|
138
|
-
norm! 'a
|
139
|
-
while match(getline(aline),a:chr . "\s*$") != -1 && rep >= 0
|
140
|
-
" while = at end-of-line, delete it and join with next
|
141
|
-
norm! 'a$
|
142
|
-
j!
|
143
|
-
let rep = rep - 1
|
144
|
-
endwhile
|
145
|
-
" update rep(eat) count
|
146
|
-
let rep = rep - 1
|
147
|
-
if rep <= 0
|
148
|
-
" terminate loop if at end-of-block
|
149
|
-
break
|
150
|
-
endif
|
151
|
-
" prepare for next line
|
152
|
-
norm! jma
|
153
|
-
let aline = line("'a")
|
154
|
-
endwhile
|
155
|
-
" call Dret("AlignMaps#CharJoiner")
|
156
|
-
endfun
|
157
|
-
|
158
|
-
" ---------------------------------------------------------------------
|
159
|
-
" AlignMaps#Equals: supports \t= and \T= {{{2
|
160
|
-
fun! AlignMaps#Equals() range
|
161
|
-
" call Dfunc("AlignMaps#Equals()")
|
162
|
-
'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e
|
163
|
-
'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge
|
164
|
-
'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
|
165
|
-
'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge
|
166
|
-
norm g'zk
|
167
|
-
AlignCtrl mIp1P1=l =
|
168
|
-
AlignCtrl g =
|
169
|
-
'a,'z-1Align
|
170
|
-
'a,'z-1s@\([*/+\-%|&\~^!=]\)\( \+\)=@\2\1=@ge
|
171
|
-
'a,'z-1s/\( \+\);/;\1/ge
|
172
|
-
if &ft == "c" || &ft == "cpp"
|
173
|
-
" call Decho("exception for ".&ft)
|
174
|
-
'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e
|
175
|
-
'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e
|
176
|
-
if exists("g:mapleader")
|
177
|
-
exe "norm 'zk"
|
178
|
-
call AlignMaps#StdAlign(1)
|
179
|
-
else
|
180
|
-
exe "norm 'zk"
|
181
|
-
call AlignMaps#StdAlign(1)
|
182
|
-
endif
|
183
|
-
'y,'zs/^\(\s*\) @/\1/e
|
184
|
-
endif
|
185
|
-
'a,'z-1s/\%x0f/=/ge
|
186
|
-
'y,'zs/ @//eg
|
187
|
-
" call Dret("AlignMaps#Equals")
|
188
|
-
endfun
|
189
|
-
|
190
|
-
" ---------------------------------------------------------------------
|
191
|
-
" AlignMaps#Afnc: useful for splitting one-line function beginnings {{{2
|
192
|
-
" into one line per argument format
|
193
|
-
fun! AlignMaps#Afnc()
|
194
|
-
" call Dfunc("AlignMaps#Afnc()")
|
195
|
-
|
196
|
-
" keep display quiet
|
197
|
-
let chkeep = &ch
|
198
|
-
let gdkeep = &gd
|
199
|
-
let vekeep = &ve
|
200
|
-
set ch=2 nogd ve=
|
201
|
-
|
202
|
-
" will use marks y,z ; save current values
|
203
|
-
let mykeep = SaveMark("'y")
|
204
|
-
let mzkeep = SaveMark("'z")
|
205
|
-
|
206
|
-
" Find beginning of function -- be careful to skip over comments
|
207
|
-
let cmmntid = synIDtrans(hlID("Comment"))
|
208
|
-
let stringid = synIDtrans(hlID("String"))
|
209
|
-
exe "norm! ]]"
|
210
|
-
while search(")","bW") != 0
|
211
|
-
" call Decho("line=".line(".")." col=".col("."))
|
212
|
-
let parenid= synIDtrans(synID(line("."),col("."),1))
|
213
|
-
if parenid != cmmntid && parenid != stringid
|
214
|
-
break
|
215
|
-
endif
|
216
|
-
endwhile
|
217
|
-
norm! %my
|
218
|
-
s/(\s*\(\S\)/(\r \1/e
|
219
|
-
exe "norm! `y%"
|
220
|
-
s/)\s*\(\/[*/]\)/)\r\1/e
|
221
|
-
exe "norm! `y%mz"
|
222
|
-
'y,'zs/\s\+$//e
|
223
|
-
'y,'zs/^\s\+//e
|
224
|
-
'y+1,'zs/^/ /
|
225
|
-
|
226
|
-
" insert newline after every comma only one parenthesis deep
|
227
|
-
sil! exe "norm! `y\<right>h"
|
228
|
-
let parens = 1
|
229
|
-
let cmmnt = 0
|
230
|
-
let cmmntline= -1
|
231
|
-
while parens >= 1
|
232
|
-
" call Decho("parens=".parens." @a=".@a)
|
233
|
-
exe 'norm! ma "ay`a '
|
234
|
-
if @a == "("
|
235
|
-
let parens= parens + 1
|
236
|
-
elseif @a == ")"
|
237
|
-
let parens= parens - 1
|
238
|
-
|
239
|
-
" comment bypass: /* ... */ or //...
|
240
|
-
elseif cmmnt == 0 && @a == '/'
|
241
|
-
let cmmnt= 1
|
242
|
-
elseif cmmnt == 1
|
243
|
-
if @a == '/'
|
244
|
-
let cmmnt = 2 " //...
|
245
|
-
let cmmntline= line(".")
|
246
|
-
elseif @a == '*'
|
247
|
-
let cmmnt= 3 " /*...
|
248
|
-
else
|
249
|
-
let cmmnt= 0
|
250
|
-
endif
|
251
|
-
elseif cmmnt == 2 && line(".") != cmmntline
|
252
|
-
let cmmnt = 0
|
253
|
-
let cmmntline= -1
|
254
|
-
elseif cmmnt == 3 && @a == '*'
|
255
|
-
let cmmnt= 4
|
256
|
-
elseif cmmnt == 4
|
257
|
-
if @a == '/'
|
258
|
-
let cmmnt= 0 " ...*/
|
259
|
-
elseif @a != '*'
|
260
|
-
let cmmnt= 3
|
261
|
-
endif
|
262
|
-
|
263
|
-
elseif @a == "," && parens == 1 && cmmnt == 0
|
264
|
-
exe "norm! i\<CR>\<Esc>"
|
265
|
-
endif
|
266
|
-
endwhile
|
267
|
-
norm! `y%mz%
|
268
|
-
sil! 'y,'zg/^\s*$/d
|
269
|
-
|
270
|
-
" perform substitutes to mark fields for Align
|
271
|
-
sil! 'y+1,'zv/^\//s/^\s\+\(\S\)/ \1/e
|
272
|
-
sil! 'y+1,'zv/^\//s/\(\S\)\s\+/\1 /eg
|
273
|
-
sil! 'y+1,'zv/^\//s/\* \+/*/ge
|
274
|
-
sil! 'y+1,'zv/^\//s/\w\zs\s*\*/ */ge
|
275
|
-
" func
|
276
|
-
" ws <- declaration -> <-ptr -> <-var-> <-[array][] -> <-glop-> <-end->
|
277
|
-
sil! 'y+1,'zv/^\//s/^\s*\(\(\K\k*\s*\)\+\)\s\+\([(*]*\)\s*\(\K\k*\)\s*\(\(\[.\{-}]\)*\)\s*\(.\{-}\)\=\s*\([,)]\)\s*$/ \1@#\3@\4\5@\7\8/e
|
278
|
-
sil! 'y+1,'z+1g/^\s*\/[*/]/norm! kJ
|
279
|
-
sil! 'y+1,'z+1s%/[*/]%@&@%ge
|
280
|
-
sil! 'y+1,'z+1s%*/%@&%ge
|
281
|
-
AlignCtrl mIp0P0=l @
|
282
|
-
sil! 'y+1,'zAlign
|
283
|
-
sil! 'y,'zs%@\(/[*/]\)@%\t\1 %e
|
284
|
-
sil! 'y,'zs%@\*/% */%e
|
285
|
-
sil! 'y,'zs/@\([,)]\)/\1/
|
286
|
-
sil! 'y,'zs/@/ /
|
287
|
-
AlignCtrl mIlrp0P0= # @
|
288
|
-
sil! 'y+1,'zAlign
|
289
|
-
sil! 'y+1,'zs/#/ /
|
290
|
-
sil! 'y+1,'zs/@//
|
291
|
-
sil! 'y+1,'zs/\(\s\+\)\([,)]\)/\2\1/e
|
292
|
-
|
293
|
-
" Restore
|
294
|
-
call RestoreMark(mykeep)
|
295
|
-
call RestoreMark(mzkeep)
|
296
|
-
let &ch= chkeep
|
297
|
-
let &gd= gdkeep
|
298
|
-
let &ve= vekeep
|
299
|
-
|
300
|
-
" call Dret("AlignMaps#Afnc")
|
301
|
-
endfun
|
302
|
-
|
303
|
-
" ---------------------------------------------------------------------
|
304
|
-
" AlignMaps#FixMultiDec: converts a type arg,arg,arg; line to multiple lines {{{2
|
305
|
-
fun! AlignMaps#FixMultiDec()
|
306
|
-
" call Dfunc("AlignMaps#FixMultiDec()")
|
307
|
-
|
308
|
-
" save register x
|
309
|
-
let xkeep = @x
|
310
|
-
let curline = getline(".")
|
311
|
-
" call Decho("curline<".curline.">")
|
312
|
-
|
313
|
-
" Get the type. I'm assuming one type per line (ie. int x; double y; on one line will not be handled properly)
|
314
|
-
let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9_ \t]*\)\s\+[(*]*\h.*$','\1','')
|
315
|
-
" call Decho("@x<".@x.">")
|
316
|
-
|
317
|
-
" transform line
|
318
|
-
exe 's/,/;\r'.@x.' /ge'
|
319
|
-
|
320
|
-
"restore register x
|
321
|
-
let @x= xkeep
|
322
|
-
|
323
|
-
" call Dret("AlignMaps#FixMultiDec : my=".line("'y")." mz=".line("'z"))
|
324
|
-
endfun
|
325
|
-
|
326
|
-
" ---------------------------------------------------------------------
|
327
|
-
" Restore: {{{1
|
328
|
-
let &cpo= s:keepcpo
|
329
|
-
unlet s:keepcpo
|
330
|
-
" vim: ts=4 fdm=marker
|
@@ -1,139 +0,0 @@
|
|
1
|
-
" =============================================================================
|
2
|
-
" File: autoload/ctrlp/bookmarkdir.vim
|
3
|
-
" Description: Bookmarked directories extension
|
4
|
-
" Author: Kien Nguyen <github.com/kien>
|
5
|
-
" =============================================================================
|
6
|
-
|
7
|
-
" Init {{{1
|
8
|
-
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
9
|
-
fini
|
10
|
-
en
|
11
|
-
let g:loaded_ctrlp_bookmarkdir = 1
|
12
|
-
|
13
|
-
cal add(g:ctrlp_ext_vars, {
|
14
|
-
\ 'init': 'ctrlp#bookmarkdir#init()',
|
15
|
-
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
16
|
-
\ 'lname': 'bookmarked dirs',
|
17
|
-
\ 'sname': 'bkd',
|
18
|
-
\ 'type': 'tabs',
|
19
|
-
\ 'opmul': 1,
|
20
|
-
\ 'nolim': 1,
|
21
|
-
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
22
|
-
\ })
|
23
|
-
|
24
|
-
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
25
|
-
" Utilities {{{1
|
26
|
-
fu! s:getinput(str, ...)
|
27
|
-
echoh Identifier
|
28
|
-
cal inputsave()
|
29
|
-
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
30
|
-
cal inputrestore()
|
31
|
-
echoh None
|
32
|
-
retu input
|
33
|
-
endf
|
34
|
-
|
35
|
-
fu! s:cachefile()
|
36
|
-
if !exists('s:cadir') || !exists('s:cafile')
|
37
|
-
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
38
|
-
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
39
|
-
en
|
40
|
-
retu s:cafile
|
41
|
-
endf
|
42
|
-
|
43
|
-
fu! s:writecache(lines)
|
44
|
-
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
45
|
-
endf
|
46
|
-
|
47
|
-
fu! s:getbookmarks()
|
48
|
-
retu ctrlp#utils#readfile(s:cachefile())
|
49
|
-
endf
|
50
|
-
|
51
|
-
fu! s:savebookmark(name, cwd)
|
52
|
-
let entries = filter(s:getbookmarks(), 's:parts(v:val)[1] != a:cwd')
|
53
|
-
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
54
|
-
endf
|
55
|
-
|
56
|
-
fu! s:setentries()
|
57
|
-
let time = getftime(s:cachefile())
|
58
|
-
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
59
|
-
let s:bookmarks = [time, s:getbookmarks()]
|
60
|
-
en
|
61
|
-
endf
|
62
|
-
|
63
|
-
fu! s:parts(str)
|
64
|
-
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
65
|
-
retu mlist != [] ? mlist[1:2] : ['', '']
|
66
|
-
endf
|
67
|
-
|
68
|
-
fu! s:process(entries, type)
|
69
|
-
retu map(a:entries, 's:modify(v:val, a:type)')
|
70
|
-
endf
|
71
|
-
|
72
|
-
fu! s:modify(entry, type)
|
73
|
-
let [name, dir] = s:parts(a:entry)
|
74
|
-
let dir = fnamemodify(dir, a:type)
|
75
|
-
retu name.' '.( dir == '' ? '.' : dir )
|
76
|
-
endf
|
77
|
-
|
78
|
-
fu! s:msg(name, cwd)
|
79
|
-
redr
|
80
|
-
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
81
|
-
echon a:name.' ' | echoh Directory | echon a:cwd
|
82
|
-
echoh None
|
83
|
-
endf
|
84
|
-
|
85
|
-
fu! s:syntax()
|
86
|
-
if !ctrlp#nosy()
|
87
|
-
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
88
|
-
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
89
|
-
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
90
|
-
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
91
|
-
en
|
92
|
-
endf
|
93
|
-
" Public {{{1
|
94
|
-
fu! ctrlp#bookmarkdir#init()
|
95
|
-
cal s:setentries()
|
96
|
-
cal s:syntax()
|
97
|
-
retu s:process(copy(s:bookmarks[1]), ':.')
|
98
|
-
endf
|
99
|
-
|
100
|
-
fu! ctrlp#bookmarkdir#accept(mode, str)
|
101
|
-
let parts = s:parts(s:modify(a:str, ':p'))
|
102
|
-
cal call('s:savebookmark', parts)
|
103
|
-
if a:mode =~ 't\|v\|h'
|
104
|
-
cal ctrlp#exit()
|
105
|
-
en
|
106
|
-
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
107
|
-
if a:mode == 'e'
|
108
|
-
cal ctrlp#switchtype(0)
|
109
|
-
cal ctrlp#recordhist()
|
110
|
-
cal ctrlp#prtclear()
|
111
|
-
en
|
112
|
-
endf
|
113
|
-
|
114
|
-
fu! ctrlp#bookmarkdir#add(dir)
|
115
|
-
let str = 'Directory to bookmark: '
|
116
|
-
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
117
|
-
if cwd == '' | retu | en
|
118
|
-
let cwd = fnamemodify(cwd, ':p')
|
119
|
-
let name = s:getinput('Bookmark as: ', cwd)
|
120
|
-
if name == '' | retu | en
|
121
|
-
let name = tr(name, ' ', ' ')
|
122
|
-
cal s:savebookmark(name, cwd)
|
123
|
-
cal s:msg(name, cwd)
|
124
|
-
endf
|
125
|
-
|
126
|
-
fu! ctrlp#bookmarkdir#remove(entries)
|
127
|
-
cal s:process(a:entries, ':p')
|
128
|
-
cal s:writecache(a:entries == [] ? [] :
|
129
|
-
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
130
|
-
cal s:setentries()
|
131
|
-
retu s:process(copy(s:bookmarks[1]), ':.')
|
132
|
-
endf
|
133
|
-
|
134
|
-
fu! ctrlp#bookmarkdir#id()
|
135
|
-
retu s:id
|
136
|
-
endf
|
137
|
-
"}}}
|
138
|
-
|
139
|
-
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
@@ -1,238 +0,0 @@
|
|
1
|
-
" =============================================================================
|
2
|
-
" File: autoload/ctrlp/buffertag.vim
|
3
|
-
" Description: Buffer Tag extension
|
4
|
-
" Maintainer: Kien Nguyen <github.com/kien>
|
5
|
-
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
|
6
|
-
" a few lines from taglist.vim by Yegappan Lakshmanan and from
|
7
|
-
" buffertag.vim by Takeshi Nishida.
|
8
|
-
" =============================================================================
|
9
|
-
|
10
|
-
" Init {{{1
|
11
|
-
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
12
|
-
fini
|
13
|
-
en
|
14
|
-
let g:loaded_ctrlp_buftag = 1
|
15
|
-
|
16
|
-
cal add(g:ctrlp_ext_vars, {
|
17
|
-
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
18
|
-
\ 'accept': 'ctrlp#buffertag#accept',
|
19
|
-
\ 'lname': 'buffer tags',
|
20
|
-
\ 'sname': 'bft',
|
21
|
-
\ 'exit': 'ctrlp#buffertag#exit()',
|
22
|
-
\ 'type': 'tabs',
|
23
|
-
\ 'opts': 'ctrlp#buffertag#opts()',
|
24
|
-
\ })
|
25
|
-
|
26
|
-
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
27
|
-
|
28
|
-
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
29
|
-
\ 'systemenc': ['s:enc', &enc],
|
30
|
-
\ 'ctags_bin': ['s:bin', ''],
|
31
|
-
\ 'types': ['s:usr_types', {}],
|
32
|
-
\ }]
|
33
|
-
|
34
|
-
let s:bins = [
|
35
|
-
\ 'ctags-exuberant',
|
36
|
-
\ 'exuberant-ctags',
|
37
|
-
\ 'exctags',
|
38
|
-
\ '/usr/local/bin/ctags',
|
39
|
-
\ '/opt/local/bin/ctags',
|
40
|
-
\ 'ctags',
|
41
|
-
\ 'ctags.exe',
|
42
|
-
\ 'tags',
|
43
|
-
\ ]
|
44
|
-
|
45
|
-
let s:types = {
|
46
|
-
\ 'asm' : '%sasm%sasm%sdlmt',
|
47
|
-
\ 'aspperl': '%sasp%sasp%sfsv',
|
48
|
-
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
49
|
-
\ 'awk' : '%sawk%sawk%sf',
|
50
|
-
\ 'beta' : '%sbeta%sbeta%sfsv',
|
51
|
-
\ 'c' : '%sc%sc%sdgsutvf',
|
52
|
-
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
53
|
-
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
54
|
-
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
55
|
-
\ 'eiffel' : '%seiffel%seiffel%scf',
|
56
|
-
\ 'erlang' : '%serlang%serlang%sdrmf',
|
57
|
-
\ 'expect' : '%stcl%stcl%scfp',
|
58
|
-
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
59
|
-
\ 'html' : '%shtml%shtml%saf',
|
60
|
-
\ 'java' : '%sjava%sjava%spcifm',
|
61
|
-
\ 'javascript': '%sjavascript%sjavascript%sf',
|
62
|
-
\ 'lisp' : '%slisp%slisp%sf',
|
63
|
-
\ 'lua' : '%slua%slua%sf',
|
64
|
-
\ 'make' : '%smake%smake%sm',
|
65
|
-
\ 'pascal' : '%spascal%spascal%sfp',
|
66
|
-
\ 'perl' : '%sperl%sperl%sclps',
|
67
|
-
\ 'php' : '%sphp%sphp%scdvf',
|
68
|
-
\ 'python' : '%spython%spython%scmf',
|
69
|
-
\ 'rexx' : '%srexx%srexx%ss',
|
70
|
-
\ 'ruby' : '%sruby%sruby%scfFm',
|
71
|
-
\ 'scheme' : '%sscheme%sscheme%ssf',
|
72
|
-
\ 'sh' : '%ssh%ssh%sf',
|
73
|
-
\ 'csh' : '%ssh%ssh%sf',
|
74
|
-
\ 'zsh' : '%ssh%ssh%sf',
|
75
|
-
\ 'slang' : '%sslang%sslang%snf',
|
76
|
-
\ 'sml' : '%ssml%ssml%secsrtvf',
|
77
|
-
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
78
|
-
\ 'tcl' : '%stcl%stcl%scfmp',
|
79
|
-
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
80
|
-
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
81
|
-
\ 'vim' : '%svim%svim%savf',
|
82
|
-
\ 'yacc' : '%syacc%syacc%sl',
|
83
|
-
\ }
|
84
|
-
|
85
|
-
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
|
86
|
-
|
87
|
-
if executable('jsctags')
|
88
|
-
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
89
|
-
en
|
90
|
-
|
91
|
-
fu! ctrlp#buffertag#opts()
|
92
|
-
for [ke, va] in items(s:opts)
|
93
|
-
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
94
|
-
endfo
|
95
|
-
" Ctags bin
|
96
|
-
if empty(s:bin)
|
97
|
-
for bin in s:bins | if executable(bin)
|
98
|
-
let s:bin = bin
|
99
|
-
brea
|
100
|
-
en | endfo
|
101
|
-
el
|
102
|
-
let s:bin = expand(s:bin, 1)
|
103
|
-
en
|
104
|
-
" Types
|
105
|
-
cal extend(s:types, s:usr_types)
|
106
|
-
endf
|
107
|
-
" Utilities {{{1
|
108
|
-
fu! s:validfile(fname, ftype)
|
109
|
-
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
110
|
-
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
|
111
|
-
retu 0
|
112
|
-
endf
|
113
|
-
|
114
|
-
fu! s:exectags(cmd)
|
115
|
-
if exists('+ssl')
|
116
|
-
let [ssl, &ssl] = [&ssl, 0]
|
117
|
-
en
|
118
|
-
if &sh =~ 'cmd\.exe'
|
119
|
-
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
|
120
|
-
en
|
121
|
-
let output = system(a:cmd)
|
122
|
-
if &sh =~ 'cmd\.exe'
|
123
|
-
let [&sxq, &shcf] = [sxq, shcf]
|
124
|
-
en
|
125
|
-
if exists('+ssl')
|
126
|
-
let &ssl = ssl
|
127
|
-
en
|
128
|
-
retu output
|
129
|
-
endf
|
130
|
-
|
131
|
-
fu! s:exectagsonfile(fname, ftype)
|
132
|
-
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
|
133
|
-
if type(s:types[ft]) == 1
|
134
|
-
let ags .= s:types[ft]
|
135
|
-
let bin = s:bin
|
136
|
-
elsei type(s:types[ft]) == 4
|
137
|
-
let ags = s:types[ft]['args']
|
138
|
-
let bin = expand(s:types[ft]['bin'], 1)
|
139
|
-
en
|
140
|
-
if empty(bin) | retu '' | en
|
141
|
-
let cmd = s:esctagscmd(bin, ags, a:fname)
|
142
|
-
if empty(cmd) | retu '' | en
|
143
|
-
let output = s:exectags(cmd)
|
144
|
-
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
|
145
|
-
retu output
|
146
|
-
endf
|
147
|
-
|
148
|
-
fu! s:esctagscmd(bin, args, ...)
|
149
|
-
if exists('+ssl')
|
150
|
-
let [ssl, &ssl] = [&ssl, 0]
|
151
|
-
en
|
152
|
-
let fname = a:0 == 1 ? shellescape(a:1) : ''
|
153
|
-
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
154
|
-
if exists('+ssl')
|
155
|
-
let &ssl = ssl
|
156
|
-
en
|
157
|
-
if has('iconv')
|
158
|
-
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
|
159
|
-
let cmd = iconv(cmd, &enc, last)
|
160
|
-
en
|
161
|
-
retu cmd
|
162
|
-
endf
|
163
|
-
|
164
|
-
fu! s:process(fname, ftype)
|
165
|
-
if !s:validfile(a:fname, a:ftype) | retu [] | endif
|
166
|
-
let ftime = getftime(a:fname)
|
167
|
-
if has_key(g:ctrlp_buftags, a:fname)
|
168
|
-
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
|
169
|
-
let lines = g:ctrlp_buftags[a:fname]['lines']
|
170
|
-
el
|
171
|
-
let data = s:exectagsonfile(a:fname, a:ftype)
|
172
|
-
let [raw, lines] = [split(data, '\n\+'), []]
|
173
|
-
for line in raw | if len(split(line, ';"')) == 2
|
174
|
-
let parsed_line = s:parseline(line)
|
175
|
-
if parsed_line != ''
|
176
|
-
cal add(lines, parsed_line)
|
177
|
-
en
|
178
|
-
en | endfo
|
179
|
-
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
|
180
|
-
cal extend(g:ctrlp_buftags, cache)
|
181
|
-
en
|
182
|
-
retu lines
|
183
|
-
endf
|
184
|
-
|
185
|
-
fu! s:parseline(line)
|
186
|
-
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
|
187
|
-
let vals = matchlist(a:line, eval)
|
188
|
-
if vals == [] | retu '' | en
|
189
|
-
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
190
|
-
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
191
|
-
endf
|
192
|
-
|
193
|
-
fu! s:syntax()
|
194
|
-
if !ctrlp#nosy()
|
195
|
-
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
196
|
-
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
197
|
-
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
198
|
-
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
199
|
-
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
200
|
-
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
201
|
-
en
|
202
|
-
endf
|
203
|
-
" Public {{{1
|
204
|
-
fu! ctrlp#buffertag#init(fname)
|
205
|
-
let bufs = exists('s:btmode') && s:btmode
|
206
|
-
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')
|
207
|
-
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
208
|
-
let lines = []
|
209
|
-
for each in bufs
|
210
|
-
let bname = fnamemodify(each, ':p')
|
211
|
-
let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '')
|
212
|
-
cal extend(lines, s:process(bname, tftype))
|
213
|
-
endfo
|
214
|
-
cal s:syntax()
|
215
|
-
retu lines
|
216
|
-
endf
|
217
|
-
|
218
|
-
fu! ctrlp#buffertag#accept(mode, str)
|
219
|
-
let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
|
220
|
-
if vals == [] | retu | en
|
221
|
-
let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]]
|
222
|
-
cal ctrlp#acceptfile(a:mode, bufnm, linenr)
|
223
|
-
endf
|
224
|
-
|
225
|
-
fu! ctrlp#buffertag#cmd(mode, ...)
|
226
|
-
let s:btmode = a:mode
|
227
|
-
if a:0 && !empty(a:1)
|
228
|
-
let s:bufname = fnamemodify(a:1, ':p')
|
229
|
-
en
|
230
|
-
retu s:id
|
231
|
-
endf
|
232
|
-
|
233
|
-
fu! ctrlp#buffertag#exit()
|
234
|
-
unl! s:btmode s:bufname
|
235
|
-
endf
|
236
|
-
"}}}
|
237
|
-
|
238
|
-
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|