aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMax Christian Pohle2018-10-23 07:59:42 +0200
committerMax Christian Pohle2018-10-23 07:59:42 +0200
commit6284983fedcbdc54874d6e657047994b292be480 (patch)
tree02ead1e97aeda7d0161393e94e3b57856963afc1 /plugin
parentf2e01d7e513067ddb57c75f6e38cdcf434946cf8 (diff)
downloadvim-6284983fedcbdc54874d6e657047994b292be480.tar.bz2
vim-6284983fedcbdc54874d6e657047994b292be480.zip
Improved submodule handling
Diffstat (limited to 'plugin')
-rw-r--r--plugin/AlignMapsPlugin.vim253
-rw-r--r--plugin/AlignPlugin.vim41
-rw-r--r--plugin/cecutil.vim482
3 files changed, 0 insertions, 776 deletions
diff --git a/plugin/AlignMapsPlugin.vim b/plugin/AlignMapsPlugin.vim
deleted file mode 100644
index 7296f7f..0000000
--- a/plugin/AlignMapsPlugin.vim
+++ /dev/null
@@ -1,253 +0,0 @@
1" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
2" Maintainer: Dr. Charles E. Campbell. <NdrOchipS@PcampbellAfamily.Mbiz>
3" Date: Jan 07, 2013
4"
5" NOTE: the code herein needs vim 7.0 or later
6" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{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" AlignMaps.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" Romans 1:20 For the invisible things of Him since the creation of the {{{1
16" world are clearly seen, being perceived through the things that are
17" made, even His everlasting power and divinity; that they may be
18" without excuse.
19
20" ---------------------------------------------------------------------
21" Usage: {{{1
22" Use 'a to mark beginning of to-be-aligned region, Alternative: use V
23" move cursor to end of region, and execute map. (linewise visual mode) to
24" The maps also set up marks 'y and 'z, and retain mark region, execute same
25" 'a at the beginning of region. map. Uses 'a, 'y, and 'z.
26"
27" The start/end wrappers save and restore marks 'y and 'z.
28"
29" Although the comments indicate the maps use a leading backslash,
30" actually they use <Leader> (:he mapleader), so the user can
31" specify that the maps start how he or she prefers.
32"
33" Note: these maps all use <Align.vim>.
34"
35" Load Once: {{{1
36if &cp || exists("g:loaded_AlignMapsPlugin")
37 finish
38endif
39let s:keepcpo = &cpo
40let g:loaded_AlignMapsPlugin = "v43"
41set cpo&vim
42
43" =====================================================================
44" Public Interface: {{{1
45com! AlignMapsClean :call AlignMaps#AlignMapsClean()
46
47" =====================================================================
48" Maps: {{{1
49
50" ---------------------------------------------------------------------
51" WS: wrapper start map (internal) {{{2
52" Produces a blank line above and below, marks with 'y and 'z
53if !hasmapto('<Plug>WrapperStart')
54 map <unique> <SID>WS <Plug>AlignMapsWrapperStart
55endif
56nnoremap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
57vnoremap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
58
59" ---------------------------------------------------------------------
60" WE: wrapper end (internal) {{{2
61" Removes guard lines, restores marks y and z, and restores search pattern
62if !hasmapto('<Plug>WrapperEnd')
63 nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
64endif
65nnoremap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
66
67" ---------------------------------------------------------------------
68" Complex C-code alignment maps: {{{2
69if !hasmapto('<Plug>AM_a?') |call AlignMaps#MakeMap("a?")|endif
70if !hasmapto('<Plug>AM_a,') |call AlignMaps#MakeMap("a,")|endif
71if !hasmapto('<Plug>AM_a<') |call AlignMaps#MakeMap("a<")|endif
72if !hasmapto('<Plug>AM_a=') |call AlignMaps#MakeMap("a=")|endif
73if !hasmapto('<Plug>AM_a(') |call AlignMaps#MakeMap("a(")|endif
74if !hasmapto('<Plug>AM_abox') |call AlignMaps#MakeMap("abox")|endif
75if !hasmapto('<Plug>AM_acom') |call AlignMaps#MakeMap("acom")|endif
76if !hasmapto('<Plug>AM_adcom')|call AlignMaps#MakeMap("adcom")|endif
77if !hasmapto('<Plug>AM_aocom')|call AlignMaps#MakeMap("aocom")|endif
78if !hasmapto('<Plug>AM_ascom')|call AlignMaps#MakeMap("ascom")|endif
79if !hasmapto('<Plug>AM_adec') |call AlignMaps#MakeMap("adec")|endif
80if !hasmapto('<Plug>AM_adef') |call AlignMaps#MakeMap("adef")|endif
81if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
82if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
83
84" ---------------------------------------------------------------------
85" Number alignment maps: {{{2
86if !hasmapto('<Plug>AM_aunum')|call AlignMaps#MakeMap("aunum")|endif
87if !hasmapto('<Plug>AM_aenum')|call AlignMaps#MakeMap("aenum")|endif
88if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
89 if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
90else
91 if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
92endif
93
94" ---------------------------------------------------------------------
95" Plug maps: (the real thing) {{{2
96nnoremap <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
97nnoremap <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
98nnoremap <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
99nnoremap <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
100nnoremap <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
101nnoremap <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
102nnoremap <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
103nnoremap <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
104nnoremap <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
105nnoremap <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
106nnoremap <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*\%([a-zA-Z_][a-zA-Z_0-9<>:]*\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
107nnoremap <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
108nnoremap <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
109nnoremap <silent> <script> <Plug>AM_aunum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([.eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#\././ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([.#]\d*\)\=\<bar>[.#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#.]<CR>:'a,'zs/\([.#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
110nnoremap <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([,eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#,/,/ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([,#]\d*\)\=\<bar>[,#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#,]<CR>:'a,'zs/\([,#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE
111" ---------------------------------------------------------------------
112" html table alignment {{{2
113if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
114map <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
115
116" ---------------------------------------------------------------------
117" character-based right-justified alignment maps {{{2
118if !hasmapto('<Plug>AM_T|')|call AlignMaps#MakeMap("T|")|endif
119if !hasmapto('<Plug>AM_T#') |call AlignMaps#MakeMap("T#")|endif
120if !hasmapto('<Plug>AM_T,') |call AlignMaps#MakeMap("T,")|endif
121if !hasmapto('<Plug>AM_Ts,') |call AlignMaps#MakeMap("Ts,")|endif
122if !hasmapto('<Plug>AM_T:') |call AlignMaps#MakeMap("T:")|endif
123if !hasmapto('<Plug>AM_T;') |call AlignMaps#MakeMap("T;")|endif
124if !hasmapto('<Plug>AM_T<') |call AlignMaps#MakeMap("T<")|endif
125if !hasmapto('<Plug>AM_T=') |call AlignMaps#MakeMap("T=")|endif
126if !hasmapto('<Plug>AM_T?') |call AlignMaps#MakeMap("T?")|endif
127if !hasmapto('<Plug>AM_T@') |call AlignMaps#MakeMap("T@")|endif
128if !hasmapto('<Plug>AM_TW@') |call AlignMaps#MakeMap("TW@")|endif
129if !hasmapto('<Plug>AM_Tab') |call AlignMaps#MakeMap("Tab")|endif
130if !hasmapto('<Plug>AM_Tsp') |call AlignMaps#MakeMap("Tsp")|endif
131if !hasmapto('<Plug>AM_T~') |call AlignMaps#MakeMap("T~")|endif
132
133nnoremap <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
134nnoremap <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
135nnoremap <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
136nnoremap <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
137nnoremap <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
138nnoremap <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
139nnoremap <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
140nnoremap <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"
141nnoremap <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
142nnoremap <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
143nnoremap <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
144nnoremap <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
145nnoremap <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
146nnoremap <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
147
148" ---------------------------------------------------------------------
149" character-based left-justified alignment maps {{{2
150if !hasmapto('<Plug>AM_t|','n') |call AlignMaps#MakeMap("t|")|endif
151if !hasmapto('<Plug>AM_t#','n') |call AlignMaps#MakeMap("t#")|endif
152if !hasmapto('<Plug>AM_t,','n') |call AlignMaps#MakeMap("t,")|endif
153if !hasmapto('<Plug>AM_t:','n') |call AlignMaps#MakeMap("t:")|endif
154if !hasmapto('<Plug>AM_t;','n') |call AlignMaps#MakeMap("t;")|endif
155if !hasmapto('<Plug>AM_t<','n') |call AlignMaps#MakeMap("t<")|endif
156if !hasmapto('<Plug>AM_t=','n') |call AlignMaps#MakeMap("t=")|endif
157if !hasmapto('<Plug>AM_ts,','n') |call AlignMaps#MakeMap("ts,")|endif
158if !hasmapto('<Plug>AM_ts:','n') |call AlignMaps#MakeMap("ts:")|endif
159if !hasmapto('<Plug>AM_ts;','n') |call AlignMaps#MakeMap("ts;")|endif
160if !hasmapto('<Plug>AM_ts<','n') |call AlignMaps#MakeMap("ts<")|endif
161if !hasmapto('<Plug>AM_ts=','n') |call AlignMaps#MakeMap("ts=")|endif
162if !hasmapto('<Plug>AM_w=','n') |call AlignMaps#MakeMap("w=")|endif
163if !hasmapto('<Plug>AM_t?','n') |call AlignMaps#MakeMap("t?")|endif
164if !hasmapto('<Plug>AM_t~','n') |call AlignMaps#MakeMap("t~")|endif
165if !hasmapto('<Plug>AM_t@','n') |call AlignMaps#MakeMap("t@")|endif
166if !hasmapto('<Plug>AM_tW@','n') |call AlignMaps#MakeMap("tW@")|endif
167if !hasmapto('<Plug>AM_m=','n') |call AlignMaps#MakeMap("m=")|endif
168if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
169if !hasmapto('<Plug>AM_tml','n') |call AlignMaps#MakeMap("tml")|endif
170if !hasmapto('<Plug>AM_tsp','n') |call AlignMaps#MakeMap("tsp")|endif
171if !hasmapto('<Plug>AM_tsq','n') |call AlignMaps#MakeMap("tsq")|endif
172if !hasmapto('<Plug>AM_tt','n') |call AlignMaps#MakeMap("tt")|endif
173if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
174
175" <Plug> normal mode mappings
176nnoremap <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
177nnoremap <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
178nnoremap <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
179nnoremap <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
180nnoremap <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
181nnoremap <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
182nnoremap <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
183nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
184nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
185nnoremap <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
186nnoremap <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
187nnoremap <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
188nnoremap <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
189nnoremap <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
190nnoremap <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
191nnoremap <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
192nnoremap <silent> <script> <Plug>AM_t@ <SID>WS:call AlignMaps#StdAlign(1)<cr><SID>WE
193nnoremap <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
194nnoremap <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
195nnoremap <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"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
196nnoremap <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
197nnoremap <silent> <script> <Plug>AM_tsp <SID>WS:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/@/ /g<CR><SID>WE
198nnoremap <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/[%@]/ /g<CR><SID>WE
199nnoremap <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
200
201" =====================================================================
202" Menu Support: {{{1
203" ma ..move.. use menu
204" v V or ctrl-v ..move.. use menu
205if has("menu") && has("gui_running") && &go =~# 'm' && !exists("s:firstmenu")
206 let s:firstmenu= 1
207 if !exists("g:DrChipTopLvlMenu")
208 let g:DrChipTopLvlMenu= "DrChip."
209 endif
210 if g:DrChipTopLvlMenu != ""
211 let s:mapleader = exists("g:mapleader")? g:mapleader : '\'
212 let s:emapleader= escape(s:mapleader,'\ ')
213 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.<<\ and\ >><tab>'.s:emapleader.'a< '.s:mapleader.'a<'
214 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ =<tab>'.s:emapleader.'t= '.s:mapleader.'t='
215 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Assignment\ :=<tab>'.s:emapleader.'a= '.s:mapleader.'a='
216 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Backslashes<tab>'.s:emapleader.'tml '.s:mapleader.'tml'
217 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Breakup\ Comma\ Declarations<tab>'.s:emapleader.'a, '.s:mapleader.'a,'
218 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.C\ Comment\ Box<tab>'.s:emapleader.'abox '.s:mapleader.'abox'
219 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'t, '.s:mapleader.'t,'
220 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas<tab>'.s:emapleader.'ts, '.s:mapleader.'ts,'
221 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Commas\ With\ Strings<tab>'.s:emapleader.'tsq '.s:mapleader.'tsq'
222 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments<tab>'.s:emapleader.'acom '.s:mapleader.'acom'
223 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Comments\ Only<tab>'.s:emapleader.'aocom '.s:mapleader.'aocom'
224 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declaration\ Comments<tab>'.s:emapleader.'adcom '.s:mapleader.'adcom'
225 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Declarations<tab>'.s:emapleader.'adec '.s:mapleader.'adec'
226 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Definitions<tab>'.s:emapleader.'adef '.s:mapleader.'adef'
227 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Function\ Header<tab>'.s:emapleader.'afnc '.s:mapleader.'afnc'
228 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Html\ Tables<tab>'.s:emapleader.'Htd '.s:mapleader.'Htd'
229 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.(\.\.\.)?\.\.\.\ :\ \.\.\.<tab>'.s:emapleader.'a? '.s:mapleader.'a?'
230 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers<tab>'.s:emapleader.'anum '.s:mapleader.'anum'
231 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (American-Style)<tab>'.s:emapleader.'aunum <Leader>aunum '.s:mapleader.'aunum <Leader>aunum'
232 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Numbers\ (Euro-Style)<tab>'.s:emapleader.'aenum '.s:mapleader.'aenum'
233 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Left\ Justified)<tab>'.s:emapleader.'tsp '.s:mapleader.'tsp'
234 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Spaces\ (Right\ Justified)<tab>'.s:emapleader.'Tsp '.s:mapleader.'Tsp'
235 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Statements\ With\ Percent\ Style\ Comments<tab>'.s:emapleader.'m= '.s:mapleader.'m='
236 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ <<tab>'.s:emapleader.'t< '.s:mapleader.'t<'
237 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ \|<tab>'.s:emapleader.'t\| '.s:mapleader.'t|'
238 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ @<tab>'.s:emapleader.'t@ '.s:mapleader.'t@'
239 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Symbol\ #<tab>'.s:emapleader.'t# '.s:mapleader.'t#'
240 exe 'menu '.g:DrChipTopLvlMenu.'AlignMaps.Tabs<tab>'.s:emapleader.'tab '.s:mapleader.'tab'
241 unlet s:mapleader
242 unlet s:emapleader
243 endif
244endif
245
246" =====================================================================
247" Restore: {{{1
248let &cpo= s:keepcpo
249unlet s:keepcpo
250
251" ==============================================================================
252" Modelines: {{{1
253" vim: ts=4 nowrap fdm=marker
diff --git a/plugin/AlignPlugin.vim b/plugin/AlignPlugin.vim
deleted file mode 100644
index 50c53d6..0000000
--- a/plugin/AlignPlugin.vim
+++ /dev/null
@@ -1,41 +0,0 @@
1" AlignPlugin: tool to align multiple fields based on one or more separators
2" Author: Charles E. Campbell
3" Date: Nov 02, 2008
4" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
5" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
6" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{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
22if &cp || exists("g:loaded_AlignPlugin")
23 finish
24endif
25let g:loaded_AlignPlugin = "v37"
26let s:keepcpo = &cpo
27set cpo&vim
28
29" ---------------------------------------------------------------------
30" Public Interface: {{{1
31com! -bang -range -nargs=* Align <line1>,<line2>call Align#Align(<bang>0,<q-args>)
32com! -range -nargs=0 AlignReplaceQuotedSpaces <line1>,<line2>call Align#AlignReplaceQuotedSpaces()
33com! -nargs=* AlignCtrl call Align#AlignCtrl(<q-args>)
34com! -nargs=0 AlignPush call Align#AlignPush()
35com! -nargs=0 AlignPop call Align#AlignPop()
36
37" ---------------------------------------------------------------------
38" Restore: {{{1
39let &cpo= s:keepcpo
40unlet s:keepcpo
41" vim: ts=4 fdm=marker
diff --git a/plugin/cecutil.vim b/plugin/cecutil.vim
deleted file mode 100644
index 506b7bf..0000000
--- a/plugin/cecutil.vim
+++ /dev/null
@@ -1,482 +0,0 @@
1" cecutil.vim : save/restore window position
2" save/restore mark position
3" save/restore selected user maps
4" Author: Charles E. Campbell, Jr.
5" Version: 17
6" Date: Sep 04, 2007
7"
8" Saving Restoring Destroying Marks: {{{1
9" call SaveMark(markname) let savemark= SaveMark(markname)
10" call RestoreMark(markname) call RestoreMark(savemark)
11" call DestroyMark(markname)
12" commands: SM RM DM
13"
14" Saving Restoring Destroying Window Position: {{{1
15" call SaveWinPosn() let winposn= SaveWinPosn()
16" call RestoreWinPosn() call RestoreWinPosn(winposn)
17" \swp : save current window/buffer's position
18" \rwp : restore current window/buffer's previous position
19" commands: SWP RWP
20"
21" Saving And Restoring User Maps: {{{1
22" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
23" call RestoreUserMaps(suffix)
24"
25" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
26"
27" You believe that God is one. You do well. The demons also {{{1
28" believe, and shudder. But do you want to know, vain man, that
29" faith apart from works is dead? (James 2:19,20 WEB)
30
31" Load Once: {{{1
32if &cp || exists("g:loaded_cecutil")
33 finish
34endif
35let g:loaded_cecutil = "v17"
36let s:keepcpo = &cpo
37set cpo&vim
38"DechoVarOn
39
40" -----------------------
41" Public Interface: {{{1
42" -----------------------
43
44" Map Interface: {{{2
45if !hasmapto('<Plug>SaveWinPosn')
46 map <unique> <Leader>swp <Plug>SaveWinPosn
47endif
48if !hasmapto('<Plug>RestoreWinPosn')
49 map <unique> <Leader>rwp <Plug>RestoreWinPosn
50endif
51nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
52nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
53
54" Command Interface: {{{2
55com! -bar -nargs=0 SWP call SaveWinPosn()
56com! -bar -nargs=0 RWP call RestoreWinPosn()
57com! -bar -nargs=1 SM call SaveMark(<q-args>)
58com! -bar -nargs=1 RM call RestoreMark(<q-args>)
59com! -bar -nargs=1 DM call DestroyMark(<q-args>)
60
61if v:version < 630
62 let s:modifier= "sil "
63else
64 let s:modifier= "sil keepj "
65endif
66
67" ---------------------------------------------------------------------
68" SaveWinPosn: {{{1
69" let winposn= SaveWinPosn() will save window position in winposn variable
70" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
71" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
72fun! SaveWinPosn(...)
73" call Dfunc("SaveWinPosn() a:0=".a:0)
74 if line(".") == 1 && getline(1) == ""
75" call Dfunc("SaveWinPosn : empty buffer")
76 return ""
77 endif
78 let so_keep = &so
79 let siso_keep = &siso
80 let ss_keep = &ss
81 set so=0 siso=0 ss=0
82
83 let swline = line(".")
84 let swcol = col(".")
85 let swwline = winline() - 1
86 let swwcol = virtcol(".") - wincol()
87 let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
88 let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
89 if swwline > 0
90 let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
91 endif
92 if swwcol > 0
93 let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
94 endif
95 let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
96
97 " save window position in
98 " b:cecutil_winposn_{iwinposn} (stack)
99 " only when SaveWinPosn() is used
100 if a:0 == 0
101 if !exists("b:cecutil_iwinposn")
102 let b:cecutil_iwinposn= 1
103 else
104 let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
105 endif
106" call Decho("saving posn to SWP stack")
107 let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
108 endif
109
110 let &so = so_keep
111 let &siso = siso_keep
112 let &ss = ss_keep
113
114" if exists("b:cecutil_iwinposn") " Decho
115" call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
116" else " Decho
117" call Decho("b:cecutil_iwinposn doesn't exist")
118" endif " Decho
119" call Dret("SaveWinPosn [".savedposn."]")
120 return savedposn
121endfun
122
123" ---------------------------------------------------------------------
124" RestoreWinPosn: {{{1
125fun! RestoreWinPosn(...)
126" call Dfunc("RestoreWinPosn() a:0=".a:0)
127" call Decho("getline(1)<".getline(1).">")
128" call Decho("line(.)=".line("."))
129 if line(".") == 1 && getline(1) == ""
130" call Dfunc("RestoreWinPosn : empty buffer")
131 return ""
132 endif
133 let so_keep = &so
134 let siso_keep = &siso
135 let ss_keep = &ss
136 set so=0 siso=0 ss=0
137
138 if a:0 == 0 || a:1 == ""
139 " use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
140 if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
141" call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
142 try
143 exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
144 catch /^Vim\%((\a\+)\)\=:E749/
145 " ignore empty buffer error messages
146 endtry
147 " normally drop top-of-stack by one
148 " but while new top-of-stack doesn't exist
149 " drop top-of-stack index by one again
150 if b:cecutil_iwinposn >= 1
151 unlet b:cecutil_winposn{b:cecutil_iwinposn}
152 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
153 while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
154 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
155 endwhile
156 if b:cecutil_iwinposn < 1
157 unlet b:cecutil_iwinposn
158 endif
159 endif
160 else
161 echohl WarningMsg
162 echomsg "***warning*** need to SaveWinPosn first!"
163 echohl None
164 endif
165
166 else " handle input argument
167" call Decho("using input a:1<".a:1.">")
168 " use window position passed to this function
169 exe "silent ".a:1
170 " remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
171 if exists("b:cecutil_iwinposn")
172 let jwinposn= b:cecutil_iwinposn
173 while jwinposn >= 1 " search for a:1 in iwinposn..1
174 if exists("b:cecutil_winposn{jwinposn}") " if it exists
175 if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
176 unlet b:cecutil_winposn{jwinposn} " unlet it
177 if jwinposn == b:cecutil_iwinposn " if at top-of-stack
178 let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
179 endif
180 endif
181 endif
182 let jwinposn= jwinposn - 1
183 endwhile
184 endif
185 endif
186
187 " seems to be something odd: vertical motions after RWP
188 " cause jump to first column. Following fixes that
189 if wincol() > 1
190 silent norm! hl
191 elseif virtcol(".") < virtcol("$")
192 silent norm! lh
193 endif
194
195 let &so = so_keep
196 let &siso = siso_keep
197 let &ss = ss_keep
198
199" call Dret("RestoreWinPosn")
200endfun
201
202" ---------------------------------------------------------------------
203" GoWinbufnr: go to window holding given buffer (by number) {{{1
204" Prefers current window; if its buffer number doesn't match,
205" then will try from topleft to bottom right
206fun! GoWinbufnr(bufnum)
207" call Dfunc("GoWinbufnr(".a:bufnum.")")
208 if winbufnr(0) == a:bufnum
209" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
210 return
211 endif
212 winc t
213 let first=1
214 while winbufnr(0) != a:bufnum && (first || winnr() != 1)
215 winc w
216 let first= 0
217 endwhile
218" call Dret("GoWinbufnr")
219endfun
220
221" ---------------------------------------------------------------------
222" SaveMark: sets up a string saving a mark position. {{{1
223" For example, SaveMark("a")
224" Also sets up a global variable, g:savemark_{markname}
225fun! SaveMark(markname)
226" call Dfunc("SaveMark(markname<".a:markname.">)")
227 let markname= a:markname
228 if strpart(markname,0,1) !~ '\a'
229 let markname= strpart(markname,1,1)
230 endif
231" call Decho("markname=".markname)
232
233 let lzkeep = &lz
234 set lz
235
236 if 1 <= line("'".markname) && line("'".markname) <= line("$")
237 let winposn = SaveWinPosn(0)
238 exe s:modifier."norm! `".markname
239 let savemark = SaveWinPosn(0)
240 let g:savemark_{markname} = savemark
241 let savemark = markname.savemark
242 call RestoreWinPosn(winposn)
243 else
244 let g:savemark_{markname} = ""
245 let savemark = ""
246 endif
247
248 let &lz= lzkeep
249
250" call Dret("SaveMark : savemark<".savemark.">")
251 return savemark
252endfun
253
254" ---------------------------------------------------------------------
255" RestoreMark: {{{1
256" call RestoreMark("a") -or- call RestoreMark(savemark)
257fun! RestoreMark(markname)
258" call Dfunc("RestoreMark(markname<".a:markname.">)")
259
260 if strlen(a:markname) <= 0
261" call Dret("RestoreMark : no such mark")
262 return
263 endif
264 let markname= strpart(a:markname,0,1)
265 if markname !~ '\a'
266 " handles 'a -> a styles
267 let markname= strpart(a:markname,1,1)
268 endif
269" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
270
271 let lzkeep = &lz
272 set lz
273 let winposn = SaveWinPosn(0)
274
275 if strlen(a:markname) <= 2
276 if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
277 " use global variable g:savemark_{markname}
278" call Decho("use savemark list")
279 call RestoreWinPosn(g:savemark_{markname})
280 exe "norm! m".markname
281 endif
282 else
283 " markname is a savemark command (string)
284" call Decho("use savemark command")
285 let markcmd= strpart(a:markname,1)
286 call RestoreWinPosn(markcmd)
287 exe "norm! m".markname
288 endif
289
290 call RestoreWinPosn(winposn)
291 let &lz = lzkeep
292
293" call Dret("RestoreMark")
294endfun
295
296" ---------------------------------------------------------------------
297" DestroyMark: {{{1
298" call DestroyMark("a") -- destroys mark
299fun! DestroyMark(markname)
300" call Dfunc("DestroyMark(markname<".a:markname.">)")
301
302 " save options and set to standard values
303 let reportkeep= &report
304 let lzkeep = &lz
305 set lz report=10000
306
307 let markname= strpart(a:markname,0,1)
308 if markname !~ '\a'
309 " handles 'a -> a styles
310 let markname= strpart(a:markname,1,1)
311 endif
312" call Decho("markname=".markname)
313
314 let curmod = &mod
315 let winposn = SaveWinPosn(0)
316 1
317 let lineone = getline(".")
318 exe "k".markname
319 d
320 put! =lineone
321 let &mod = curmod
322 call RestoreWinPosn(winposn)
323
324 " restore options to user settings
325 let &report = reportkeep
326 let &lz = lzkeep
327
328" call Dret("DestroyMark")
329endfun
330
331" ---------------------------------------------------------------------
332" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{1
333" However, <q-args> doesn't split at all, so this one returns a list
334" with splits at all whitespace (only!), plus a leading length-of-list.
335" The resulting list: qarglist[0] corresponds to a:0
336" qarglist[i] corresponds to a:{i}
337fun! QArgSplitter(qarg)
338" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
339 let qarglist = split(a:qarg)
340 let qarglistlen = len(qarglist)
341 let qarglist = insert(qarglist,qarglistlen)
342" call Dret("QArgSplitter ".string(qarglist))
343 return qarglist
344endfun
345
346" ---------------------------------------------------------------------
347" ListWinPosn:
348"fun! ListWinPosn() " Decho
349" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
350" call Decho("nothing on SWP stack") " Decho
351" else " Decho
352" let jwinposn= b:cecutil_iwinposn " Decho
353" while jwinposn >= 1 " Decho
354" if exists("b:cecutil_winposn{jwinposn}") " Decho
355" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
356" else " Decho
357" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
358" endif " Decho
359" let jwinposn= jwinposn - 1 " Decho
360" endwhile " Decho
361" endif " Decho
362"endfun " Decho
363"com! -nargs=0 LWP call ListWinPosn() " Decho
364
365" ---------------------------------------------------------------------
366" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{1
367" which can be used to restore user maps later with
368" call RestoreUserMaps()
369"
370" mapmode - see :help maparg for its list
371" ex. "n" = Normal
372" If the first letter is u, then unmapping will be done
373" ex. "un" = Normal + unmapping
374" maplead - see mapchx
375" mapchx - "<something>" handled as a single map item.
376" ex. "<left>"
377" - "string" a string of single letters which are actually
378" multiple two-letter maps (using the maplead:
379" maplead . each_character_in_string)
380" ex. maplead="\" and mapchx="abc" saves user mappings for
381" \a, \b, and \c
382" Of course, if maplead is "", then for mapchx="abc",
383" mappings for a, b, and c are saved.
384" - :something handled as a single map item, w/o the ":"
385" ex. mapchx= ":abc" will save a mapping for "abc"
386" suffix - a string unique to your plugin
387" ex. suffix= "DrawIt"
388fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
389" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
390
391 if !exists("s:restoremap_{a:suffix}")
392 " initialize restoremap_suffix to null string
393 let s:restoremap_{a:suffix}= ""
394 endif
395
396 " set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
397 " if 0, save only
398 if a:mapmode =~ '^u'
399 let dounmap= 1
400 let mapmode= strpart(a:mapmode,1)
401 else
402 let dounmap= 0
403 let mapmode= a:mapmode
404 endif
405
406 " save single map :...something...
407 if strpart(a:mapchx,0,1) == ':'
408 let amap= strpart(a:mapchx,1)
409 if amap == "|" || amap == "\<c-v>"
410 let amap= "\<c-v>".amap
411 endif
412 let amap = a:maplead.amap
413 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".amap
414 if maparg(amap,mapmode) != ""
415 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
416 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".amap." ".maprhs
417 endif
418 if dounmap
419 exe "silent! ".mapmode."unmap ".amap
420 endif
421
422 " save single map <something>
423 elseif strpart(a:mapchx,0,1) == '<'
424 let amap = a:mapchx
425 if amap == "|" || amap == "\<c-v>"
426 let amap= "\<c-v>".amap
427 endif
428 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
429 if maparg(a:mapchx,mapmode) != ""
430 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
431 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
432 endif
433 if dounmap
434 exe "silent! ".mapmode."unmap ".amap
435 endif
436
437 " save multiple maps
438 else
439 let i= 1
440 while i <= strlen(a:mapchx)
441 let amap= a:maplead.strpart(a:mapchx,i-1,1)
442 if amap == "|" || amap == "\<c-v>"
443 let amap= "\<c-v>".amap
444 endif
445 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
446 if maparg(amap,mapmode) != ""
447 let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
448 let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
449 endif
450 if dounmap
451 exe "silent! ".mapmode."unmap ".amap
452 endif
453 let i= i + 1
454 endwhile
455 endif
456" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
457endfun
458
459" ---------------------------------------------------------------------
460" RestoreUserMaps: {{{1
461" Used to restore user maps saved by SaveUserMaps()
462fun! RestoreUserMaps(suffix)
463" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
464 if exists("s:restoremap_{a:suffix}")
465 let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
466 if s:restoremap_{a:suffix} != ""
467" call Decho("exe ".s:restoremap_{a:suffix})
468 exe "silent! ".s:restoremap_{a:suffix}
469 endif
470 unlet s:restoremap_{a:suffix}
471 endif
472" call Dret("RestoreUserMaps")
473endfun
474
475" ---------------------------------------------------------------------
476" Restore: {{{1
477let &cpo= s:keepcpo
478unlet s:keepcpo
479
480" ---------------------------------------------------------------------
481" Modelines: {{{1
482" vim: ts=4 fdm=marker
..