utils 0.0.0

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.
Files changed (75) hide show
  1. data/Rakefile +68 -0
  2. data/VERSION +1 -0
  3. data/bin/chroot-exec +12 -0
  4. data/bin/chroot-libs +18 -0
  5. data/bin/classify +37 -0
  6. data/bin/discover +137 -0
  7. data/bin/edit +74 -0
  8. data/bin/errf +32 -0
  9. data/bin/git-empty +8 -0
  10. data/bin/myex +90 -0
  11. data/bin/number_files +26 -0
  12. data/bin/same_files +37 -0
  13. data/bin/search +205 -0
  14. data/bin/sedit +3 -0
  15. data/bin/sshscreen +68 -0
  16. data/bin/term +21 -0
  17. data/bin/unquarantine_apps +8 -0
  18. data/bin/untest +17 -0
  19. data/bin/utils-install-config +10 -0
  20. data/bin/vacuum_firefox_sqlite +22 -0
  21. data/bin/xmp +74 -0
  22. data/lib/utils.rb +8 -0
  23. data/lib/utils/config.rb +23 -0
  24. data/lib/utils/config/gdb/asm +179 -0
  25. data/lib/utils/config/gdb/ruby +528 -0
  26. data/lib/utils/config/gdbinit +8 -0
  27. data/lib/utils/config/irbrc +455 -0
  28. data/lib/utils/config/rdebugrc +2 -0
  29. data/lib/utils/config/screenrc +143 -0
  30. data/lib/utils/config/vim/autoload/Align.vim +1029 -0
  31. data/lib/utils/config/vim/autoload/AlignMaps.vim +330 -0
  32. data/lib/utils/config/vim/autoload/rails.vim +4744 -0
  33. data/lib/utils/config/vim/autoload/rubycomplete.vim +801 -0
  34. data/lib/utils/config/vim/autoload/sqlcomplete.vim +741 -0
  35. data/lib/utils/config/vim/autoload/vimball.vim +750 -0
  36. data/lib/utils/config/vim/colors/flori.vim +113 -0
  37. data/lib/utils/config/vim/compiler/eruby.vim +40 -0
  38. data/lib/utils/config/vim/compiler/ruby.vim +67 -0
  39. data/lib/utils/config/vim/compiler/rubyunit.vim +34 -0
  40. data/lib/utils/config/vim/ftdetect/ragel.vim +2 -0
  41. data/lib/utils/config/vim/ftdetect/ruby.vim +17 -0
  42. data/lib/utils/config/vim/ftplugin/eruby.vim +100 -0
  43. data/lib/utils/config/vim/ftplugin/ruby.vim +260 -0
  44. data/lib/utils/config/vim/ftplugin/xml.vim +941 -0
  45. data/lib/utils/config/vim/indent/IndentAnything_html.vim +35 -0
  46. data/lib/utils/config/vim/indent/eruby.vim +77 -0
  47. data/lib/utils/config/vim/indent/javascript.vim +116 -0
  48. data/lib/utils/config/vim/indent/ruby.vim +377 -0
  49. data/lib/utils/config/vim/plugin/AlignMapsPlugin.vim +242 -0
  50. data/lib/utils/config/vim/plugin/AlignPlugin.vim +41 -0
  51. data/lib/utils/config/vim/plugin/Decho.vim +592 -0
  52. data/lib/utils/config/vim/plugin/IndentAnything.vim +675 -0
  53. data/lib/utils/config/vim/plugin/bufexplorer.vim +1144 -0
  54. data/lib/utils/config/vim/plugin/cecutil.vim +482 -0
  55. data/lib/utils/config/vim/plugin/fugitive.vim +1703 -0
  56. data/lib/utils/config/vim/plugin/lusty-explorer.vim +1509 -0
  57. data/lib/utils/config/vim/plugin/rails.vim +340 -0
  58. data/lib/utils/config/vim/plugin/rubyextra.vim +193 -0
  59. data/lib/utils/config/vim/plugin/surround.vim +628 -0
  60. data/lib/utils/config/vim/plugin/taglist.vim +4546 -0
  61. data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +131 -0
  62. data/lib/utils/config/vim/plugin/vimballPlugin.vim +40 -0
  63. data/lib/utils/config/vim/syntax/Decho.vim +101 -0
  64. data/lib/utils/config/vim/syntax/eruby.vim +73 -0
  65. data/lib/utils/config/vim/syntax/javascript.vim +246 -0
  66. data/lib/utils/config/vim/syntax/ragel.vim +165 -0
  67. data/lib/utils/config/vim/syntax/ruby.vim +367 -0
  68. data/lib/utils/config/vimrc +461 -0
  69. data/lib/utils/file.rb +49 -0
  70. data/lib/utils/find.rb +54 -0
  71. data/lib/utils/md5.rb +23 -0
  72. data/lib/utils/patterns.rb +34 -0
  73. data/lib/utils/version.rb +8 -0
  74. data/utils.gemspec +33 -0
  75. metadata +183 -0
