utils 0.0.67 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,592 +0,0 @@
|
|
|
1
|
-
" Decho.vim: Debugging support for VimL
|
|
2
|
-
" Maintainer: Charles E. Campbell, Jr. PhD <cec@NgrOyphSon.gPsfAc.nMasa.gov>
|
|
3
|
-
" Date: Oct 23, 2008
|
|
4
|
-
" Version: 20
|
|
5
|
-
"
|
|
6
|
-
" Usage: {{{1
|
|
7
|
-
" Decho "a string"
|
|
8
|
-
" call Decho("another string")
|
|
9
|
-
" let g:decho_bufname = "ANewDBGBufName"
|
|
10
|
-
" let g:decho_bufenter= 1 " tells Decho to ignore BufEnter, WinEnter,
|
|
11
|
-
" " WinLeave events while Decho is working
|
|
12
|
-
" call Decho("one","thing","after","another")
|
|
13
|
-
" DechoOn : removes any first-column '"' from lines containing Decho
|
|
14
|
-
" DechoOff : inserts a '"' into the first-column in lines containing Decho
|
|
15
|
-
" DechoMsgOn : use echomsg instead of DBG buffer
|
|
16
|
-
" DechoMsgOff : turn debugging off
|
|
17
|
-
" DechoRemOn : turn remote Decho messaging on
|
|
18
|
-
" DechoRemOff : turn remote Decho messaging off
|
|
19
|
-
" DechoVarOn [varname] : use variable to write debugging messages to
|
|
20
|
-
" DechoVarOff : turn debugging off
|
|
21
|
-
" DechoTabOn : turn debugging on (uses a separate tab)
|
|
22
|
-
" DechoTabOff : turn debugging off
|
|
23
|
-
"
|
|
24
|
-
" GetLatestVimScripts: 120 1 :AutoInstall: Decho.vim
|
|
25
|
-
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
|
|
26
|
-
|
|
27
|
-
" ---------------------------------------------------------------------
|
|
28
|
-
" Load Once: {{{1
|
|
29
|
-
if exists("g:loaded_Decho") || &cp
|
|
30
|
-
finish
|
|
31
|
-
endif
|
|
32
|
-
let g:loaded_Decho = "v20"
|
|
33
|
-
let s:keepcpo = &cpo
|
|
34
|
-
set cpo&vim
|
|
35
|
-
|
|
36
|
-
" ---------------------------------------------------------------------
|
|
37
|
-
" Default Values For Variables: {{{1
|
|
38
|
-
if !exists("g:decho_bufname")
|
|
39
|
-
let g:decho_bufname= "DBG"
|
|
40
|
-
endif
|
|
41
|
-
if !exists("s:decho_depth")
|
|
42
|
-
let s:decho_depth = 0
|
|
43
|
-
endif
|
|
44
|
-
if !exists("g:decho_winheight")
|
|
45
|
-
let g:decho_winheight= 5
|
|
46
|
-
endif
|
|
47
|
-
if !exists("g:decho_bufenter")
|
|
48
|
-
let g:decho_bufenter= 0
|
|
49
|
-
endif
|
|
50
|
-
if !exists("g:dechomode") || !exists("s:DECHOWIN")
|
|
51
|
-
let s:DECHOWIN = 1
|
|
52
|
-
let s:DECHOMSG = 2
|
|
53
|
-
let s:DECHOVAR = 3
|
|
54
|
-
let s:DECHOREM = 4
|
|
55
|
-
let s:DECHOTAB = 5
|
|
56
|
-
let g:dechomode= s:DECHOWIN
|
|
57
|
-
endif
|
|
58
|
-
if !exists("g:dechovarname")
|
|
59
|
-
let g:dechovarname = "g:dechovar"
|
|
60
|
-
endif
|
|
61
|
-
|
|
62
|
-
" ---------------------------------------------------------------------
|
|
63
|
-
" User Interface: {{{1
|
|
64
|
-
com! -nargs=+ -complete=expression Decho call Decho(<args>)
|
|
65
|
-
com! -nargs=+ -complete=expression Dredir call Dredir(<args>)
|
|
66
|
-
com! -nargs=0 -range=% DechoOn call DechoOn(<line1>,<line2>)
|
|
67
|
-
com! -nargs=0 -range=% DechoOff call DechoOff(<line1>,<line2>)
|
|
68
|
-
com! -nargs=0 Dhide call s:Dhide(1)
|
|
69
|
-
com! -nargs=0 Dshow call s:Dhide(0)
|
|
70
|
-
com! -nargs=0 DechoMsgOn call s:DechoMsg(1,expand("<sfile>"))
|
|
71
|
-
com! -nargs=0 DechoMsgOff call s:DechoMsg(0)
|
|
72
|
-
if has("clientserver") && executable("gvim")
|
|
73
|
-
com! -nargs=0 DechoRemOn call s:DechoRemote(1,expand("<sfile>"))
|
|
74
|
-
com! -nargs=0 DechoRemOff call s:DechoRemote(0)
|
|
75
|
-
endif
|
|
76
|
-
com! -nargs=? DechoSep call DechoSep(<args>)
|
|
77
|
-
com! -nargs=? Dsep call DechoSep(<args>)
|
|
78
|
-
com! -nargs=? DechoVarOn call s:DechoVarOn(expand("<sfile>"),<args>)
|
|
79
|
-
com! -nargs=0 DechoVarOff call s:DechoVarOff()
|
|
80
|
-
if v:version >= 700
|
|
81
|
-
com! -nargs=? DechoTabOn set lz|call s:DechoTab(1,expand("<sfile>"))|set nolz
|
|
82
|
-
com! -nargs=? DechoTabOff set lz|call s:DechoTab(0)|set nolz
|
|
83
|
-
endif
|
|
84
|
-
com! -nargs=0 DechoPause call DechoPause()
|
|
85
|
-
au Filetype Decho nmap <silent> <buffer> <F1> :setlocal noro ma<cr>
|
|
86
|
-
|
|
87
|
-
" ---------------------------------------------------------------------
|
|
88
|
-
" Decho: the primary debugging function: splits the screen as necessary and {{{1
|
|
89
|
-
" writes messages to a small window (g:decho_winheight lines)
|
|
90
|
-
" on the bottom of the screen
|
|
91
|
-
fun! Decho(...)
|
|
92
|
-
|
|
93
|
-
" make sure that SaveWinPosn() and RestoreWinPosn() are available
|
|
94
|
-
if !exists("g:loaded_cecutil")
|
|
95
|
-
runtime plugin/cecutil.vim
|
|
96
|
-
if !exists("g:loaded_cecutil") && exists("g:loaded_AsNeeded")
|
|
97
|
-
AN SWP
|
|
98
|
-
endif
|
|
99
|
-
if !exists("g:loaded_cecutil")
|
|
100
|
-
echoerr "***Decho*** need to load <cecutil.vim>"
|
|
101
|
-
return
|
|
102
|
-
endif
|
|
103
|
-
endif
|
|
104
|
-
|
|
105
|
-
" open DBG window (if dechomode is dechowin)
|
|
106
|
-
if g:dechomode == s:DECHOWIN
|
|
107
|
-
let swp = SaveWinPosn(0)
|
|
108
|
-
let curbuf= bufnr("%")
|
|
109
|
-
if g:decho_bufenter
|
|
110
|
-
let eikeep= &ei
|
|
111
|
-
let eakeep= &ea
|
|
112
|
-
set ei=BufEnter,WinEnter,WinLeave,ShellCmdPost,FocusGained noea
|
|
113
|
-
endif
|
|
114
|
-
|
|
115
|
-
" As needed, create/switch-to the DBG buffer
|
|
116
|
-
if !bufexists(g:decho_bufname) && bufnr("*/".g:decho_bufname."$") == -1
|
|
117
|
-
" if requested DBG-buffer doesn't exist, create a new one
|
|
118
|
-
" at the bottom of the screen.
|
|
119
|
-
exe "keepjumps silent! bot ".g:decho_winheight."new ".fnameescape(g:decho_bufname)
|
|
120
|
-
setlocal noswf
|
|
121
|
-
keepjumps silent! %d
|
|
122
|
-
|
|
123
|
-
elseif bufwinnr(g:decho_bufname) > 0
|
|
124
|
-
" if requested DBG-buffer exists in a window,
|
|
125
|
-
" go to that window (by window number)
|
|
126
|
-
exe "keepjumps ".bufwinnr(g:decho_bufname)."wincmd W"
|
|
127
|
-
exe "res ".g:decho_winheight
|
|
128
|
-
|
|
129
|
-
else
|
|
130
|
-
" user must have closed the DBG-buffer window.
|
|
131
|
-
" create a new one at the bottom of the screen.
|
|
132
|
-
exe "keepjumps silent bot ".g:decho_winheight."new"
|
|
133
|
-
setlocal noswf
|
|
134
|
-
exe "keepjumps b ".bufnr(g:decho_bufname)
|
|
135
|
-
endif
|
|
136
|
-
|
|
137
|
-
set ft=Decho
|
|
138
|
-
setlocal noswapfile noro nobl fo=n2croql
|
|
139
|
-
|
|
140
|
-
" make sure DBG window is on the bottom
|
|
141
|
-
wincmd J
|
|
142
|
-
endif
|
|
143
|
-
|
|
144
|
-
" Build Message
|
|
145
|
-
let i = 1
|
|
146
|
-
let msg= ""
|
|
147
|
-
while i <= a:0
|
|
148
|
-
try
|
|
149
|
-
exe "let msg=msg.a:".i
|
|
150
|
-
catch /^Vim\%((\a\+)\)\=:E730/
|
|
151
|
-
" looks like a:i is a list
|
|
152
|
-
exe "let msg=msg.string(a:".i.")"
|
|
153
|
-
endtry
|
|
154
|
-
if i < a:0
|
|
155
|
-
let msg=msg." "
|
|
156
|
-
endif
|
|
157
|
-
let i=i+1
|
|
158
|
-
endwhile
|
|
159
|
-
|
|
160
|
-
" Initialize message
|
|
161
|
-
let smsg = ""
|
|
162
|
-
let idepth = 0
|
|
163
|
-
while idepth < s:decho_depth
|
|
164
|
-
let smsg = "|".smsg
|
|
165
|
-
let idepth = idepth + 1
|
|
166
|
-
endwhile
|
|
167
|
-
|
|
168
|
-
" Handle special characters (\t \r \n)
|
|
169
|
-
" and append msg to smsg
|
|
170
|
-
let i = 1
|
|
171
|
-
while msg != ""
|
|
172
|
-
let chr = strpart(msg,0,1)
|
|
173
|
-
let msg = strpart(msg,1)
|
|
174
|
-
if char2nr(chr) < 32
|
|
175
|
-
let smsg = smsg.'^'.nr2char(64+char2nr(chr))
|
|
176
|
-
else
|
|
177
|
-
let smsg = smsg.chr
|
|
178
|
-
endif
|
|
179
|
-
endwhile
|
|
180
|
-
|
|
181
|
-
" echomsg "g:dechomode=".g:dechomode
|
|
182
|
-
if g:dechomode == s:DECHOMSG
|
|
183
|
-
" display message with echomsg
|
|
184
|
-
exe "echomsg '".substitute(smsg,"'","'.\"'\".'","ge")."'"
|
|
185
|
-
|
|
186
|
-
elseif g:dechomode == s:DECHOVAR
|
|
187
|
-
" "display" message by appending to variable named by g:dechovarname
|
|
188
|
-
let smsg= substitute(smsg,"'","''","ge")
|
|
189
|
-
if exists(g:dechovarname)
|
|
190
|
-
exe "let ".g:dechovarname."= ".g:dechovarname.".'\n".smsg."'"
|
|
191
|
-
else
|
|
192
|
-
exe "let ".g:dechovarname."= '".smsg."'"
|
|
193
|
-
endif
|
|
194
|
-
|
|
195
|
-
elseif g:dechomode == s:DECHOREM
|
|
196
|
-
" display message by appending it to remote DECHOREMOTE vim server
|
|
197
|
-
let smsg= substitute(smsg,"\<esc>","\<c-v>\<esc>","ge")
|
|
198
|
-
try
|
|
199
|
-
call remote_send("DECHOREMOTE",':set ma fo-=at'."\<cr>".'Go'.smsg."\<esc>".':set noma nomod'."\<cr>")
|
|
200
|
-
catch /^Vim\%((\a\+)\)\=:E241/
|
|
201
|
-
let g:dechomode= s:DECHOWIN
|
|
202
|
-
endtry
|
|
203
|
-
|
|
204
|
-
elseif g:dechomode == s:DECHOTAB
|
|
205
|
-
" display message by appending it to the debugging tab window
|
|
206
|
-
let eikeep= &ei
|
|
207
|
-
set ei=all
|
|
208
|
-
let g:dechotabcur = tabpagenr()
|
|
209
|
-
exe "silent! tabn ".g:dechotabnr
|
|
210
|
-
if expand("%") != "Decho Tab"
|
|
211
|
-
" looks like a new tab has been inserted -- look for the "Decho Tab" tab
|
|
212
|
-
let g:dechotabnr= 1
|
|
213
|
-
silent! tabn 1
|
|
214
|
-
while expand("%") != "Decho Tab"
|
|
215
|
-
let g:dechotabnr= g:dechotabnr + 1
|
|
216
|
-
if g:dechotabnr > tabpagenr("$")
|
|
217
|
-
" re-enable the "Decho Tab" tab -- looks like it was closed!
|
|
218
|
-
call s:DechoTab(1)
|
|
219
|
-
break
|
|
220
|
-
endif
|
|
221
|
-
exe "tabn".g:dechotabnr
|
|
222
|
-
endwhile
|
|
223
|
-
endif
|
|
224
|
-
" append message to "Decho Tab" tab
|
|
225
|
-
setlocal ma noro
|
|
226
|
-
call setline(line("$")+1,smsg)
|
|
227
|
-
setlocal noma nomod
|
|
228
|
-
" restore tab# to original user tab
|
|
229
|
-
exe "tabn ".g:dechotabcur
|
|
230
|
-
let &ei= eikeep
|
|
231
|
-
|
|
232
|
-
else
|
|
233
|
-
" Write Message to DBG buffer
|
|
234
|
-
setlocal ma
|
|
235
|
-
keepjumps $
|
|
236
|
-
keepjumps let res= append("$",smsg)
|
|
237
|
-
setlocal nomod
|
|
238
|
-
|
|
239
|
-
" Put cursor at bottom of DBG window, then return to original window
|
|
240
|
-
exe "res ".g:decho_winheight
|
|
241
|
-
keepjumps norm! G
|
|
242
|
-
if exists("g:decho_hide") && g:decho_hide > 0
|
|
243
|
-
setlocal hidden
|
|
244
|
-
q
|
|
245
|
-
endif
|
|
246
|
-
keepjumps wincmd p
|
|
247
|
-
if exists("swp")
|
|
248
|
-
call RestoreWinPosn(swp)
|
|
249
|
-
endif
|
|
250
|
-
|
|
251
|
-
if g:decho_bufenter
|
|
252
|
-
let &ei= eikeep
|
|
253
|
-
let &ea= eakeep
|
|
254
|
-
endif
|
|
255
|
-
endif
|
|
256
|
-
endfun
|
|
257
|
-
|
|
258
|
-
" ---------------------------------------------------------------------
|
|
259
|
-
" Dfunc: just like Decho, except that it also bumps up the depth {{{1
|
|
260
|
-
" It also appends a "{" to facilitate use of %
|
|
261
|
-
" Usage: call Dfunc("functionname([opt arglist])")
|
|
262
|
-
fun! Dfunc(...)
|
|
263
|
-
" Build Message
|
|
264
|
-
let i = 1
|
|
265
|
-
let msg= ""
|
|
266
|
-
while i <= a:0
|
|
267
|
-
exe "let msg=msg.a:".i
|
|
268
|
-
if i < a:0
|
|
269
|
-
let msg=msg." "
|
|
270
|
-
endif
|
|
271
|
-
let i=i+1
|
|
272
|
-
endwhile
|
|
273
|
-
let msg= msg." {"
|
|
274
|
-
call Decho(msg)
|
|
275
|
-
let s:decho_depth= s:decho_depth + 1
|
|
276
|
-
let s:Dfunclist_{s:decho_depth}= substitute(msg,'[( \t].*$','','')
|
|
277
|
-
endfun
|
|
278
|
-
|
|
279
|
-
" ---------------------------------------------------------------------
|
|
280
|
-
" Dret: just like Decho, except that it also bumps down the depth {{{1
|
|
281
|
-
" It also appends a "}" to facilitate use of %
|
|
282
|
-
" Usage: call Dret("functionname [optional return] [: optional extra info]")
|
|
283
|
-
fun! Dret(...)
|
|
284
|
-
" Build Message
|
|
285
|
-
let i = 1
|
|
286
|
-
let msg= ""
|
|
287
|
-
while i <= a:0
|
|
288
|
-
exe "let msg=msg.a:".i
|
|
289
|
-
if i < a:0
|
|
290
|
-
let msg=msg." "
|
|
291
|
-
endif
|
|
292
|
-
let i=i+1
|
|
293
|
-
endwhile
|
|
294
|
-
let msg= msg." }"
|
|
295
|
-
call Decho("return ".msg)
|
|
296
|
-
if s:decho_depth > 0
|
|
297
|
-
let retfunc= substitute(msg,'\s.*$','','e')
|
|
298
|
-
if retfunc != s:Dfunclist_{s:decho_depth}
|
|
299
|
-
echoerr "Dret: appears to be called by<".s:Dfunclist_{s:decho_depth}."> but returning from<".retfunc.">"
|
|
300
|
-
endif
|
|
301
|
-
unlet s:Dfunclist_{s:decho_depth}
|
|
302
|
-
let s:decho_depth= s:decho_depth - 1
|
|
303
|
-
endif
|
|
304
|
-
endfun
|
|
305
|
-
|
|
306
|
-
" ---------------------------------------------------------------------
|
|
307
|
-
" DechoOn: {{{1
|
|
308
|
-
fun! DechoOn(line1,line2)
|
|
309
|
-
let ickeep= &ic
|
|
310
|
-
set noic
|
|
311
|
-
let swp = SaveWinPosn(0)
|
|
312
|
-
let dbgpat = '\<D\%(echo\|func\|redir\|ret\|echo\%(Msg\|Rem\|Tab\|Var\)O\%(n\|ff\)\)\>'
|
|
313
|
-
if search(dbgpat,'cnw') == 0
|
|
314
|
-
echoerr "this file<".expand("%")."> does not contain any Decho/Dfunc/Dret commands or function calls!"
|
|
315
|
-
else
|
|
316
|
-
exe "keepjumps ".a:line1.",".a:line2.'g/'.dbgpat.'/s/^"\+//'
|
|
317
|
-
endif
|
|
318
|
-
call RestoreWinPosn(swp)
|
|
319
|
-
let &ic= ickeep
|
|
320
|
-
endfun
|
|
321
|
-
|
|
322
|
-
" ---------------------------------------------------------------------
|
|
323
|
-
" DechoOff: {{{1
|
|
324
|
-
fun! DechoOff(line1,line2)
|
|
325
|
-
let ickeep= &ic
|
|
326
|
-
set noic
|
|
327
|
-
let swp=SaveWinPosn(0)
|
|
328
|
-
let swp= SaveWinPosn(0)
|
|
329
|
-
exe "keepjumps ".a:line1.",".a:line2.'g/\<D\%(echo\|func\|redir\|ret\|echo\%(Msg\|Rem\|Tab\|Var\)O\%(n\|ff\)\)\>/s/^[^"]/"&/'
|
|
330
|
-
call RestoreWinPosn(swp)
|
|
331
|
-
let &ic= ickeep
|
|
332
|
-
endfun
|
|
333
|
-
|
|
334
|
-
" ---------------------------------------------------------------------
|
|
335
|
-
" DechoDepth: allow user to force depth value {{{1
|
|
336
|
-
fun! DechoDepth(depth)
|
|
337
|
-
let s:decho_depth= a:depth
|
|
338
|
-
endfun
|
|
339
|
-
|
|
340
|
-
" ---------------------------------------------------------------------
|
|
341
|
-
" s:DechoMsg: {{{2
|
|
342
|
-
fun! s:DechoMsg(onoff,...)
|
|
343
|
-
" call Dfunc("s:DechoMsg(onoff=".a:onoff.") a:0=".a:0)
|
|
344
|
-
if a:onoff
|
|
345
|
-
let g:dechomode = s:DECHOMSG
|
|
346
|
-
let g:dechofile = (a:0 > 0)? a:1 : ""
|
|
347
|
-
else
|
|
348
|
-
let g:dechomode= s:DECHOWIN
|
|
349
|
-
endif
|
|
350
|
-
" call Dret("s:DechoMsg")
|
|
351
|
-
endfun
|
|
352
|
-
|
|
353
|
-
" ---------------------------------------------------------------------
|
|
354
|
-
" Dhide: (un)hide DBG buffer {{{1
|
|
355
|
-
fun! <SID>Dhide(hide)
|
|
356
|
-
|
|
357
|
-
if !bufexists(g:decho_bufname) && bufnr("*/".g:decho_bufname."$") == -1
|
|
358
|
-
" DBG-buffer doesn't exist, simply set g:decho_hide
|
|
359
|
-
let g:decho_hide= a:hide
|
|
360
|
-
|
|
361
|
-
elseif bufwinnr(g:decho_bufname) > 0
|
|
362
|
-
" DBG-buffer exists in a window, so its not currently hidden
|
|
363
|
-
if a:hide == 0
|
|
364
|
-
" already visible!
|
|
365
|
-
let g:decho_hide= a:hide
|
|
366
|
-
else
|
|
367
|
-
" need to hide window. Goto window and make hidden
|
|
368
|
-
let curwin = winnr()
|
|
369
|
-
let dbgwin = bufwinnr(g:decho_bufname)
|
|
370
|
-
exe bufwinnr(g:decho_bufname)."wincmd W"
|
|
371
|
-
setlocal hidden
|
|
372
|
-
q
|
|
373
|
-
if dbgwin != curwin
|
|
374
|
-
" return to previous window
|
|
375
|
-
exe curwin."wincmd W"
|
|
376
|
-
endif
|
|
377
|
-
endif
|
|
378
|
-
|
|
379
|
-
else
|
|
380
|
-
" The DBG-buffer window is currently hidden.
|
|
381
|
-
if a:hide == 0
|
|
382
|
-
let curwin= winnr()
|
|
383
|
-
exe "silent bot ".g:decho_winheight."new"
|
|
384
|
-
setlocal bh=wipe
|
|
385
|
-
exe "b ".bufnr(g:decho_bufname)
|
|
386
|
-
exe curwin."wincmd W"
|
|
387
|
-
else
|
|
388
|
-
let g:decho_hide= a:hide
|
|
389
|
-
endif
|
|
390
|
-
endif
|
|
391
|
-
let g:decho_hide= a:hide
|
|
392
|
-
endfun
|
|
393
|
-
|
|
394
|
-
" ---------------------------------------------------------------------
|
|
395
|
-
" Dredir: this function performs a debugging redir by temporarily using {{{1
|
|
396
|
-
" register a in a redir @a of the given command. Register a's
|
|
397
|
-
" original contents are restored.
|
|
398
|
-
" Usage: Dredir(["string","string",...,]"cmd")
|
|
399
|
-
fun! Dredir(...)
|
|
400
|
-
if a:0 <= 0
|
|
401
|
-
return
|
|
402
|
-
endif
|
|
403
|
-
let icmd = 1
|
|
404
|
-
while icmd < a:0
|
|
405
|
-
call Decho(a:{icmd})
|
|
406
|
-
let icmd= icmd + 1
|
|
407
|
-
endwhile
|
|
408
|
-
let cmd= a:{icmd}
|
|
409
|
-
|
|
410
|
-
" save register a, initialize
|
|
411
|
-
let keep_rega = @a
|
|
412
|
-
let v:errmsg = ''
|
|
413
|
-
|
|
414
|
-
" do the redir of the command to the register a
|
|
415
|
-
try
|
|
416
|
-
redir @a
|
|
417
|
-
exe "keepjumps silent ".cmd
|
|
418
|
-
catch /.*/
|
|
419
|
-
let v:errmsg= substitute(v:exception,'^[^:]\+:','','e')
|
|
420
|
-
finally
|
|
421
|
-
redir END
|
|
422
|
-
if v:errmsg == ''
|
|
423
|
-
let output= @a
|
|
424
|
-
else
|
|
425
|
-
let output= v:errmsg
|
|
426
|
-
endif
|
|
427
|
-
let @a= keep_rega
|
|
428
|
-
endtry
|
|
429
|
-
|
|
430
|
-
" process output via Decho()
|
|
431
|
-
while output != ""
|
|
432
|
-
if output =~ "\n"
|
|
433
|
-
let redirline = substitute(output,'\n.*$','','e')
|
|
434
|
-
let output = substitute(output,'^.\{-}\n\(.*$\)$','\1','e')
|
|
435
|
-
else
|
|
436
|
-
let redirline = output
|
|
437
|
-
let output = ""
|
|
438
|
-
endif
|
|
439
|
-
call Decho("redir<".cmd.">: ".redirline)
|
|
440
|
-
endwhile
|
|
441
|
-
endfun
|
|
442
|
-
|
|
443
|
-
" ---------------------------------------------------------------------
|
|
444
|
-
" DechoSep: puts a separator with counter into debugging output {{{2
|
|
445
|
-
fun! DechoSep(...)
|
|
446
|
-
" call Dfunc("DechoSep() a:0=".a:0)
|
|
447
|
-
if !exists("s:dechosepcnt")
|
|
448
|
-
let s:dechosepcnt= 1
|
|
449
|
-
else
|
|
450
|
-
let s:dechosepcnt= s:dechosepcnt + 1
|
|
451
|
-
endif
|
|
452
|
-
let eikeep= &ei
|
|
453
|
-
set ei=all
|
|
454
|
-
call Decho("--sep".s:dechosepcnt."--".((a:0 > 0)? " ".a:1 : ""))
|
|
455
|
-
let &ei= eikeep
|
|
456
|
-
" call Dret("DechoSep")
|
|
457
|
-
endfun
|
|
458
|
-
|
|
459
|
-
" ---------------------------------------------------------------------
|
|
460
|
-
" DechoPause: puts a pause-until-<cr> into operation; will place a {{{2
|
|
461
|
-
" separator into the debug output for reporting
|
|
462
|
-
fun! DechoPause()
|
|
463
|
-
" call Dfunc("DechoPause()")
|
|
464
|
-
redraw!
|
|
465
|
-
call DechoSep("(pause)")
|
|
466
|
-
call inputsave()
|
|
467
|
-
call input("Press <cr> to continue")
|
|
468
|
-
call inputrestore()
|
|
469
|
-
" call Dret("DechoPause")
|
|
470
|
-
endfun
|
|
471
|
-
|
|
472
|
-
" ---------------------------------------------------------------------
|
|
473
|
-
" DechoRemote: supports sending debugging to a remote vim {{{1
|
|
474
|
-
if has("clientserver") && executable("gvim")
|
|
475
|
-
fun! s:DechoRemote(mode,...)
|
|
476
|
-
if a:mode == 0
|
|
477
|
-
" turn remote debugging off
|
|
478
|
-
if g:dechomode == s:DECHOREM
|
|
479
|
-
let g:dechomode= s:DECHOWIN
|
|
480
|
-
endif
|
|
481
|
-
|
|
482
|
-
elseif a:mode == 1
|
|
483
|
-
" turn remote debugging on
|
|
484
|
-
if g:dechomode != s:DECHOREM
|
|
485
|
-
let g:dechomode= s:DECHOREM
|
|
486
|
-
endif
|
|
487
|
-
let g:dechofile= (a:0 > 0)? a:1 : ""
|
|
488
|
-
if serverlist() !~ '\<DECHOREMOTE\>'
|
|
489
|
-
" " start up remote Decho server
|
|
490
|
-
" call Decho("start up DECHOREMOTE server")
|
|
491
|
-
if has("win32") && executable("start")
|
|
492
|
-
call system("start gvim --servername DECHOREMOTE")
|
|
493
|
-
else
|
|
494
|
-
call system("gvim --servername DECHOREMOTE")
|
|
495
|
-
endif
|
|
496
|
-
while 1
|
|
497
|
-
try
|
|
498
|
-
call remote_send("DECHOREMOTE",':silent set ft=Decho fo-=at'."\<cr>")
|
|
499
|
-
call remote_send("DECHOREMOTE",':file [Decho\ Remote\ Server]'."\<cr>")
|
|
500
|
-
call remote_send("DECHOREMOTE",":put ='-----------------------------'\<cr>")
|
|
501
|
-
call remote_send("DECHOREMOTE",":put ='Remote Decho Debugging Window'\<cr>")
|
|
502
|
-
call remote_send("DECHOREMOTE",":put ='-----------------------------'\<cr>")
|
|
503
|
-
call remote_send("DECHOREMOTE","1GddG")
|
|
504
|
-
call remote_send("DECHOREMOTE",':silent set noswf noma nomod nobl nonu ch=1 fo=n2croql nosi noai'."\<cr>")
|
|
505
|
-
call remote_send("DECHOREMOTE",':'."\<cr>")
|
|
506
|
-
call remote_send("DECHOREMOTE",':silent set ft=Decho'."\<cr>")
|
|
507
|
-
call remote_send("DECHOREMOTE",':silent syn on'."\<cr>")
|
|
508
|
-
break
|
|
509
|
-
catch /^Vim\%((\a\+)\)\=:E241/
|
|
510
|
-
sleep 200m
|
|
511
|
-
endtry
|
|
512
|
-
endwhile
|
|
513
|
-
endif
|
|
514
|
-
|
|
515
|
-
else
|
|
516
|
-
echohl Warning | echomsg "DechoRemote(".a:mode.") not supported" | echohl None
|
|
517
|
-
endif
|
|
518
|
-
|
|
519
|
-
endfun
|
|
520
|
-
endif
|
|
521
|
-
|
|
522
|
-
" ---------------------------------------------------------------------
|
|
523
|
-
" DechoVarOn: turu debugging-to-a-variable on. The variable is given {{{1
|
|
524
|
-
" by the user; DechoVarOn [varname]
|
|
525
|
-
fun! s:DechoVarOn(...)
|
|
526
|
-
let g:dechomode= s:DECHOVAR
|
|
527
|
-
|
|
528
|
-
if a:0 > 0
|
|
529
|
-
let g:dechofile= a:1
|
|
530
|
-
if a:2 =~ '^g:'
|
|
531
|
-
exe "let ".a:2.'= ""'
|
|
532
|
-
else
|
|
533
|
-
exe "let g:".a:2.'= ""'
|
|
534
|
-
endif
|
|
535
|
-
else
|
|
536
|
-
let g:dechovarname= "g:dechovar"
|
|
537
|
-
endif
|
|
538
|
-
endfun
|
|
539
|
-
|
|
540
|
-
" ---------------------------------------------------------------------
|
|
541
|
-
" DechoVarOff: {{{1
|
|
542
|
-
fun! s:DechoVarOff()
|
|
543
|
-
if exists("g:dechovarname")
|
|
544
|
-
if exists(g:dechovarname)
|
|
545
|
-
exe "unlet ".g:dechovarname
|
|
546
|
-
endif
|
|
547
|
-
endif
|
|
548
|
-
let g:dechomode= s:DECHOWIN
|
|
549
|
-
endfun
|
|
550
|
-
|
|
551
|
-
" --------------------------------------------------------------------
|
|
552
|
-
" DechoTab: {{{1
|
|
553
|
-
if v:version >= 700
|
|
554
|
-
fun! s:DechoTab(mode,...)
|
|
555
|
-
" call Dfunc("DechoTab(mode=".a:mode.") a:0=".a:0)
|
|
556
|
-
|
|
557
|
-
if a:mode
|
|
558
|
-
let g:dechomode = s:DECHOTAB
|
|
559
|
-
let g:dechofile = (a:0 > 0)? a:1 : ""
|
|
560
|
-
let dechotabcur = tabpagenr()
|
|
561
|
-
if !exists("g:dechotabnr")
|
|
562
|
-
let eikeep= &ei
|
|
563
|
-
set ei=all
|
|
564
|
-
tabnew
|
|
565
|
-
file Decho\ Tab
|
|
566
|
-
setlocal ma
|
|
567
|
-
put ='---------'
|
|
568
|
-
put ='Decho Tab '.g:dechofile
|
|
569
|
-
put ='---------'
|
|
570
|
-
norm! 1GddG
|
|
571
|
-
let g:dechotabnr = tabpagenr()
|
|
572
|
-
let &ei = ""
|
|
573
|
-
set ft=Decho
|
|
574
|
-
set ei=all
|
|
575
|
-
setlocal noma nomod nobl noswf ch=1 fo=n2croql
|
|
576
|
-
exe "tabn ".dechotabcur
|
|
577
|
-
let &ei= eikeep
|
|
578
|
-
endif
|
|
579
|
-
else
|
|
580
|
-
let g:dechomode= s:DECHOWIN
|
|
581
|
-
endif
|
|
582
|
-
|
|
583
|
-
" call Dret("DechoTab")
|
|
584
|
-
endfun
|
|
585
|
-
endif
|
|
586
|
-
|
|
587
|
-
" ---------------------------------------------------------------------
|
|
588
|
-
" End Plugin: {{{1
|
|
589
|
-
let &cpo= s:keepcpo
|
|
590
|
-
unlet s:keepcpo
|
|
591
|
-
" ---------------------------------------------------------------------
|
|
592
|
-
" vim: ts=4 fdm=marker
|