Small config and highlightning changes
[my-vim-dotfolder.git] / plugin / AlignMapsPlugin.vim
blobf3023a20254589f962eb9501c1624117a6a32b82
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
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.
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.
24 " The start/end wrappers save and restore marks 'y and 'z.
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.
30 " Note: these maps all use <Align.vim>.
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.
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
46 " =====================================================================
47 "  Maps: {{{1
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>
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>
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
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
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
111 " ---------------------------------------------------------------------
112 " character-based right-justified alignment maps {{{2
113 if !hasmapto('<Plug>AM_T\x16|')|map <unique> <Leader>T\x16|           <Plug>AM_T\x16||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
127 map <silent> <script> <Plug>AM_T\x16| <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
141 " ---------------------------------------------------------------------
142 " character-based left-justified alignment maps {{{2
143 if !hasmapto('<Plug>AM_t\x16|')    |map <unique> <Leader>t\x16|       <Plug>AM_t\x16||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>tw=       <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>tm=       <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
166 map <silent> <script> <Plug>AM_t\x16|              <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
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
235 " =====================================================================
236 "  Restore: {{{1
237 let &cpo= s:keepcpo
238 unlet s:keepcpo
240 " ==============================================================================
241 "  Modelines: {{{1
242 " vim: ts=4 nowrap fdm=marker