@@ -0,0 +1,242 @@
1
+ " AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
2
+ " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
3
+ " Date: Mar 03, 2009
4
+ "
5
+ " NOTE: the code herein needs vim 6.0 or later
6
+ " needs <Align.vim> v6 or later
7
+ " needs <cecutil.vim> v5 or later
8
+ " Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
9
+ " Permission is hereby granted to use and distribute this code,
10
+ " with or without modifications, provided that this copyright
11
+ " notice is copied with it. Like anything else that's free,
12
+ " AlignMaps.vim is provided *as is* and comes with no warranty
13
+ " of any kind, either expressed or implied. By using this
14
+ " plugin, you agree that in no event will the copyright
15
+ " holder be liable for any damages resulting from the use
16
+ " of this software.
17
+ "
18
+ " Usage: {{{1
19
+ " Use 'a to mark beginning of to-be-aligned region, Alternative: use V
20
+ " move cursor to end of region, and execute map. (linewise visual mode) to
21
+ " The maps also set up marks 'y and 'z, and retain mark region, execute same
22
+ " 'a at the beginning of region. map. Uses 'a, 'y, and 'z.
23
+ "
24
+ " The start/end wrappers save and restore marks 'y and 'z.
25
+ "
26
+ " Although the comments indicate the maps use a leading backslash,
27
+ " actually they use <Leader> (:he mapleader), so the user can
28
+ " specify that the maps start how he or she prefers.
29
+ "
30
+ " Note: these maps all use <Align.vim>.
31
+ "
32
+ " Romans 1:20 For the invisible things of Him since the creation of the {{{1
33
+ " world are clearly seen, being perceived through the things that are
34
+ " made, even His everlasting power and divinity; that they may be
35
+ " without excuse.
36
+
37
+ " ---------------------------------------------------------------------
38
+ " Load Once: {{{1
39
+ if &cp || exists("g:loaded_AlignMapsPlugin")
40
+ finish
41
+ endif
42
+ let s:keepcpo = &cpo
43
+ let g:loaded_AlignMapsPlugin = "v41"
44
+ set cpo&vim
45
+
46
+ " =====================================================================
47
+ " Maps: {{{1
48
+
49
+ " ---------------------------------------------------------------------
50
+ " WS: wrapper start map (internal) {{{2
51
+ " Produces a blank line above and below, marks with 'y and 'z
52
+ if !hasmapto('<Plug>WrapperStart')
53
+ map <unique> <SID>WS <Plug>AlignMapsWrapperStart
54
+ endif
55
+ nmap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
56
+ vmap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
57
+
58
+ " ---------------------------------------------------------------------
59
+ " WE: wrapper end (internal) {{{2
60
+ " Removes guard lines, restores marks y and z, and restores search pattern
61
+ if !hasmapto('<Plug>WrapperEnd')
62
+ nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
63
+ endif
64
+ nmap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
65
+
66
+ " ---------------------------------------------------------------------
67
+ " Complex C-code alignment maps: {{{2
68
+ if !hasmapto('<Plug>AM_a?') |map <unique> <Leader>a? <Plug>AM_a?|endif
69
+ if !hasmapto('<Plug>AM_a,') |map <unique> <Leader>a, <Plug>AM_a,|endif
70
+ if !hasmapto('<Plug>AM_a<') |map <unique> <Leader>a< <Plug>AM_a<|endif
71
+ if !hasmapto('<Plug>AM_a=') |map <unique> <Leader>a= <Plug>AM_a=|endif
72
+ if !hasmapto('<Plug>AM_a(') |map <unique> <Leader>a( <Plug>AM_a(|endif
73
+ if !hasmapto('<Plug>AM_abox') |map <unique> <Leader>abox <Plug>AM_abox|endif
74
+ if !hasmapto('<Plug>AM_acom') |map <unique> <Leader>acom <Plug>AM_acom|endif
75
+ if !hasmapto('<Plug>AM_adcom')|map <unique> <Leader>adcom <Plug>AM_adcom|endif
76
+ if !hasmapto('<Plug>AM_aocom')|map <unique> <Leader>aocom <Plug>AM_aocom|endif
77
+ if !hasmapto('<Plug>AM_ascom')|map <unique> <Leader>ascom <Plug>AM_ascom|endif
78
+ if !hasmapto('<Plug>AM_adec') |map <unique> <Leader>adec <Plug>AM_adec|endif
79
+ if !hasmapto('<Plug>AM_adef') |map <unique> <Leader>adef <Plug>AM_adef|endif
80
+ if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
81
+ if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
82
+ if !hasmapto('<Plug>AM_aunum')|map <unique> <Leader>aunum <Plug>AM_aenum|endif
83
+ if !hasmapto('<Plug>AM_aenum')|map <unique> <Leader>aenum <Plug>AM_aunum|endif
84
+ if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
85
+ if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aenum|endif
86
+ else
87
+ if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aunum|endif
88
+ endif
89
+
90
+ map <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
91
+ map <silent> <script> <Plug>AM_a, <SID>WS:'y,'zs/\(\S\)\s\+/\1 /ge<CR>'yjma'zk:call AlignMaps#CharJoiner(",")<cr>:silent 'y,'zg/,/call AlignMaps#FixMultiDec()<CR>'z:exe "norm \<Plug>AM_adec"<cr><SID>WE
92
+ map <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
93
+ map <silent> <script> <Plug>AM_a( <SID>WS:AlignCtrl mIp0P1=l<CR>:'a,.Align [(,]<CR>:sil 'y+1,'z-1s/\(\s\+\),/,\1/ge<CR><SID>WE
94
+ map <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
95
+ map <silent> <script> <Plug>AM_abox <SID>WS:let g:alignmaps_iws=substitute(getline("'a"),'^\(\s*\).*$','\1','e')<CR>:'a,'z-1s/^\s\+//e<CR>:'a,'z-1s/^.*$/@&@/<CR>:AlignCtrl m=p01P0w @<CR>:'a,.Align<CR>:'a,'z-1s/@/ * /<CR>:'a,'z-1s/@$/*/<CR>'aYP:s/./*/g<CR>0r/'zkYp:s/./*/g<CR>0r A/<Esc>:exe "'a-1,'z-1s/^/".g:alignmaps_iws."/e"<CR><SID>WE
96
+ map <silent> <script> <Plug>AM_acom <SID>WS:'a,.s/\/[*/]\/\=/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:'y,'zs/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(2)<CR>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
97
+ map <silent> <script> <Plug>AM_adcom <SID>WS:'a,.v/^\s*\/[/*]/s/\/[*/]\*\=/@&@/e<CR>:'a,.v/^\s*\/[/*]/s/\*\//@&/e<CR>:'y,'zv/^\s*\/[/*]/s/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(3)<cr>:'y,'zv/^\s*\/[/*]/s/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
98
+ map <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
99
+ map <silent> <script> <Plug>AM_ascom <SID>WS:'a,.s/\/[*/]/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:silent! 'a,.g/^\s*@\/[*/]/s/@//ge<CR>:AlignCtrl v ^\s*\/[*/]<CR>:AlignCtrl g \/[*/]<CR>'zk:call AlignMaps#StdAlign(2)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
100
+ map <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%(\K\k*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<CR>:call AlignMaps#StdAlign(1)<cr>:'y,'zv/^\s*[*/]/s/@ //ge<CR>:'y,'zv/^\s*[*/]/s/\(\s*\);/;\1/e<CR>:'y,'zv/^#/s/# //e<CR>:'y,'zv/^\s\+[*/#]/s/\([^/*]\)\(\*\+\)\( \+\)/\1\3\2/e<CR>:'y,'zv/^\s\+[*/#]/s/\((\+\)\( \+\)\*/\2\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/^\(\s\+\) \*/\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/[ \t@]*$//e<CR>:'y,'zs/^[*]/ */e<CR><SID>WE
101
+ map <silent> <script> <Plug>AM_adef <SID>WS:AlignPush<CR>:AlignCtrl v ^\s*\(\/\*\<bar>\/\/\)<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/^\(\s*\)#\(\s\)*define\s*\(\I[a-zA-Z_0-9(),]*\)\s*\(.\{-}\)\($\<Bar>\/\*\)/#\1\2define @\3@\4@\5/e<CR>:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/\($\<Bar>\*\/\)/@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>'yjma'zk:'a,.v/^\s*\(\/\*\<bar>\/\/\)/s/ @//g<CR><SID>WE
102
+ map <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
103
+ map <silent> <script> <Plug>AM_aunum <SID>WS:'a,'zs/\%([0-9.]\)\s\+\zs\([-+.]\=\d\)/@\1/ge<CR>:'a,'zs/\(\(^\|\s\)\d\+\)\(\s\+\)@/\1@\3@/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [.@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(\.\)\(\s\+\)\([0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
104
+ map <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\%([0-9.]\)\s\+\([-+]\=\d\)/\1@\2/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [,@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(,\)\(\s\+\)\([-0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
105
+
106
+ " ---------------------------------------------------------------------
107
+ " html table alignment {{{2
108
+ if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
109
+ map <silent> <script> <Plug>AM_Htd <SID>WS:'y,'zs%<[tT][rR]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]><[tT][dD][^>]\{-}>\<Bar></[tT][dD]></[tT][rR]>%@&@%g<CR>'yjma'zk:AlignCtrl m=Ilp1P0 @<CR>:'a,.Align<CR>:'y,'zs/ @/@/<CR>:'y,'zs/@ <[tT][rR]>/<[tT][rR]>/ge<CR>:'y,'zs/@//ge<CR><SID>WE
110
+
111
+ " ---------------------------------------------------------------------
112
+ " character-based right-justified alignment maps {{{2
113
+ if !hasmapto('<Plug>AM_T|')|map <unique> <Leader>T| <Plug>AM_T||endif
114
+ if !hasmapto('<Plug>AM_T#') |map <unique> <Leader>T# <Plug>AM_T#|endif
115
+ if !hasmapto('<Plug>AM_T,') |map <unique> <Leader>T, <Plug>AM_T,o|endif
116
+ if !hasmapto('<Plug>AM_Ts,') |map <unique> <Leader>Ts, <Plug>AM_Ts,|endif
117
+ if !hasmapto('<Plug>AM_T:') |map <unique> <Leader>T: <Plug>AM_T:|endif
118
+ if !hasmapto('<Plug>AM_T;') |map <unique> <Leader>T; <Plug>AM_T;|endif
119
+ if !hasmapto('<Plug>AM_T<') |map <unique> <Leader>T< <Plug>AM_T<|endif
120
+ if !hasmapto('<Plug>AM_T=') |map <unique> <Leader>T= <Plug>AM_T=|endif
121
+ if !hasmapto('<Plug>AM_T?') |map <unique> <Leader>T? <Plug>AM_T?|endif
122
+ if !hasmapto('<Plug>AM_T@') |map <unique> <Leader>T@ <Plug>AM_T@|endif
123
+ if !hasmapto('<Plug>AM_Tab') |map <unique> <Leader>Tab <Plug>AM_Tab|endif
124
+ if !hasmapto('<Plug>AM_Tsp') |map <unique> <Leader>Tsp <Plug>AM_Tsp|endif
125
+ if !hasmapto('<Plug>AM_T~') |map <unique> <Leader>T~ <Plug>AM_T~|endif
126
+
127
+ map <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
128
+ map <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
129
+ map <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
130
+ map <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
131
+ map <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
132
+ map <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
133
+ map <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
134
+ map <silent> <script> <Plug>AM_T= <SID>WS:'a,'z-1s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'z-1s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'z-1s/; */;@/e<CR>:'a,'z-1s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'z-1s/!=/\x="!\<Char-0x0f>"/ge<CR>:AlignCtrl mIp1P1=r = @<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s/; *@/;/e<CR>:'a,'z-1s/; *$/;/e<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-1s/\xff/=/ge<CR><SID>WE:exe "norm <Plug>acom"
135
+ map <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
136
+ map <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
137
+ map <silent> <script> <Plug>AM_Tab <SID>WS:'a,.s/^\(\t*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\t','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
138
+ map <silent> <script> <Plug>AM_Tsp <SID>WS:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
139
+ map <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
140
+
141
+ " ---------------------------------------------------------------------
142
+ " character-based left-justified alignment maps {{{2
143
+ if !hasmapto('<Plug>AM_t|') |map <unique> <Leader>t| <Plug>AM_t||endif
144
+ if !hasmapto('<Plug>AM_t#') |map <unique> <Leader>t# <Plug>AM_t#|endif
145
+ if !hasmapto('<Plug>AM_t,') |map <unique> <Leader>t, <Plug>AM_t,|endif
146
+ if !hasmapto('<Plug>AM_t:') |map <unique> <Leader>t: <Plug>AM_t:|endif
147
+ if !hasmapto('<Plug>AM_t;') |map <unique> <Leader>t; <Plug>AM_t;|endif
148
+ if !hasmapto('<Plug>AM_t<') |map <unique> <Leader>t< <Plug>AM_t<|endif
149
+ if !hasmapto('<Plug>AM_t=') |map <unique> <Leader>t= <Plug>AM_t=|endif
150
+ if !hasmapto('<Plug>AM_ts,') |map <unique> <Leader>ts, <Plug>AM_ts,|endif
151
+ if !hasmapto('<Plug>AM_ts:') |map <unique> <Leader>ts: <Plug>AM_ts:|endif
152
+ if !hasmapto('<Plug>AM_ts;') |map <unique> <Leader>ts; <Plug>AM_ts;|endif
153
+ if !hasmapto('<Plug>AM_ts<') |map <unique> <Leader>ts< <Plug>AM_ts<|endif
154
+ if !hasmapto('<Plug>AM_ts=') |map <unique> <Leader>ts= <Plug>AM_ts=|endif
155
+ if !hasmapto('<Plug>AM_w=') |map <unique> <Leader>w= <Plug>AM_w=|endif
156
+ if !hasmapto('<Plug>AM_t?') |map <unique> <Leader>t? <Plug>AM_t?|endif
157
+ if !hasmapto('<Plug>AM_t~') |map <unique> <Leader>t~ <Plug>AM_t~|endif
158
+ if !hasmapto('<Plug>AM_t@') |map <unique> <Leader>t@ <Plug>AM_t@|endif
159
+ if !hasmapto('<Plug>AM_m=') |map <unique> <Leader>m= <Plug>AM_m=|endif
160
+ if !hasmapto('<Plug>AM_tab') |map <unique> <Leader>tab <Plug>AM_tab|endif
161
+ if !hasmapto('<Plug>AM_tml') |map <unique> <Leader>tml <Plug>AM_tml|endif
162
+ if !hasmapto('<Plug>AM_tsp') |map <unique> <Leader>tsp <Plug>AM_tsp|endif
163
+ if !hasmapto('<Plug>AM_tsq') |map <unique> <Leader>tsq <Plug>AM_tsq|endif
164
+ if !hasmapto('<Plug>AM_tt') |map <unique> <Leader>tt <Plug>AM_tt|endif
165
+
166
+ map <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
167
+ map <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
168
+ map <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
169
+ map <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
170
+ map <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
171
+ map <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
172
+ map <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
173
+ map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)#/,\1/ge<CR><SID>WE
174
+ map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\),/,\1/ge<CR><SID>WE
175
+ map <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\):/:\1/ge<CR><SID>WE
176
+ map <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\);/;\1/ge<CR><SID>WE
177
+ map <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)</<\1/ge<CR><SID>WE
178
+ map <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)=/=\1/ge<CR><SID>WE
179
+ map <silent> <script> <Plug>AM_w= <SID>WS:'a,'zg/=/s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zg/=/s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zg/=/s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zg/=/s/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mWp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1g/=/Align<CR>:'a,'z-1g/=/s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1g/=/s/\( \+\);/;\1/ge<CR>:'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e<CR>:'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1g/=/s/\xff/=/ge<CR>:'y,'zg/=/s/ @//eg<CR><SID>WE
180
+ map <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
181
+ map <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
182
+ map <silent> <script> <Plug>AM_t@ <SID>WS::call AlignMaps#StdAlign(1)<cr>:<SID>WE
183
+ map <silent> <script> <Plug>AM_m= <SID>WS:'a,'zs/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zs@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zs/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mIp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-s/%\ze[^=]/ @%@ /e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1s/\xff/=/ge<CR>:'y,'zs/ @//eg<CR><SID>WE
184
+ map <silent> <script> <Plug>AM_tab <SID>WS:'a,.s/^\(\t*\)\(.*\)$/\=submatch(1).escape(substitute(submatch(2),'\t',"\<Char-0x0f>",'g'),'\')/<CR>:if &ts == 1<bar>exe "AlignCtrl mI=lp0P0 \<Char-0x0f>"<bar>else<bar>exe "AlignCtrl mI=l \<Char-0x0f>"<bar>endif<CR>:'a,.Align<CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
185
+ map <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
186
+ map <silent> <script> <Plug>AM_tsp <SID>WS:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
187
+ map <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:'y+1,'z-1s/[%@]/ /g<CR><SID>WE
188
+ map <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
189
+
190
+ " =====================================================================
191
+ " Menu Support: {{{1
192
+ " ma ..move.. use menu
193
+ " v V or ctrl-v ..move.. use menu
194
+ if has("menu") && has("gui_running") && &go =~ 'm' && !exists("s:firstmenu")
195
+ let s:firstmenu= 1
196
+ if !exists("g:DrChipTopLvlMenu")
197
+ let g:DrChipTopLvlMenu= "DrChip."
198
+ endif
199
+ if g:DrChipTopLvlMenu != ""
200
+ let s:mapleader = exists("g:mapleader")? g:mapleader : '\'
201
+ let s:emapleader= escape(s:mapleader,'\ ')
202
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.<<\ and\ >><tab>'.s:emapleader.'a< '.s:mapleader.'a<'
203
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ =<tab>'.s:emapleader.'t= '.s:mapleader.'t='
204
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ :=<tab>'.s:emapleader.'a= '.s:mapleader.'a='
205
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Backslashes<tab>'.s:emapleader.'tml '.s:mapleader.'tml'
206
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Breakup\ Comma\ Declarations<tab>'.s:emapleader.'a, '.s:mapleader.'a,'
207
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.C\ Comment\ Box<tab>'.s:emapleader.'abox '.s:mapleader.'abox'
208
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'t, '.s:mapleader.'t,'
209
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'ts, '.s:mapleader.'ts,'
210
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas\ With\ Strings<tab>'.s:emapleader.'tsq '.s:mapleader.'tsq'
211
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments<tab>'.s:emapleader.'acom '.s:mapleader.'acom'
212
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments\ Only<tab>'.s:emapleader.'aocom '.s:mapleader.'aocom'
213
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declaration\ Comments<tab>'.s:emapleader.'adcom '.s:mapleader.'adcom'
214
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declarations<tab>'.s:emapleader.'adec '.s:mapleader.'adec'
215
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Definitions<tab>'.s:emapleader.'adef '.s:mapleader.'adef'
216
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Function\ Header<tab>'.s:emapleader.'afnc '.s:mapleader.'afnc'
217
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Html\ Tables<tab>'.s:emapleader.'Htd '.s:mapleader.'Htd'
218
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.(\.\.\.)?\.\.\.\ :\ \.\.\.<tab>'.s:emapleader.'a? '.s:mapleader.'a?'
219
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers<tab>'.s:emapleader.'anum '.s:mapleader.'anum'
220
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (American-Style)<tab>'.s:emapleader.'aunum <Leader>aunum '.s:mapleader.'aunum <Leader>aunum'
221
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (Euro-Style)<tab>'.s:emapleader.'aenum '.s:mapleader.'aenum'
222
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Left\ Justified)<tab>'.s:emapleader.'tsp '.s:mapleader.'tsp'
223
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Right\ Justified)<tab>'.s:emapleader.'Tsp '.s:mapleader.'Tsp'
224
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Statements\ With\ Percent\ Style\ Comments<tab>'.s:emapleader.'m= '.s:mapleader.'m='
225
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ <<tab>'.s:emapleader.'t< '.s:mapleader.'t<'
226
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ \|<tab>'.s:emapleader.'t\| '.s:mapleader.'t|'
227
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ @<tab>'.s:emapleader.'t@ '.s:mapleader.'t@'
228
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ #<tab>'.s:emapleader.'t# '.s:mapleader.'t#'
229
+ exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Tabs<tab>'.s:emapleader.'tab '.s:mapleader.'tab'
230
+ unlet s:mapleader
231
+ unlet s:emapleader
232
+ endif
233
+ endif
234
+
235
+ " =====================================================================
236
+ " Restore: {{{1
237
+ let &cpo= s:keepcpo
238
+ unlet s:keepcpo
239
+
240
+ " ==============================================================================
241
+ " Modelines: {{{1
242
+ " vim: ts=4 nowrap fdm=marker
@@ -0,0 +1,41 @@
1
+ " AlignPlugin: tool to align multiple fields based on one or more separators
2
+ " Author: Charles E. Campbell, Jr.
3
+ " Date: Nov 02, 2008
4
+ " GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
5
+ " GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
6
+ " Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1
7
+ " Permission is hereby granted to use and distribute this code,
8
+ " with or without modifications, provided that this copyright
9
+ " notice is copied with it. Like anything else that's free,
10
+ " Align.vim is provided *as is* and comes with no warranty
11
+ " of any kind, either expressed or implied. By using this
12
+ " plugin, you agree that in no event will the copyright
13
+ " holder be liable for any damages resulting from the use
14
+ " of this software.
15
+ "
16
+ " Romans 1:16,17a : For I am not ashamed of the gospel of Christ, for it is {{{1
17
+ " the power of God for salvation for everyone who believes; for the Jew first,
18
+ " and also for the Greek. For in it is revealed God's righteousness from
19
+ " faith to faith.
20
+ " ---------------------------------------------------------------------
21
+ " Load Once: {{{1
22
+ if &cp || exists("g:loaded_AlignPlugin")
23
+ finish
24
+ endif
25
+ let g:loaded_AlignPlugin = "v35"
26
+ let s:keepcpo = &cpo
27
+ set cpo&vim
28
+
29
+ " ---------------------------------------------------------------------
30
+ " Public Interface: {{{1
31
+ com! -bang -range -nargs=* Align <line1>,<line2>call Align#Align(<bang>0,<q-args>)
32
+ com! -range -nargs=0 AlignReplaceQuotedSpaces <line1>,<line2>call Align#AlignReplaceQuotedSpaces()
33
+ com! -nargs=* AlignCtrl call Align#AlignCtrl(<q-args>)
34
+ com! -nargs=0 AlignPush call Align#AlignPush()
35
+ com! -nargs=0 AlignPop call Align#AlignPop()
36
+
37
+ " ---------------------------------------------------------------------
38
+ " Restore: {{{1
39
+ let &cpo= s:keepcpo
40
+ unlet s:keepcpo
41
+ " vim: ts=4 fdm=marker
@@ -0,0 +1,592 @@
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