utils 0.0.67 → 0.0.68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/VERSION +1 -1
  2. data/bin/edit +3 -1
  3. data/lib/utils/editor.rb +14 -0
  4. data/lib/utils/version.rb +1 -1
  5. data/utils.gemspec +3 -3
  6. metadata +3 -74
  7. data/lib/utils/config/vim/after/syntax/haml.vim +0 -9
  8. data/lib/utils/config/vim/after/syntax/html.vim +0 -11
  9. data/lib/utils/config/vim/autoload/Align.vim +0 -1029
  10. data/lib/utils/config/vim/autoload/AlignMaps.vim +0 -330
  11. data/lib/utils/config/vim/autoload/ctrlp/bookmarkdir.vim +0 -139
  12. data/lib/utils/config/vim/autoload/ctrlp/buffertag.vim +0 -238
  13. data/lib/utils/config/vim/autoload/ctrlp/changes.vim +0 -96
  14. data/lib/utils/config/vim/autoload/ctrlp/dir.vim +0 -90
  15. data/lib/utils/config/vim/autoload/ctrlp/line.vim +0 -63
  16. data/lib/utils/config/vim/autoload/ctrlp/mixed.vim +0 -83
  17. data/lib/utils/config/vim/autoload/ctrlp/mrufiles.vim +0 -119
  18. data/lib/utils/config/vim/autoload/ctrlp/quickfix.vim +0 -62
  19. data/lib/utils/config/vim/autoload/ctrlp/rtscript.vim +0 -49
  20. data/lib/utils/config/vim/autoload/ctrlp/tag.vim +0 -112
  21. data/lib/utils/config/vim/autoload/ctrlp/undo.vim +0 -154
  22. data/lib/utils/config/vim/autoload/ctrlp/utils.vim +0 -72
  23. data/lib/utils/config/vim/autoload/ctrlp.vim +0 -1772
  24. data/lib/utils/config/vim/autoload/rails.vim +0 -4570
  25. data/lib/utils/config/vim/autoload/rubycomplete.vim +0 -801
  26. data/lib/utils/config/vim/autoload/sqlcomplete.vim +0 -741
  27. data/lib/utils/config/vim/autoload/vimball.vim +0 -750
  28. data/lib/utils/config/vim/colors/flori.vim +0 -116
  29. data/lib/utils/config/vim/compiler/coffee.vim +0 -68
  30. data/lib/utils/config/vim/compiler/eruby.vim +0 -40
  31. data/lib/utils/config/vim/compiler/ruby.vim +0 -67
  32. data/lib/utils/config/vim/compiler/rubyunit.vim +0 -34
  33. data/lib/utils/config/vim/doc/Decho.txt +0 -372
  34. data/lib/utils/config/vim/doc/coffee-script.txt +0 -116
  35. data/lib/utils/config/vim/doc/ctrlp.txt +0 -1113
  36. data/lib/utils/config/vim/doc/fugitive.txt +0 -257
  37. data/lib/utils/config/vim/doc/rails.txt +0 -1022
  38. data/lib/utils/config/vim/doc/xml-plugin.txt +0 -226
  39. data/lib/utils/config/vim/ftdetect/coffee.vim +0 -8
  40. data/lib/utils/config/vim/ftdetect/eco.vim +0 -1
  41. data/lib/utils/config/vim/ftdetect/ragel.vim +0 -2
  42. data/lib/utils/config/vim/ftdetect/ruby.vim +0 -17
  43. data/lib/utils/config/vim/ftdetect/slim.vim +0 -2
  44. data/lib/utils/config/vim/ftplugin/coffee.vim +0 -221
  45. data/lib/utils/config/vim/ftplugin/eruby.vim +0 -100
  46. data/lib/utils/config/vim/ftplugin/ruby.vim +0 -260
  47. data/lib/utils/config/vim/ftplugin/xml.vim +0 -941
  48. data/lib/utils/config/vim/indent/IndentAnything_html.vim +0 -35
  49. data/lib/utils/config/vim/indent/coffee.vim +0 -338
  50. data/lib/utils/config/vim/indent/eruby.vim +0 -77
  51. data/lib/utils/config/vim/indent/javascript.vim +0 -116
  52. data/lib/utils/config/vim/indent/ruby.vim +0 -377
  53. data/lib/utils/config/vim/indent/slim.vim +0 -75
  54. data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +0 -242
  55. data/lib/utils/config/vim/plugin/AlignPlugin.vim +0 -41
  56. data/lib/utils/config/vim/plugin/Decho.vim +0 -592
  57. data/lib/utils/config/vim/plugin/IndentAnything.vim +0 -675
  58. data/lib/utils/config/vim/plugin/bufexplorer.vim +0 -1144
  59. data/lib/utils/config/vim/plugin/cecutil.vim +0 -508
  60. data/lib/utils/config/vim/plugin/ctrlp.vim +0 -61
  61. data/lib/utils/config/vim/plugin/fugitive.vim +0 -2041
  62. data/lib/utils/config/vim/plugin/lusty-explorer.vim +0 -1509
  63. data/lib/utils/config/vim/plugin/rails.vim +0 -339
  64. data/lib/utils/config/vim/plugin/rubyextra.vim +0 -193
  65. data/lib/utils/config/vim/plugin/surround.vim +0 -628
  66. data/lib/utils/config/vim/plugin/taglist.vim +0 -4546
  67. data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +0 -131
  68. data/lib/utils/config/vim/plugin/vimballPlugin.vim +0 -40
  69. data/lib/utils/config/vim/syntax/Decho.vim +0 -101
  70. data/lib/utils/config/vim/syntax/coffee.vim +0 -217
  71. data/lib/utils/config/vim/syntax/eco.vim +0 -62
  72. data/lib/utils/config/vim/syntax/eruby.vim +0 -73
  73. data/lib/utils/config/vim/syntax/javascript.vim +0 -246
  74. data/lib/utils/config/vim/syntax/ragel.vim +0 -165
  75. data/lib/utils/config/vim/syntax/ruby.vim +0 -367
  76. data/lib/utils/config/vim/syntax/slim.vim +0 -117
  77. data/lib/utils/config/vimrc +0 -540
