utils 0.0.57 → 0.0.58

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.
@@ -0,0 +1,372 @@
1
+ *decho.txt* Vim Code Debugger Oct 23, 2008
2
+ *Decho.vim*
3
+
4
+ Author: Charles E. Campbell, Jr. <drNchipO@ScampbellPfamilyA.bizM>
5
+ (remove NOSPAM from Campbell's email to use)
6
+ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *decho-copyright*
7
+ The VIM LICENSE applies to Decho.vim and Decho.txt
8
+ (see |copyright|) except use "Decho" instead of "Vim"
9
+ No warranty, express or implied. Use At-Your-Own-Risk.
10
+
11
+
12
+ ==============================================================================
13
+ 1. Contents *decho-contents*
14
+
15
+ 1. Contents......................: |decho-contents|
16
+ 2. Decho Manual..................: |decho|
17
+ 3. Decho Global Variables........: |decho-var|
18
+ 4. Decho History.................: |decho-history|
19
+
20
+ NOTE: as of version 7, Decho requires <cecutil.vim> for
21
+ :DechoOn and :DechoOff (they call SaveWinPosn() and
22
+ RestoreWinPosn() to retain the cursor/screen position)
23
+
24
+
25
+ ==============================================================================
26
+ 2. Decho Manual *decho* *dfunc* *dret*
27
+
28
+ The Decho plugin supports the inlining of debugging code. It allows
29
+ one to store debugging information along with scripts. Many of my]
30
+ own scripts can use this plugin (usually after a :DechoOn is issued).
31
+
32
+ Decho, Dfunc, Dret, and Dredir have several ways to save their
33
+ debugging output: >
34
+
35
+ g:dechomode To Enable To Disable Debugging Output
36
+ ----------- ---------- ----------- ---------------------------
37
+ 1 (default) appended to separate window
38
+ 2 DechoMsgOn DechoMsgOff uses :echomsg
39
+ 3 DechoVarOn DechoVarOff appended to g:dechovar
40
+ 4 DechoRemOn DechoRemOff appended to a remote server
41
+ 5 DechoTabOn DechoTabOff appended to a tab
42
+ <
43
+ Why so many methods? Although the default method, that of writing
44
+ debugging output to a separate debugging window, is often quite
45
+ convenient, sometimes plugins want to control the entire window
46
+ display. Hence a debugging window can cause trouble as it is
47
+ unaccounted for by the plugin. The :echomsg output can be seen with
48
+ |:messages|, but only 20 such messages can be retained. The remote
49
+ server debugging output keeps its "distance" from plugins, but uses
50
+ gvim to open a separate debugging instance. So, pick whichever method
51
+ suits debugging your plugin best.
52
+
53
+ USAGE
54
+ >
55
+ call Decho("another string")
56
+ call Decho("yet","another","string")
57
+ call DechoSep(["extra message"])
58
+ call Dfunc("funcname(".whatever.")")
59
+ call Dredir(["string","string",...,]"cmd")
60
+ call Dret("funcname".whatever)
61
+ Decho "a string"
62
+ DechoMsgOff
63
+ DechoMsgOn
64
+ DechoOn DechoOff
65
+ DechoRemOff
66
+ DechoRemOn
67
+ DechoTabOff
68
+ DechoTabOn
69
+ DechoVarOff
70
+ DechoVarOn [varname]
71
+ Dhide
72
+ Dshow
73
+ Dsep [extra-message]
74
+ <
75
+ The Decho call will put the string(s) passed to it into the debugging
76
+ window (by default, it will be called "DBG". See |decho-var| for
77
+ how to change that). Control characters embedded in the string will
78
+ be made visible with a ^A - ^Z transformation.
79
+
80
+ The Dfunc() and Dret() calls act as a pair. A function to be debugged
81
+ should call, at entry, >
82
+
83
+ call Dfunc("funcname("."any arguments".")")
84
+ <
85
+ It should also call, just prior to any return point, >
86
+
87
+ call Dret("funcname : any return values")
88
+ < or just >
89
+ call Dret("funcname")
90
+ <
91
+ In between, calls to Decho will have their strings preceded by "|"s,
92
+ one for every open Dfunc(). The Dret() will check to insure that it
93
+ is apparently returning from the last function passed to Dfunc().
94
+
95
+ Example: >
96
+ function! MyFunction(x)
97
+ call Dfunc("MyFunction(x=".x.")")
98
+ ...
99
+ call Dret("MyFunction")
100
+ endfunction
101
+ <
102
+ *DechoOn* *DechoOff*
103
+ DechoOn and DechoOff are convenient commands for enabling and disabling
104
+ Decho, Dfunc, and Dret calls in a sourcefile. DechoOff makes any line
105
+ containing one of the following strings: >
106
+
107
+ Decho DechoRemOff DechoTabOn Dfunc
108
+ DechoMsgOff DechoRemOn DechoVarOff Dret
109
+ DechoMsgOn DechoTabOff DechoVarOn
110
+
111
+ < into a comment line and DechoOn reactivates such commands by removing
112
+ the leading comment '"' character.
113
+
114
+ Example: >
115
+ call Decho("this will show up in the DBG buffer")
116
+ <
117
+ *decho-dhide* *decho-dshow*
118
+ The Dhide and Dshow commands allow one to toggle the visibility of
119
+ the DBG-buffer. They use the g:decho_hide variable, plus make any
120
+ current DBG-buffer hidden or visible as indicated.
121
+
122
+ Usage: >
123
+ :Dhide
124
+ :Dshow
125
+ <
126
+ *Dsep* *DechoSep*
127
+ This command (Dsep) and function (call DechoSep([optional msg])
128
+ places a line of the form >
129
+ --sep#-- [optional message here]
130
+ < in the debugging output. The number will be incremented for each
131
+ time this function is invoked. It helps one correlate an action
132
+ with the resulting debugging output.
133
+
134
+ *decho-redir* *Dredir*
135
+ The Dredir() function allows one to redirect (see |redir|) a command's
136
+ output to the debugging buffer. One must have the command to be
137
+ executed as the first argument; optionally, one may include additional
138
+ arguments which will be passed on to Decho() for output.
139
+
140
+ Usage: >
141
+ call Dredir(["string","string",...,]"cmd")
142
+ <
143
+ Example: >
144
+ call Dredir("buffers","ls!")
145
+ <
146
+ *g:decho_bufenter*
147
+ Some plugins use events such as BufEnter, WinEnter, and WinLeave. If
148
+ you set this variable to 1, then such events will be ignored when and
149
+ only when Decho() and variants are used. Setting this option avoids
150
+ such plugins from being triggered when recording debugging messages.
151
+ (examples: winmanager, taglist, multiselect, etc)
152
+
153
+ Example: >
154
+ let g:decho_bufenter= 1
155
+ <
156
+ *DechoVarOn* *DechoVarOff*
157
+ Although debugging to a window is often convenient for the programmer,
158
+ unfortunately some vim applications are incompatible with such a
159
+ window (such as those which do window control themselves). Using >
160
+ :DechoVarOn
161
+ < sends debugging output to be appended to a variable named in the
162
+ |g:dechovarname| variable (by default, its "g:dechovar"). To turn
163
+ this mode off (ie. revert to normal debugging-window use) use >
164
+ :DechoVarOff
165
+ < DechoVarOn also sets g:dechofile with the name of the script that
166
+ invoked it.
167
+ *DechoMsgOn* *DechoMsgOff*
168
+ This debugging method uses echomsg to display messages; they may be
169
+ seen with the |:messages|. Vim usually will retain up to 20 such
170
+ messages (see |message-history|). Use >
171
+ :DechoMsgOn
172
+ < to turn this method on and >
173
+ :DechoMsgOff
174
+ < to revert to normal debugging-window use. This method helps avoid
175
+ interference with some plugins.
176
+ DechoMsgOn also sets g:dechofile with the name of the script that
177
+ invoked it.
178
+
179
+ *DechoRemOn* *DechoRemOff*
180
+ This method will open (if necessary) and use a remote gvim with a
181
+ servername of DECHOREMOTE. Debugging messages are appended to that
182
+ instance of gvim. To have this command available, your vim must have
183
+ |clientserver| enabled and |gvim| must be executable. Use >
184
+ :DechoRemOn
185
+ < to turn this method on and >
186
+ :DechoRemOff
187
+ < to revert to normal debugging-window use. This method helps avoid
188
+ interference with some plugins.
189
+
190
+ DechoRemOn also sets g:dechofile with the name of the script that
191
+ invoked it.
192
+
193
+ *DechoTabOn* *DechoTabOff*
194
+ This method will open (if necessary) and use a debugging tab with
195
+ one window. Debugging messages are appended to the debugging tab
196
+ (see |tabpage|). One may use |gt| to switch between two tabs. Use >
197
+ :DechoTabOn
198
+ < to turn this method on and >
199
+ :DechoTabOff
200
+ < to revert to normal debugging-window use. The Decho and related
201
+ calls turn events off while writing to the debugging tab so as to
202
+ attempt to remain transparent with respect to normal event processing.
203
+
204
+ EXAMPLE
205
+
206
+ Consider the following file: >
207
+ let x="abc"
208
+ let y="def"
209
+ call Dfunc("testing(x=".x.")")
210
+ call Decho("decho test #1")
211
+ call Dfunc("Testing(y=".y.")")
212
+ call Decho("decho test #2")
213
+ call Dret("Testing")
214
+ call Decho("decho test #3")
215
+ call Dret("testing")
216
+ <
217
+ Then sourcing with <Decho.vim> as a plugin (ie. already loaded) yields: >
218
+
219
+ testing(x=abc) {
220
+ |decho test #1
221
+ |Testing(y=def) {
222
+ ||decho test #2
223
+ ||Testing }
224
+ |decho test #3
225
+ |testing }
226
+ <
227
+ DechoRemOn also sets g:dechofile with the name of the script that
228
+ invoked it.
229
+
230
+
231
+ ==============================================================================
232
+ 3. Decho Global Variables *decho-variables* *decho_settings*
233
+ *decho_options* *decho-var*
234
+
235
+ *g:dechomode* : =1 use separate small window at bottom (default)
236
+ =2 debugging messages will use echomsg and can be seen
237
+ by using :messages. See |message-history| for more
238
+ about this; currently, the maximum number of mess-
239
+ ages remembered is 20.
240
+ =3 debugging messages get appended to the variable
241
+ named by |g:dechovarname| (also see |g:dechovar|)
242
+ =4 debugging messages get appended to the gvim remote
243
+ server named DECHOREMOTE.
244
+
245
+ *g:decho_bufname* : by default "DBG" . Sets the name of the debugging
246
+ buffer and window.
247
+ *g:decho_hide* : if set the DBG window will be hidden and will
248
+ automatically "q" each time it is used. To see it,
249
+ :e DBG . Useful for those applications that
250
+ modify windows.
251
+ *g:dechovar* : default value of g:dechovarname (see |g:dechovarname|)
252
+
253
+ *g:dechovarname* : when g:dechomode is 3, debugging output is appended to
254
+ the variable named by this variable
255
+ (default: "g:dechovar" - see |g:dechovar|)
256
+
257
+ *decho_winheight*
258
+ *g:decho_winheight* : by default equal to 5 lines. Specifies the height
259
+ of the debugging window. Every Dfunc/Decho/Dret
260
+ call will resize that window to this height.
261
+
262
+
263
+ ==============================================================================
264
+ 4. Decho History *decho-history*
265
+
266
+ v20 Jun 07, 2007 : * changed some syntax/Decho.vim highlighting definitions
267
+ to avoid the use of highlighting groups defined by
268
+ colors/astronaut.vim that aren't standard (Cyan,
269
+ Magenta) (pointed out by Andreas Politz)
270
+ * (Erik Falor) under windows, uses "start gvim..."so
271
+ that DechoRemOn doesn't keep the original gvim
272
+ blocking until the remote gvim closes.
273
+ * (Erik Falor) The remote gvim now has |'nosi'| sent to it.
274
+ Feb 13, 2008 * changed s:DechoSep() to DechoSep() so that it can be
275
+ called externally. In particular, I'm using (all one
276
+ line): >
277
+ redraw!|call DechoSep()|...
278
+ call inputsave()|call input("Press <cr> to continue")|...
279
+ call inputrestore()
280
+ < to put a temporary halt into code I'm debugging while
281
+ retaining an idea of where in the Debug file it took
282
+ effect.
283
+ May 29, 2008 * Removed an annoying beep that could crop up if
284
+ g:dechotabnr indexed a non-existent tab page.
285
+ Aug 12, 2008 * DechoRemOn left autoindent enabled in the remote
286
+ window which can cause staircasing
287
+ Oct 13, 2008 * in DechoTab mode, the search for the first tab called
288
+ "Decho Tab" didn't start at tab#1 as the search loop
289
+ assumed.
290
+ v19 Oct 16, 2006 : * Dredir now takes optional strings first instead of
291
+ last
292
+ * The :Decho and :Dredir commands now take <args> instead
293
+ of <q-args>, which allows them to act more like the
294
+ function calls do.
295
+ * DechoRemOn's remote vim no longer will have
296
+ formatoptions' a or t suboptions set even if the user
297
+ has specified something like fo+=at in his/her .vimrc.
298
+ * If the user interposes a new tab (or deletes the
299
+ "Decho Tab"), Decho finds the "Decho Tab" tab or
300
+ creates a new one when called.
301
+ v18 Mar 13, 2006 : * now handles arguments which are lists
302
+ * works around ignorecase setting
303
+ * removed bt=nofile; using noswf instead
304
+ Sep 08, 2006 * if DechoRemOn is used, but then the user closes the
305
+ remote window but still sends Decho messages, then
306
+ Decho now switches to DECHOWIN mode to prevent an
307
+ onslaught of error messages about how vim can't connect
308
+ to the DECHOREMOTE vim.
309
+ v17 Mar 03, 2006 : * debugging filetype set to Decho for DechoTabOn and
310
+ DechoRemOn and ei manipulated so that syntax
311
+ highlighting works for the Decho Tab buffer.
312
+ * bugfix: when a buffer was |'noma'|, DechoTabOn
313
+ inherited that and complained about not being allowed
314
+ to modify the buffer.
315
+ v16 Feb 27, 2006 : * reflecting changes to tab commands:
316
+ tab -> tabn, tabn -> tabnew
317
+ v15 Feb 21, 2006 : * DechoTab[On\Off] implemented
318
+ v14 Jan 25, 2006 : * bugfix: with DechoVarOn, Decho would issue error
319
+ messages when the string had single quotes (') in
320
+ it
321
+ * SaveWinPosn(0) used to avoid SWP stack use
322
+ Feb 15, 2006 * DechoRemOn and DechoRemOff now turn debugging on/off to
323
+ a remote DECHOREMOTE gvim server. Your vim must
324
+ support clientserver and gvim must be executable.
325
+ v13 Jan 18, 2006 : * cecutil updated to use keepjumps
326
+ v12 Jan 14, 2005 : * DechoOn/Off now also turns on/off DechoVarOn/Off
327
+ * Now includes a GetLatestVimScripts line for cecutil.vim
328
+ Apr 25, 2005 * Decho now does "runtime plugin/cecutil.vim" if that plugin
329
+ hasn't been loaded yet. It will also try the AsNeeded
330
+ subdirectory if g:loaded_asneeded exists.
331
+ Jun 02, 2005 * with DechoMsgOn, Decho("doesn't") now works
332
+ v11 Aug 06, 2004 : * <q-args> now used instead of <args> for :Decho and :Dredir
333
+ commands
334
+ Oct 28, 2004 * DechoMsgOn and DechoMsgOff installed; debugging messages
335
+ will use the |echomsg| command.
336
+ Dec 27, 2004 * DechoVarOn and DechoVarOff installed; debugging
337
+ messages will be appended to the variable specified by
338
+ g:dechovarname, which by default is "g:dechovar".
339
+ These two commands toggle the variable
340
+ "g:dechovar_enabled".
341
+ Dec 29, 2004 * Dredir() now accepts multiple arguments (cmd and output)
342
+ v10 Jul 27, 2004 : * if g:decho_bufenter exists, Decho will ignore BufEnter
343
+ events
344
+ * Decho uses keepjumps to avoid altering the jumplist
345
+ table
346
+ * appending to the DBG buffer with Decho does not make
347
+ it modified
348
+ * Dredir(cmd) may be used to redirect command output
349
+ to the DBG buffer. Example: call Dredir("cmd")
350
+ v9 Jun 18, 2004 : * Dfunc/Decho/Dret now immune to lcd changes in the DBG
351
+ buffer name
352
+ * DechoOn and DechoOff now accept ranges
353
+ v8 Jun 06, 2004 : * Implemented Dhide and Dshow commands for toggling
354
+ the DBG-buffer's visibility (see |decho_dhide|)
355
+ v7 Jun 02, 2004 : * made creation of DBG window silent
356
+ * g:decho_winheight implemented (see |decho_winheight|)
357
+ * Dfunc/Decho/Dret will always resize the DBG window to the
358
+ number of lines specified by g:decho_winheight (dflt:5)
359
+ * g:decho_hide implemented (see |decho_hide|)
360
+ v6 May 11, 2004 : * some bug fixes
361
+ v5 Apr 20, 2004 : * Dfunc() - for entering a function
362
+ * Dret() - for returning from a function
363
+ v4 Apr 20, 2004 : Now makes control characters visible
364
+ v3 Aug 07, 2003 : * changed fixed "DBG" to g:decho_bufname to allow s/w to
365
+ change the buffer name!
366
+ * Now handles returning cursor to one of several windows
367
+ and having multiple DBG-windows
368
+
369
+
370
+ ==============================================================================
371
+ vim:tw=78:ts=8:ft=help
372
+