mirror of
https://github.com/akelge/zsh
synced 2025-07-04 13:39:07 +00:00
Updated plugins
Added solarize colorscheme
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
|
||||
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Date: Jun 18, 2012
|
||||
" Maintainer: Dr. Charles E. Campbell. <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Date: Jan 07, 2013
|
||||
"
|
||||
" NOTE: the code herein needs vim 7.0 or later
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
@ -37,7 +37,7 @@ if &cp || exists("g:loaded_AlignMapsPlugin")
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
let g:loaded_AlignMapsPlugin = "v42"
|
||||
let g:loaded_AlignMapsPlugin = "v43"
|
||||
set cpo&vim
|
||||
|
||||
" =====================================================================
|
||||
@ -53,8 +53,8 @@ com! AlignMapsClean :call AlignMaps#AlignMapsClean()
|
||||
if !hasmapto('<Plug>WrapperStart')
|
||||
map <unique> <SID>WS <Plug>AlignMapsWrapperStart
|
||||
endif
|
||||
nmap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
|
||||
vmap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
|
||||
nnoremap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR>
|
||||
vnoremap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" WE: wrapper end (internal) {{{2
|
||||
@ -62,50 +62,52 @@ vmap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMa
|
||||
if !hasmapto('<Plug>WrapperEnd')
|
||||
nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
|
||||
endif
|
||||
nmap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
|
||||
nnoremap <silent> <script> <Plug>AlignMapsWrapperEnd :call AlignMaps#WrapperEnd()<CR>:set nolz<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Complex C-code alignment maps: {{{2
|
||||
if !hasmapto('<Plug>AM_a?') |map <unique> <Leader>a? <Plug>AM_a?|endif
|
||||
if !hasmapto('<Plug>AM_a,') |map <unique> <Leader>a, <Plug>AM_a,|endif
|
||||
if !hasmapto('<Plug>AM_a<') |map <unique> <Leader>a< <Plug>AM_a<|endif
|
||||
if !hasmapto('<Plug>AM_a=') |map <unique> <Leader>a= <Plug>AM_a=|endif
|
||||
if !hasmapto('<Plug>AM_a(') |map <unique> <Leader>a( <Plug>AM_a(|endif
|
||||
if !hasmapto('<Plug>AM_abox') |map <unique> <Leader>abox <Plug>AM_abox|endif
|
||||
if !hasmapto('<Plug>AM_acom') |map <unique> <Leader>acom <Plug>AM_acom|endif
|
||||
if !hasmapto('<Plug>AM_adcom')|map <unique> <Leader>adcom <Plug>AM_adcom|endif
|
||||
if !hasmapto('<Plug>AM_aocom')|map <unique> <Leader>aocom <Plug>AM_aocom|endif
|
||||
if !hasmapto('<Plug>AM_ascom')|map <unique> <Leader>ascom <Plug>AM_ascom|endif
|
||||
if !hasmapto('<Plug>AM_adec') |map <unique> <Leader>adec <Plug>AM_adec|endif
|
||||
if !hasmapto('<Plug>AM_adef') |map <unique> <Leader>adef <Plug>AM_adef|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
|
||||
if !hasmapto('<Plug>AM_a?') |call AlignMaps#MakeMap("a?")|endif
|
||||
if !hasmapto('<Plug>AM_a,') |call AlignMaps#MakeMap("a,")|endif
|
||||
if !hasmapto('<Plug>AM_a<') |call AlignMaps#MakeMap("a<")|endif
|
||||
if !hasmapto('<Plug>AM_a=') |call AlignMaps#MakeMap("a=")|endif
|
||||
if !hasmapto('<Plug>AM_a(') |call AlignMaps#MakeMap("a(")|endif
|
||||
if !hasmapto('<Plug>AM_abox') |call AlignMaps#MakeMap("abox")|endif
|
||||
if !hasmapto('<Plug>AM_acom') |call AlignMaps#MakeMap("acom")|endif
|
||||
if !hasmapto('<Plug>AM_adcom')|call AlignMaps#MakeMap("adcom")|endif
|
||||
if !hasmapto('<Plug>AM_aocom')|call AlignMaps#MakeMap("aocom")|endif
|
||||
if !hasmapto('<Plug>AM_ascom')|call AlignMaps#MakeMap("ascom")|endif
|
||||
if !hasmapto('<Plug>AM_adec') |call AlignMaps#MakeMap("adec")|endif
|
||||
if !hasmapto('<Plug>AM_adef') |call AlignMaps#MakeMap("adef")|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
|
||||
if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Number alignment maps: {{{2
|
||||
if !hasmapto('<Plug>AM_aunum')|map <unique> <Leader>aunum <Plug>AM_aunum|endif
|
||||
if !hasmapto('<Plug>AM_aenum')|map <unique> <Leader>aenum <Plug>AM_aenum|endif
|
||||
if !hasmapto('<Plug>AM_aunum')|call AlignMaps#MakeMap("aunum")|endif
|
||||
if !hasmapto('<Plug>AM_aenum')|call AlignMaps#MakeMap("aenum")|endif
|
||||
if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
|
||||
if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aenum|endif
|
||||
if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
|
||||
else
|
||||
if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aunum|endif
|
||||
if !hasmapto('<Plug>AM_anum')|call AlignMaps#MakeMap("anum")|endif
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Plug maps: (the real thing) {{{2
|
||||
map <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
|
||||
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
|
||||
map <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
|
||||
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
|
||||
map <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
|
||||
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
|
||||
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
|
||||
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
|
||||
map <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
|
||||
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
|
||||
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*\%([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
|
||||
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
|
||||
map <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
|
||||
map <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
|
||||
map <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
|
||||
nnoremap <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_a< <SID>WS:AlignCtrl mIp1P1=l << >><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
" ---------------------------------------------------------------------
|
||||
" html table alignment {{{2
|
||||
if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
|
||||
@ -113,86 +115,88 @@ map <silent> <script> <Plug>AM_Htd <SID>WS:'y,'zs%<[tT][rR]><[tT][dD][^>]\{-}>\<
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" character-based right-justified alignment maps {{{2
|
||||
if !hasmapto('<Plug>AM_T|')|map <unique> <Leader>T| <Plug>AM_T||endif
|
||||
if !hasmapto('<Plug>AM_T#') |map <unique> <Leader>T# <Plug>AM_T#|endif
|
||||
if !hasmapto('<Plug>AM_T,') |map <unique> <Leader>T, <Plug>AM_T,o|endif
|
||||
if !hasmapto('<Plug>AM_Ts,') |map <unique> <Leader>Ts, <Plug>AM_Ts,|endif
|
||||
if !hasmapto('<Plug>AM_T:') |map <unique> <Leader>T: <Plug>AM_T:|endif
|
||||
if !hasmapto('<Plug>AM_T;') |map <unique> <Leader>T; <Plug>AM_T;|endif
|
||||
if !hasmapto('<Plug>AM_T<') |map <unique> <Leader>T< <Plug>AM_T<|endif
|
||||
if !hasmapto('<Plug>AM_T=') |map <unique> <Leader>T= <Plug>AM_T=|endif
|
||||
if !hasmapto('<Plug>AM_T?') |map <unique> <Leader>T? <Plug>AM_T?|endif
|
||||
if !hasmapto('<Plug>AM_T@') |map <unique> <Leader>T@ <Plug>AM_T@|endif
|
||||
if !hasmapto('<Plug>AM_TW@') |map <unique> <Leader>TW@ <Plug>AM_TW@|endif
|
||||
if !hasmapto('<Plug>AM_Tab') |map <unique> <Leader>Tab <Plug>AM_Tab|endif
|
||||
if !hasmapto('<Plug>AM_Tsp') |map <unique> <Leader>Tsp <Plug>AM_Tsp|endif
|
||||
if !hasmapto('<Plug>AM_T~') |map <unique> <Leader>T~ <Plug>AM_T~|endif
|
||||
if !hasmapto('<Plug>AM_T|')|call AlignMaps#MakeMap("T|")|endif
|
||||
if !hasmapto('<Plug>AM_T#') |call AlignMaps#MakeMap("T#")|endif
|
||||
if !hasmapto('<Plug>AM_T,') |call AlignMaps#MakeMap("T,")|endif
|
||||
if !hasmapto('<Plug>AM_Ts,') |call AlignMaps#MakeMap("Ts,")|endif
|
||||
if !hasmapto('<Plug>AM_T:') |call AlignMaps#MakeMap("T:")|endif
|
||||
if !hasmapto('<Plug>AM_T;') |call AlignMaps#MakeMap("T;")|endif
|
||||
if !hasmapto('<Plug>AM_T<') |call AlignMaps#MakeMap("T<")|endif
|
||||
if !hasmapto('<Plug>AM_T=') |call AlignMaps#MakeMap("T=")|endif
|
||||
if !hasmapto('<Plug>AM_T?') |call AlignMaps#MakeMap("T?")|endif
|
||||
if !hasmapto('<Plug>AM_T@') |call AlignMaps#MakeMap("T@")|endif
|
||||
if !hasmapto('<Plug>AM_TW@') |call AlignMaps#MakeMap("TW@")|endif
|
||||
if !hasmapto('<Plug>AM_Tab') |call AlignMaps#MakeMap("Tab")|endif
|
||||
if !hasmapto('<Plug>AM_Tsp') |call AlignMaps#MakeMap("Tsp")|endif
|
||||
if !hasmapto('<Plug>AM_T~') |call AlignMaps#MakeMap("T~")|endif
|
||||
|
||||
map <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
|
||||
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"
|
||||
map <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
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
|
||||
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
|
||||
map <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T| <SID>WS:AlignCtrl mIp0P0=r <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T# <SID>WS:AlignCtrl mIp0P0=r #<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_Ts, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR>:'a,.s/\(\s*\),/,\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T: <SID>WS:AlignCtrl mIp1P1=r :<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T; <SID>WS:AlignCtrl mIp0P0=r ;<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <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"
|
||||
nnoremap <silent> <script> <Plug>AM_T? <SID>WS:AlignCtrl mIp0P0=r ?<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_T~ <SID>WS:AlignCtrl mIp0P0=r ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" character-based left-justified alignment maps {{{2
|
||||
if !hasmapto('<Plug>AM_t|') |map <unique> <Leader>t| <Plug>AM_t||endif
|
||||
if !hasmapto('<Plug>AM_t#') |map <unique> <Leader>t# <Plug>AM_t#|endif
|
||||
if !hasmapto('<Plug>AM_t,') |map <unique> <Leader>t, <Plug>AM_t,|endif
|
||||
if !hasmapto('<Plug>AM_t:') |map <unique> <Leader>t: <Plug>AM_t:|endif
|
||||
if !hasmapto('<Plug>AM_t;') |map <unique> <Leader>t; <Plug>AM_t;|endif
|
||||
if !hasmapto('<Plug>AM_t<') |map <unique> <Leader>t< <Plug>AM_t<|endif
|
||||
if !hasmapto('<Plug>AM_t=') |map <unique> <Leader>t= <Plug>AM_t=|endif
|
||||
if !hasmapto('<Plug>AM_ts,') |map <unique> <Leader>ts, <Plug>AM_ts,|endif
|
||||
if !hasmapto('<Plug>AM_ts:') |map <unique> <Leader>ts: <Plug>AM_ts:|endif
|
||||
if !hasmapto('<Plug>AM_ts;') |map <unique> <Leader>ts; <Plug>AM_ts;|endif
|
||||
if !hasmapto('<Plug>AM_ts<') |map <unique> <Leader>ts< <Plug>AM_ts<|endif
|
||||
if !hasmapto('<Plug>AM_ts=') |map <unique> <Leader>ts= <Plug>AM_ts=|endif
|
||||
if !hasmapto('<Plug>AM_w=') |map <unique> <Leader>w= <Plug>AM_w=|endif
|
||||
if !hasmapto('<Plug>AM_t?') |map <unique> <Leader>t? <Plug>AM_t?|endif
|
||||
if !hasmapto('<Plug>AM_t~') |map <unique> <Leader>t~ <Plug>AM_t~|endif
|
||||
if !hasmapto('<Plug>AM_t@') |map <unique> <Leader>t@ <Plug>AM_t@|endif
|
||||
if !hasmapto('<Plug>AM_tW@') |map <unique> <Leader>tW@ <Plug>AM_tW@|endif
|
||||
if !hasmapto('<Plug>AM_m=') |map <unique> <Leader>m= <Plug>AM_m=|endif
|
||||
if !hasmapto('<Plug>AM_tab') |map <unique> <Leader>tab <Plug>AM_tab|endif
|
||||
if !hasmapto('<Plug>AM_tml') |map <unique> <Leader>tml <Plug>AM_tml|endif
|
||||
if !hasmapto('<Plug>AM_tsp') |map <unique> <Leader>tsp <Plug>AM_tsp|endif
|
||||
if !hasmapto('<Plug>AM_tsq') |map <unique> <Leader>tsq <Plug>AM_tsq|endif
|
||||
if !hasmapto('<Plug>AM_tt') |map <unique> <Leader>tt <Plug>AM_tt|endif
|
||||
if !hasmapto('<Plug>AM_t|','n') |call AlignMaps#MakeMap("t|")|endif
|
||||
if !hasmapto('<Plug>AM_t#','n') |call AlignMaps#MakeMap("t#")|endif
|
||||
if !hasmapto('<Plug>AM_t,','n') |call AlignMaps#MakeMap("t,")|endif
|
||||
if !hasmapto('<Plug>AM_t:','n') |call AlignMaps#MakeMap("t:")|endif
|
||||
if !hasmapto('<Plug>AM_t;','n') |call AlignMaps#MakeMap("t;")|endif
|
||||
if !hasmapto('<Plug>AM_t<','n') |call AlignMaps#MakeMap("t<")|endif
|
||||
if !hasmapto('<Plug>AM_t=','n') |call AlignMaps#MakeMap("t=")|endif
|
||||
if !hasmapto('<Plug>AM_ts,','n') |call AlignMaps#MakeMap("ts,")|endif
|
||||
if !hasmapto('<Plug>AM_ts:','n') |call AlignMaps#MakeMap("ts:")|endif
|
||||
if !hasmapto('<Plug>AM_ts;','n') |call AlignMaps#MakeMap("ts;")|endif
|
||||
if !hasmapto('<Plug>AM_ts<','n') |call AlignMaps#MakeMap("ts<")|endif
|
||||
if !hasmapto('<Plug>AM_ts=','n') |call AlignMaps#MakeMap("ts=")|endif
|
||||
if !hasmapto('<Plug>AM_w=','n') |call AlignMaps#MakeMap("w=")|endif
|
||||
if !hasmapto('<Plug>AM_t?','n') |call AlignMaps#MakeMap("t?")|endif
|
||||
if !hasmapto('<Plug>AM_t~','n') |call AlignMaps#MakeMap("t~")|endif
|
||||
if !hasmapto('<Plug>AM_t@','n') |call AlignMaps#MakeMap("t@")|endif
|
||||
if !hasmapto('<Plug>AM_tW@','n') |call AlignMaps#MakeMap("tW@")|endif
|
||||
if !hasmapto('<Plug>AM_m=','n') |call AlignMaps#MakeMap("m=")|endif
|
||||
if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
|
||||
if !hasmapto('<Plug>AM_tml','n') |call AlignMaps#MakeMap("tml")|endif
|
||||
if !hasmapto('<Plug>AM_tsp','n') |call AlignMaps#MakeMap("tsp")|endif
|
||||
if !hasmapto('<Plug>AM_tsq','n') |call AlignMaps#MakeMap("tsq")|endif
|
||||
if !hasmapto('<Plug>AM_tt','n') |call AlignMaps#MakeMap("tt")|endif
|
||||
if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
|
||||
|
||||
map <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
|
||||
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
|
||||
map <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_t@ <SID>WS:call AlignMaps#StdAlign(1)<cr><SID>WE
|
||||
map <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
|
||||
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
|
||||
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"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
|
||||
map <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
|
||||
map <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
|
||||
map <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
|
||||
map <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
|
||||
" <Plug> normal mode mappings
|
||||
nnoremap <silent> <script> <Plug>AM_t| <SID>WS:AlignCtrl mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t# <SID>WS:AlignCtrl mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_t? <SID>WS:AlignCtrl mIp0P0=l ?<CR>:'a,.Align<CR>:.,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_t@ <SID>WS:call AlignMaps#StdAlign(1)<cr><SID>WE
|
||||
nnoremap <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
|
||||
nnoremap <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
|
||||
nnoremap <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
|
||||
nnoremap <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<CR><SID>WE
|
||||
|
||||
" =====================================================================
|
||||
" Menu Support: {{{1
|
||||
|
@ -1,9 +1,9 @@
|
||||
" AlignPlugin: tool to align multiple fields based on one or more separators
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Author: Charles E. Campbell
|
||||
" Date: Nov 02, 2008
|
||||
" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
|
||||
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
|
||||
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
@ -22,7 +22,7 @@
|
||||
if &cp || exists("g:loaded_AlignPlugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_AlignPlugin = "v36"
|
||||
let g:loaded_AlignPlugin = "v37"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
" cecutil.vim : save/restore window position
|
||||
" save/restore mark position
|
||||
" save/restore selected user maps
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Version: 17
|
||||
" Date: Sep 04, 2007
|
||||
" Author: Charles E. Campbell
|
||||
" Version: 18h ASTRO-ONLY
|
||||
" Date: Oct 16, 2012
|
||||
"
|
||||
" Saving Restoring Destroying Marks: {{{1
|
||||
" call SaveMark(markname) let savemark= SaveMark(markname)
|
||||
@ -27,20 +27,23 @@
|
||||
" You believe that God is one. You do well. The demons also {{{1
|
||||
" believe, and shudder. But do you want to know, vain man, that
|
||||
" faith apart from works is dead? (James 2:19,20 WEB)
|
||||
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Load Once: {{{1
|
||||
if &cp || exists("g:loaded_cecutil")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_cecutil = "v17"
|
||||
let g:loaded_cecutil = "v18h"
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
"DechoVarOn
|
||||
"DechoRemOn
|
||||
|
||||
" -----------------------
|
||||
" =======================
|
||||
" Public Interface: {{{1
|
||||
" -----------------------
|
||||
" =======================
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Map Interface: {{{2
|
||||
if !hasmapto('<Plug>SaveWinPosn')
|
||||
map <unique> <Leader>swp <Plug>SaveWinPosn
|
||||
@ -51,43 +54,56 @@ endif
|
||||
nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
|
||||
nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Command Interface: {{{2
|
||||
com! -bar -nargs=0 SWP call SaveWinPosn()
|
||||
com! -bar -nargs=0 RWP call RestoreWinPosn()
|
||||
com! -bar -nargs=? RWP call RestoreWinPosn(<args>)
|
||||
com! -bar -nargs=1 SM call SaveMark(<q-args>)
|
||||
com! -bar -nargs=1 RM call RestoreMark(<q-args>)
|
||||
com! -bar -nargs=1 DM call DestroyMark(<q-args>)
|
||||
|
||||
com! -bar -nargs=1 WLR call s:WinLineRestore(<q-args>)
|
||||
|
||||
if v:version < 630
|
||||
let s:modifier= "sil "
|
||||
let s:modifier= "sil! "
|
||||
else
|
||||
let s:modifier= "sil keepj "
|
||||
let s:modifier= "sil! keepj "
|
||||
endif
|
||||
|
||||
" ===============
|
||||
" Functions: {{{1
|
||||
" ===============
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveWinPosn: {{{1
|
||||
" SaveWinPosn: {{{2
|
||||
" let winposn= SaveWinPosn() will save window position in winposn variable
|
||||
" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
|
||||
fun! SaveWinPosn(...)
|
||||
" call Dfunc("SaveWinPosn() a:0=".a:0)
|
||||
if line(".") == 1 && getline(1) == ""
|
||||
" call Dfunc("SaveWinPosn : empty buffer")
|
||||
" echomsg "Decho: SaveWinPosn() a:0=".a:0
|
||||
if line("$") == 1 && getline(1) == ""
|
||||
" echomsg "Decho: SaveWinPosn : empty buffer"
|
||||
return ""
|
||||
endif
|
||||
let so_keep = &so
|
||||
let so_keep = &l:so
|
||||
let siso_keep = &siso
|
||||
let ss_keep = &ss
|
||||
set so=0 siso=0 ss=0
|
||||
let ss_keep = &l:ss
|
||||
setlocal so=0 siso=0 ss=0
|
||||
|
||||
let swline = line(".")
|
||||
let swcol = col(".")
|
||||
let swwline = winline() - 1
|
||||
let swwcol = virtcol(".") - wincol()
|
||||
let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
|
||||
let swline = line(".") " save-window line in file
|
||||
let swcol = col(".") " save-window column in file
|
||||
if swcol >= col("$")
|
||||
let swcol= swcol + virtcol(".") - virtcol("$") " adjust for virtual edit (cursor past end-of-line)
|
||||
endif
|
||||
let swwline = winline() - 1 " save-window window line
|
||||
let swwcol = virtcol(".") - wincol() " save-window window column
|
||||
let savedposn = ""
|
||||
" echomsg "Decho: sw[".swline.",".swcol."] sww[".swwline.",".swwcol."]"
|
||||
let savedposn = "call GoWinbufnr(".winbufnr(0).")"
|
||||
let savedposn = savedposn."|".s:modifier.swline
|
||||
let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
|
||||
if swwline > 0
|
||||
let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
|
||||
let savedposn= savedposn.":".s:modifier."call s:WinLineRestore(".(swwline+1).")\<cr>"
|
||||
endif
|
||||
if swwcol > 0
|
||||
let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
|
||||
@ -99,54 +115,56 @@ fun! SaveWinPosn(...)
|
||||
" only when SaveWinPosn() is used
|
||||
if a:0 == 0
|
||||
if !exists("b:cecutil_iwinposn")
|
||||
let b:cecutil_iwinposn= 1
|
||||
let b:cecutil_iwinposn= 1
|
||||
else
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
|
||||
endif
|
||||
" call Decho("saving posn to SWP stack")
|
||||
" echomsg "Decho: saving posn to SWP stack"
|
||||
let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
|
||||
endif
|
||||
|
||||
let &so = so_keep
|
||||
let &l:so = so_keep
|
||||
let &siso = siso_keep
|
||||
let &ss = ss_keep
|
||||
let &l:ss = ss_keep
|
||||
|
||||
" if exists("b:cecutil_iwinposn") " Decho
|
||||
" call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
|
||||
" else " Decho
|
||||
" call Decho("b:cecutil_iwinposn doesn't exist")
|
||||
" endif " Decho
|
||||
" call Dret("SaveWinPosn [".savedposn."]")
|
||||
" if exists("b:cecutil_iwinposn") " Decho
|
||||
" echomsg "Decho: b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]"
|
||||
" else " Decho
|
||||
" echomsg "Decho: b:cecutil_iwinposn doesn't exist"
|
||||
" endif " Decho
|
||||
" echomsg "Decho: SaveWinPosn [".savedposn."]"
|
||||
return savedposn
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreWinPosn: {{{1
|
||||
" RestoreWinPosn: {{{2
|
||||
" call RestoreWinPosn()
|
||||
" call RestoreWinPosn(winposn)
|
||||
fun! RestoreWinPosn(...)
|
||||
" call Dfunc("RestoreWinPosn() a:0=".a:0)
|
||||
" call Decho("getline(1)<".getline(1).">")
|
||||
" call Decho("line(.)=".line("."))
|
||||
if line(".") == 1 && getline(1) == ""
|
||||
" call Dfunc("RestoreWinPosn : empty buffer")
|
||||
" echomsg "Decho: RestoreWinPosn() a:0=".a:0
|
||||
" echomsg "Decho: getline(1)<".getline(1).">"
|
||||
" echomsg "Decho: line(.)=".line(".")
|
||||
if line("$") == 1 && getline(1) == ""
|
||||
" echomsg "Decho: RestoreWinPosn : empty buffer"
|
||||
return ""
|
||||
endif
|
||||
let so_keep = &so
|
||||
let siso_keep = &siso
|
||||
let ss_keep = &ss
|
||||
set so=0 siso=0 ss=0
|
||||
let so_keep = &l:so
|
||||
let siso_keep = &l:siso
|
||||
let ss_keep = &l:ss
|
||||
setlocal so=0 siso=0 ss=0
|
||||
|
||||
if a:0 == 0 || a:1 == ""
|
||||
" use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
|
||||
if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
|
||||
" call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
|
||||
" echomsg "Decho: using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">"
|
||||
try
|
||||
exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
exe s:modifier.b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
catch /^Vim\%((\a\+)\)\=:E749/
|
||||
" ignore empty buffer error messages
|
||||
endtry
|
||||
" normally drop top-of-stack by one
|
||||
" but while new top-of-stack doesn't exist
|
||||
" drop top-of-stack index by one again
|
||||
" normally drop top-of-stack by one
|
||||
" but while new top-of-stack doesn't exist
|
||||
" drop top-of-stack index by one again
|
||||
if b:cecutil_iwinposn >= 1
|
||||
unlet b:cecutil_winposn{b:cecutil_iwinposn}
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
|
||||
@ -158,49 +176,68 @@ fun! RestoreWinPosn(...)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
echohl WarningMsg
|
||||
echohl WarningMsg
|
||||
echomsg "***warning*** need to SaveWinPosn first!"
|
||||
echohl None
|
||||
endif
|
||||
|
||||
else " handle input argument
|
||||
" call Decho("using input a:1<".a:1.">")
|
||||
" echomsg "Decho: using input a:1<".a:1.">"
|
||||
" use window position passed to this function
|
||||
exe "silent ".a:1
|
||||
exe a:1
|
||||
" remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
|
||||
if exists("b:cecutil_iwinposn")
|
||||
let jwinposn= b:cecutil_iwinposn
|
||||
while jwinposn >= 1 " search for a:1 in iwinposn..1
|
||||
if exists("b:cecutil_winposn{jwinposn}") " if it exists
|
||||
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
|
||||
unlet b:cecutil_winposn{jwinposn} " unlet it
|
||||
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let jwinposn= jwinposn - 1
|
||||
endwhile
|
||||
let jwinposn= b:cecutil_iwinposn
|
||||
while jwinposn >= 1 " search for a:1 in iwinposn..1
|
||||
if exists("b:cecutil_winposn{jwinposn}") " if it exists
|
||||
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
|
||||
unlet b:cecutil_winposn{jwinposn} " unlet it
|
||||
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
|
||||
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let jwinposn= jwinposn - 1
|
||||
endwhile
|
||||
endif
|
||||
endif
|
||||
|
||||
" seems to be something odd: vertical motions after RWP
|
||||
" cause jump to first column. Following fixes that
|
||||
if wincol() > 1
|
||||
silent norm! hl
|
||||
" Seems to be something odd: vertical motions after RWP
|
||||
" cause jump to first column. The following fixes that.
|
||||
" Note: was using wincol()>1, but with signs, a cursor
|
||||
" at column 1 yields wincol()==3. Beeping ensued.
|
||||
let vekeep= &ve
|
||||
set ve=all
|
||||
if virtcol('.') > 1
|
||||
exe s:modifier."norm! hl"
|
||||
elseif virtcol(".") < virtcol("$")
|
||||
silent norm! lh
|
||||
exe s:modifier."norm! lh"
|
||||
endif
|
||||
let &ve= vekeep
|
||||
|
||||
let &so = so_keep
|
||||
let &siso = siso_keep
|
||||
let &ss = ss_keep
|
||||
let &l:so = so_keep
|
||||
let &l:siso = siso_keep
|
||||
let &l:ss = ss_keep
|
||||
|
||||
" call Dret("RestoreWinPosn")
|
||||
" echomsg "Decho: RestoreWinPosn"
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" GoWinbufnr: go to window holding given buffer (by number) {{{1
|
||||
" s:WinLineRestore: {{{2
|
||||
fun! s:WinLineRestore(swwline)
|
||||
" echomsg "Decho: s:WinLineRestore(swwline=".a:swwline.")"
|
||||
while winline() < a:swwline
|
||||
let curwinline= winline()
|
||||
exe s:modifier."norm! \<c-y>"
|
||||
if curwinline == winline()
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
" echomsg "Decho: s:WinLineRestore"
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" GoWinbufnr: go to window holding given buffer (by number) {{{2
|
||||
" Prefers current window; if its buffer number doesn't match,
|
||||
" then will try from topleft to bottom right
|
||||
fun! GoWinbufnr(bufnum)
|
||||
@ -219,7 +256,7 @@ fun! GoWinbufnr(bufnum)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveMark: sets up a string saving a mark position. {{{1
|
||||
" SaveMark: sets up a string saving a mark position. {{{2
|
||||
" For example, SaveMark("a")
|
||||
" Also sets up a global variable, g:savemark_{markname}
|
||||
fun! SaveMark(markname)
|
||||
@ -252,7 +289,7 @@ fun! SaveMark(markname)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreMark: {{{1
|
||||
" RestoreMark: {{{2
|
||||
" call RestoreMark("a") -or- call RestoreMark(savemark)
|
||||
fun! RestoreMark(markname)
|
||||
" call Dfunc("RestoreMark(markname<".a:markname.">)")
|
||||
@ -294,7 +331,7 @@ fun! RestoreMark(markname)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" DestroyMark: {{{1
|
||||
" DestroyMark: {{{2
|
||||
" call DestroyMark("a") -- destroys mark
|
||||
fun! DestroyMark(markname)
|
||||
" call Dfunc("DestroyMark(markname<".a:markname.">)")
|
||||
@ -329,7 +366,7 @@ fun! DestroyMark(markname)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{1
|
||||
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{2
|
||||
" However, <q-args> doesn't split at all, so this one returns a list
|
||||
" with splits at all whitespace (only!), plus a leading length-of-list.
|
||||
" The resulting list: qarglist[0] corresponds to a:0
|
||||
@ -344,7 +381,7 @@ fun! QArgSplitter(qarg)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" ListWinPosn:
|
||||
" ListWinPosn: {{{2
|
||||
"fun! ListWinPosn() " Decho
|
||||
" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
|
||||
" call Decho("nothing on SWP stack") " Decho
|
||||
@ -363,14 +400,19 @@ endfun
|
||||
"com! -nargs=0 LWP call ListWinPosn() " Decho
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{1
|
||||
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2
|
||||
" which can be used to restore user maps later with
|
||||
" call RestoreUserMaps()
|
||||
"
|
||||
" mapmode - see :help maparg for its list
|
||||
" mapmode - see :help maparg for details (n v o i c l "")
|
||||
" ex. "n" = Normal
|
||||
" If the first letter is u, then unmapping will be done
|
||||
" ex. "un" = Normal + unmapping
|
||||
" The letters "b" and "u" are optional prefixes;
|
||||
" The "u" means that the map will also be unmapped
|
||||
" The "b" means that the map has a <buffer> qualifier
|
||||
" ex. "un" = Normal + unmapping
|
||||
" ex. "bn" = Normal + <buffer>
|
||||
" ex. "bun" = Normal + <buffer> + unmapping
|
||||
" ex. "ubn" = Normal + <buffer> + unmapping
|
||||
" maplead - see mapchx
|
||||
" mapchx - "<something>" handled as a single map item.
|
||||
" ex. "<left>"
|
||||
@ -395,60 +437,70 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
|
||||
|
||||
" set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
|
||||
" if 0, save only
|
||||
if a:mapmode =~ '^u'
|
||||
let dounmap= 1
|
||||
let mapmode= strpart(a:mapmode,1)
|
||||
else
|
||||
let dounmap= 0
|
||||
let mapmode= a:mapmode
|
||||
endif
|
||||
let mapmode = a:mapmode
|
||||
let dounmap = 0
|
||||
let dobuffer = ""
|
||||
while mapmode =~ '^[bu]'
|
||||
if mapmode =~ '^u'
|
||||
let dounmap = 1
|
||||
let mapmode = strpart(a:mapmode,1)
|
||||
elseif mapmode =~ '^b'
|
||||
let dobuffer = "<buffer> "
|
||||
let mapmode = strpart(a:mapmode,1)
|
||||
endif
|
||||
endwhile
|
||||
" call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
|
||||
|
||||
" save single map :...something...
|
||||
if strpart(a:mapchx,0,1) == ':'
|
||||
" call Decho("save single map :...something...")
|
||||
let amap= strpart(a:mapchx,1)
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
endif
|
||||
let amap = a:maplead.amap
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".amap
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(amap,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".amap." ".maprhs
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "silent! ".mapmode."unmap ".amap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
|
||||
" save single map <something>
|
||||
elseif strpart(a:mapchx,0,1) == '<'
|
||||
" call Decho("save single map <something>")
|
||||
let amap = a:mapchx
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
" call Decho("amap[[".amap."]]")
|
||||
endif
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(a:mapchx,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "silent! ".mapmode."unmap ".amap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
|
||||
" save multiple maps
|
||||
else
|
||||
" call Decho("save multiple maps")
|
||||
let i= 1
|
||||
while i <= strlen(a:mapchx)
|
||||
let amap= a:maplead.strpart(a:mapchx,i-1,1)
|
||||
if amap == "|" || amap == "\<c-v>"
|
||||
let amap= "\<c-v>".amap
|
||||
endif
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
|
||||
if maparg(amap,mapmode) != ""
|
||||
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
|
||||
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
|
||||
endif
|
||||
if dounmap
|
||||
exe "silent! ".mapmode."unmap ".amap
|
||||
exe "sil! ".mapmode."unmap ".dobuffer.amap
|
||||
endif
|
||||
let i= i + 1
|
||||
endwhile
|
||||
@ -457,7 +509,7 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" RestoreUserMaps: {{{1
|
||||
" RestoreUserMaps: {{{2
|
||||
" Used to restore user maps saved by SaveUserMaps()
|
||||
fun! RestoreUserMaps(suffix)
|
||||
" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
|
||||
@ -465,18 +517,20 @@ fun! RestoreUserMaps(suffix)
|
||||
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
|
||||
if s:restoremap_{a:suffix} != ""
|
||||
" call Decho("exe ".s:restoremap_{a:suffix})
|
||||
exe "silent! ".s:restoremap_{a:suffix}
|
||||
exe "sil! ".s:restoremap_{a:suffix}
|
||||
endif
|
||||
unlet s:restoremap_{a:suffix}
|
||||
endif
|
||||
" call Dret("RestoreUserMaps")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" ==============
|
||||
" Restore: {{{1
|
||||
" ==============
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" ================
|
||||
" Modelines: {{{1
|
||||
" ================
|
||||
" vim: ts=4 fdm=marker
|
||||
|
Reference in New Issue
Block a user