@@ -1,508 +0,0 @@
1
- " cecutil.vim : save/restore window position
2
- " save/restore mark position
3
- " save/restore selected user maps
4
- " Author: Charles E. Campbell, Jr.
5
- " Version: 18b ASTRO-ONLY
6
- " Date: Aug 27, 2008
7
- "
8
- " Saving Restoring Destroying Marks: {{{1
9
- " call SaveMark(markname) let savemark= SaveMark(markname)
10
- " call RestoreMark(markname) call RestoreMark(savemark)
11
- " call DestroyMark(markname)
12
- " commands: SM RM DM
13
- "
14
- " Saving Restoring Destroying Window Position: {{{1
15
- " call SaveWinPosn() let winposn= SaveWinPosn()
16
- " call RestoreWinPosn() call RestoreWinPosn(winposn)
17
- " \swp : save current window/buffer's position
18
- " \rwp : restore current window/buffer's previous position
19
- " commands: SWP RWP
20
- "
21
- " Saving And Restoring User Maps: {{{1
22
- " call SaveUserMaps(mapmode,maplead,mapchx,suffix)
23
- " call RestoreUserMaps(suffix)
24
- "
25
- " GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
26
- "
27
- " You believe that God is one. You do well. The demons also {{{1
28
- " believe, and shudder. But do you want to know, vain man, that
29
- " faith apart from works is dead? (James 2:19,20 WEB)
30
-
31
- " ---------------------------------------------------------------------
32
- " Load Once: {{{1
33
- if &cp || exists("g:loaded_cecutil")
34
- finish
35
- endif
36
- let g:loaded_cecutil = "v18b"
37
- let s:keepcpo = &cpo
38
- set cpo&vim
39
- "DechoTabOn
40
-
41
- " =======================
42
- " Public Interface: {{{1
43
- " =======================
44
-
45
- " ---------------------------------------------------------------------
46
- " Map Interface: {{{2
47
- if !hasmapto('<Plug>SaveWinPosn')
48
- map <unique> <Leader>swp <Plug>SaveWinPosn
49
- endif
50
- if !hasmapto('<Plug>RestoreWinPosn')
51
- map <unique> <Leader>rwp <Plug>RestoreWinPosn
52
- endif
53
- nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
54
- nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
55
-
56
- " ---------------------------------------------------------------------
57
- " Command Interface: {{{2
58
- com! -bar -nargs=0 SWP call SaveWinPosn()
59
- com! -bar -nargs=0 RWP call RestoreWinPosn()
60
- com! -bar -nargs=1 SM call SaveMark(<q-args>)
61
- com! -bar -nargs=1 RM call RestoreMark(<q-args>)
62
- com! -bar -nargs=1 DM call DestroyMark(<q-args>)
63
-
64
- if v:version < 630
65
- let s:modifier= "sil "
66
- else
67
- let s:modifier= "sil keepj "
68
- endif
69
-
70
- " ===============
71
- " Functions: {{{1
72
- " ===============
73
-
74
- " ---------------------------------------------------------------------
75
- " SaveWinPosn: {{{2
76
- " let winposn= SaveWinPosn() will save window position in winposn variable
77
- " call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
78
- " let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
79
- fun! SaveWinPosn(...)
80
- " call Dfunc("SaveWinPosn() a:0=".a:0)
81
- if line(".") == 1 && getline(1) == ""
82
- " call Dfunc("SaveWinPosn : empty buffer")
83
- return ""
84
- endif
85
- let so_keep = &l:so
86
- let siso_keep = &l:siso
87
- let ss_keep = &l:ss
88
- setlocal so=0 siso=0 ss=0
89
-
90
- let swline = line(".")
91
- let swcol = col(".")
92
- let swwline = winline() - 1
93
- let swwcol = virtcol(".") - wincol()
94
- let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
95
- let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
96
- if swwline > 0
97
- let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
98
- endif
99
- if swwcol > 0
100
- let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
101
- endif
102
- let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
103
-
104
- " save window position in
105
- " b:cecutil_winposn_{iwinposn} (stack)
106
- " only when SaveWinPosn() is used
107
- if a:0 == 0
108
- if !exists("b:cecutil_iwinposn")
109
- let b:cecutil_iwinposn= 1
110
- else
111
- let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
112
- endif
113
- " call Decho("saving posn to SWP stack")
114
- let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
115
- endif
116
-
117
- let &l:so = so_keep
118
- let &l:siso = siso_keep
119
- let &l:ss = ss_keep
120
-
121
- " if exists("b:cecutil_iwinposn") " Decho
122
- " call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
123
- " else " Decho
124
- " call Decho("b:cecutil_iwinposn doesn't exist")
125
- " endif " Decho
126
- " call Dret("SaveWinPosn [".savedposn."]")
127
- return savedposn
128
- endfun
129
-
130
- " ---------------------------------------------------------------------
131
- " RestoreWinPosn: {{{2
132
- fun! RestoreWinPosn(...)
133
- " call Dfunc("RestoreWinPosn() a:0=".a:0)
134
- " call Decho("getline(1)<".getline(1).">")
135
- " call Decho("line(.)=".line("."))
136
- if line(".") == 1 && getline(1) == ""
137
- " call Dfunc("RestoreWinPosn : empty buffer")
138
- return ""
139
- endif
140
- let so_keep = &l:so
141
- let siso_keep = &l:siso
142
- let ss_keep = &l:ss
143
- setlocal so=0 siso=0 ss=0
144
-
145
- if a:0 == 0 || a:1 == ""
146
- " use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
147
- if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
148
- " call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
149
- try
150
- exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
151
- catch /^Vim\%((\a\+)\)\=:E749/
152
- " ignore empty buffer error messages
153
- endtry
154
- " normally drop top-of-stack by one
155
- " but while new top-of-stack doesn't exist
156
- " drop top-of-stack index by one again
157
- if b:cecutil_iwinposn >= 1
158
- unlet b:cecutil_winposn{b:cecutil_iwinposn}
159
- let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
160
- while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
161
- let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
162
- endwhile
163
- if b:cecutil_iwinposn < 1
164
- unlet b:cecutil_iwinposn
165
- endif
166
- endif
167
- else
168
- echohl WarningMsg
169
- echomsg "***warning*** need to SaveWinPosn first!"
170
- echohl None
171
- endif
172
-
173
- else " handle input argument
174
- " call Decho("using input a:1<".a:1.">")
175
- " use window position passed to this function
176
- exe "silent ".a:1
177
- " remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
178
- if exists("b:cecutil_iwinposn")
179
- let jwinposn= b:cecutil_iwinposn
180
- while jwinposn >= 1 " search for a:1 in iwinposn..1
181
- if exists("b:cecutil_winposn{jwinposn}") " if it exists
182
- if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
183
- unlet b:cecutil_winposn{jwinposn} " unlet it
184
- if jwinposn == b:cecutil_iwinposn " if at top-of-stack
185
- let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
186
- endif
187
- endif
188
- endif
189
- let jwinposn= jwinposn - 1
190
- endwhile
191
- endif
192
- endif
193
-
194
- " Seems to be something odd: vertical motions after RWP
195
- " cause jump to first column. The following fixes that.
196
- " Note: was using wincol()>1, but with signs, a cursor
197
- " at column 1 yields wincol()==3. Beeping ensued.
198
- if virtcol('.') > 1
199
- silent norm! hl
200
- elseif virtcol(".") < virtcol("$")
201
- silent norm! lh
202
- endif
203
-
204
- let &l:so = so_keep
205
- let &l:siso = siso_keep
206
- let &l:ss = ss_keep
207
-
208
- " call Dret("RestoreWinPosn")
209
- endfun
210
-
211
- " ---------------------------------------------------------------------
212
- " GoWinbufnr: go to window holding given buffer (by number) {{{2
213
- " Prefers current window; if its buffer number doesn't match,
214
- " then will try from topleft to bottom right
215
- fun! GoWinbufnr(bufnum)
216
- " call Dfunc("GoWinbufnr(".a:bufnum.")")
217
- if winbufnr(0) == a:bufnum
218
- " call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
219
- return
220
- endif
221
- winc t
222
- let first=1
223
- while winbufnr(0) != a:bufnum && (first || winnr() != 1)
224
- winc w
225
- let first= 0
226
- endwhile
227
- " call Dret("GoWinbufnr")
228
- endfun
229
-
230
- " ---------------------------------------------------------------------
231
- " SaveMark: sets up a string saving a mark position. {{{2
232
- " For example, SaveMark("a")
233
- " Also sets up a global variable, g:savemark_{markname}
234
- fun! SaveMark(markname)
235
- " call Dfunc("SaveMark(markname<".a:markname.">)")
236
- let markname= a:markname
237
- if strpart(markname,0,1) !~ '\a'
238
- let markname= strpart(markname,1,1)
239
- endif
240
- " call Decho("markname=".markname)
241
-
242
- let lzkeep = &lz
243
- set lz
244
-
245
- if 1 <= line("'".markname) && line("'".markname) <= line("$")
246
- let winposn = SaveWinPosn(0)
247
- exe s:modifier."norm! `".markname
248
- let savemark = SaveWinPosn(0)
249
- let g:savemark_{markname} = savemark
250
- let savemark = markname.savemark
251
- call RestoreWinPosn(winposn)
252
- else
253
- let g:savemark_{markname} = ""
254
- let savemark = ""
255
- endif
256
-
257
- let &lz= lzkeep
258
-
259
- " call Dret("SaveMark : savemark<".savemark.">")
260
- return savemark
261
- endfun
262
-
263
- " ---------------------------------------------------------------------
264
- " RestoreMark: {{{2
265
- " call RestoreMark("a") -or- call RestoreMark(savemark)
266
- fun! RestoreMark(markname)
267
- " call Dfunc("RestoreMark(markname<".a:markname.">)")
268
-
269
- if strlen(a:markname) <= 0
270
- " call Dret("RestoreMark : no such mark")
271
- return
272
- endif
273
- let markname= strpart(a:markname,0,1)
274
- if markname !~ '\a'
275
- " handles 'a -> a styles
276
- let markname= strpart(a:markname,1,1)
277
- endif
278
- " call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
279
-
280
- let lzkeep = &lz
281
- set lz
282
- let winposn = SaveWinPosn(0)
283
-
284
- if strlen(a:markname) <= 2
285
- if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
286
- " use global variable g:savemark_{markname}
287
- " call Decho("use savemark list")
288
- call RestoreWinPosn(g:savemark_{markname})
289
- exe "norm! m".markname
290
- endif
291
- else
292
- " markname is a savemark command (string)
293
- " call Decho("use savemark command")
294
- let markcmd= strpart(a:markname,1)
295
- call RestoreWinPosn(markcmd)
296
- exe "norm! m".markname
297
- endif
298
-
299
- call RestoreWinPosn(winposn)
300
- let &lz = lzkeep
301
-
302
- " call Dret("RestoreMark")
303
- endfun
304
-
305
- " ---------------------------------------------------------------------
306
- " DestroyMark: {{{2
307
- " call DestroyMark("a") -- destroys mark
308
- fun! DestroyMark(markname)
309
- " call Dfunc("DestroyMark(markname<".a:markname.">)")
310
-
311
- " save options and set to standard values
312
- let reportkeep= &report
313
- let lzkeep = &lz
314
- set lz report=10000
315
-
316
- let markname= strpart(a:markname,0,1)
317
- if markname !~ '\a'
318
- " handles 'a -> a styles
319
- let markname= strpart(a:markname,1,1)
320
- endif
321
- " call Decho("markname=".markname)
322
-
323
- let curmod = &mod
324
- let winposn = SaveWinPosn(0)
325
- 1
326
- let lineone = getline(".")
327
- exe "k".markname
328
- d
329
- put! =lineone
330
- let &mod = curmod
331
- call RestoreWinPosn(winposn)
332
-
333
- " restore options to user settings
334
- let &report = reportkeep
335
- let &lz = lzkeep
336
-
337
- " call Dret("DestroyMark")
338
- endfun
339
-
340
- " ---------------------------------------------------------------------
341
- " QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{2
342
- " However, <q-args> doesn't split at all, so this one returns a list
343
- " with splits at all whitespace (only!), plus a leading length-of-list.
344
- " The resulting list: qarglist[0] corresponds to a:0
345
- " qarglist[i] corresponds to a:{i}
346
- fun! QArgSplitter(qarg)
347
- " call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
348
- let qarglist = split(a:qarg)
349
- let qarglistlen = len(qarglist)
350
- let qarglist = insert(qarglist,qarglistlen)
351
- " call Dret("QArgSplitter ".string(qarglist))
352
- return qarglist
353
- endfun
354
-
355
- " ---------------------------------------------------------------------
356
- " ListWinPosn: {{{2
357
- "fun! ListWinPosn() " Decho
358
- " if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
359
- " call Decho("nothing on SWP stack") " Decho
360
- " else " Decho
361
- " let jwinposn= b:cecutil_iwinposn " Decho
362
- " while jwinposn >= 1 " Decho
363
- " if exists("b:cecutil_winposn{jwinposn}") " Decho
364
- " call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
365
- " else " Decho
366
- " call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
367
- " endif " Decho
368
- " let jwinposn= jwinposn - 1 " Decho
369
- " endwhile " Decho
370
- " endif " Decho
371
- "endfun " Decho
372
- "com! -nargs=0 LWP call ListWinPosn() " Decho
373
-
374
- " ---------------------------------------------------------------------
375
- " SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2
376
- " which can be used to restore user maps later with
377
- " call RestoreUserMaps()
378
- "
379
- " mapmode - see :help maparg for details (n v o i c l "")
380
- " ex. "n" = Normal
381
- " The letters "b" and "u" are optional prefixes;
382
- " The "u" means that the map will also be unmapped
383
- " The "b" means that the map has a <buffer> qualifier
384
- " ex. "un" = Normal + unmapping
385
- " ex. "bn" = Normal + <buffer>
386
- " ex. "bun" = Normal + <buffer> + unmapping
387
- " ex. "ubn" = Normal + <buffer> + unmapping
388
- " maplead - see mapchx
389
- " mapchx - "<something>" handled as a single map item.
390
- " ex. "<left>"
391
- " - "string" a string of single letters which are actually
392
- " multiple two-letter maps (using the maplead:
393
- " maplead . each_character_in_string)
394
- " ex. maplead="\" and mapchx="abc" saves user mappings for
395
- " \a, \b, and \c
396
- " Of course, if maplead is "", then for mapchx="abc",
397
- " mappings for a, b, and c are saved.
398
- " - :something handled as a single map item, w/o the ":"
399
- " ex. mapchx= ":abc" will save a mapping for "abc"
400
- " suffix - a string unique to your plugin
401
- " ex. suffix= "DrawIt"
402
- fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
403
- " call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
404
-
405
- if !exists("s:restoremap_{a:suffix}")
406
- " initialize restoremap_suffix to null string
407
- let s:restoremap_{a:suffix}= ""
408
- endif
409
-
410
- " set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
411
- " if 0, save only
412
- let mapmode = a:mapmode
413
- let dounmap = 0
414
- let dobuffer = ""
415
- while mapmode =~ '^[bu]'
416
- if mapmode =~ '^u'
417
- let dounmap= 1
418
- let mapmode= strpart(a:mapmode,1)
419
- elseif mapmode =~ '^b'
420
- let dobuffer= "<buffer> "
421
- let mapmode= strpart(a:mapmode,1)
422
- endif
423
- endwhile
424
- " call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
425
-
426
- " save single map :...something...
427
- if strpart(a:mapchx,0,1) == ':'
428
- " call Decho("save single map :...something...")
429
- let amap= strpart(a:mapchx,1)
430
- if amap == "|" || amap == "\<c-v>"
431
- let amap= "\<c-v>".amap
432
- endif
433
- let amap = a:maplead.amap
434
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".dobuffer.amap
435
- if maparg(amap,mapmode) != ""
436
- let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
437
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
438
- endif
439
- if dounmap
440
- exe "silent! ".mapmode."unmap ".dobuffer.amap
441
- endif
442
-
443
- " save single map <something>
444
- elseif strpart(a:mapchx,0,1) == '<'
445
- " call Decho("save single map <something>")
446
- let amap = a:mapchx
447
- if amap == "|" || amap == "\<c-v>"
448
- let amap= "\<c-v>".amap
449
- " call Decho("amap[[".amap."]]")
450
- endif
451
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.amap
452
- if maparg(a:mapchx,mapmode) != ""
453
- let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
454
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".dobuffer.maprhs
455
- endif
456
- if dounmap
457
- exe "silent! ".mapmode."unmap ".dobuffer.amap
458
- endif
459
-
460
- " save multiple maps
461
- else
462
- " call Decho("save multiple maps")
463
- let i= 1
464
- while i <= strlen(a:mapchx)
465
- let amap= a:maplead.strpart(a:mapchx,i-1,1)
466
- if amap == "|" || amap == "\<c-v>"
467
- let amap= "\<c-v>".amap
468
- endif
469
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.amap
470
- if maparg(amap,mapmode) != ""
471
- let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
472
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".dobuffer.maprhs
473
- endif
474
- if dounmap
475
- exe "silent! ".mapmode."unmap ".dobuffer.amap
476
- endif
477
- let i= i + 1
478
- endwhile
479
- endif
480
- " call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
481
- endfun
482
-
483
- " ---------------------------------------------------------------------
484
- " RestoreUserMaps: {{{2
485
- " Used to restore user maps saved by SaveUserMaps()
486
- fun! RestoreUserMaps(suffix)
487
- " call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
488
- if exists("s:restoremap_{a:suffix}")
489
- let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
490
- if s:restoremap_{a:suffix} != ""
491
- " call Decho("exe ".s:restoremap_{a:suffix})
492
- exe "silent! ".s:restoremap_{a:suffix}
493
- endif
494
- unlet s:restoremap_{a:suffix}
495
- endif
496
- " call Dret("RestoreUserMaps")
497
- endfun
498
-
499
- " ==============
500
- " Restore: {{{1
501
- " ==============
502
- let &cpo= s:keepcpo
503
- unlet s:keepcpo
504
-
505
- " ================
506
- " Modelines: {{{1
507
- " ================
508
- " vim: ts=4 fdm=marker
@@ -1,61 +0,0 @@
1
- " =============================================================================
2
- " File: plugin/ctrlp.vim
3
- " Description: Fuzzy file, buffer, mru and tag finder.
4
- " Author: Kien Nguyen <github.com/kien>
5
- " =============================================================================
6
- " GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
7
-
8
- if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
9
- fini
10
- en
11
- let g:loaded_ctrlp = 1
12
-
13
- let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
14
- \ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
15
- \ = [[], [], [], [], {}, {}, [], 2]
16
-
17
- if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
18
- if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
19
-
20
- com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
21
-
22
- com! CtrlPBuffer cal ctrlp#init(1)
23
- com! CtrlPMRUFiles cal ctrlp#init(2)
24
-
25
- com! CtrlPLastMode cal ctrlp#init(-1)
26
-
27
- com! CtrlPClearCache cal ctrlp#clr()
28
- com! CtrlPClearAllCaches cal ctrlp#clra()
29
- com! CtrlPReload cal ctrlp#reset()
30
-
31
- com! ClearCtrlPCache cal ctrlp#clr()
32
- com! ClearAllCtrlPCaches cal ctrlp#clra()
33
- com! ResetCtrlP cal ctrlp#reset()
34
-
35
- com! CtrlPCurWD cal ctrlp#init(0, 0)
36
- com! CtrlPCurFile cal ctrlp#init(0, 1)
37
- com! CtrlPRoot cal ctrlp#init(0, 2)
38
-
39
- if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
40
- exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
41
- en
42
-
43
- cal ctrlp#mrufiles#init()
44
-
45
- com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
46
- com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
47
- com! -n=? -com=dir CtrlPDir
48
- \ cal ctrlp#init(ctrlp#dir#id(), <q-args>)
49
- com! -n=? -com=buffer CtrlPBufTag
50
- \ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
51
- com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
52
- com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
53
- com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
54
- com! CtrlPLine cal ctrlp#init(ctrlp#line#id())
55
- com! -n=? -com=buffer CtrlPChange
56
- \ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
57
- com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
58
- com! CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
59
- com! CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
60
- com! -n=? -com=dir CtrlPBookmarkDirAdd
61
- \ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)