[vim-scripts] 09/11: Updated Align to 37/43
James McCoy
jamessan at debian.org
Thu Aug 15 04:03:12 UTC 2013
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository vim-scripts.
commit 0f0de903183117a8dd192214ea7b3cddba5a585f
Author: James McCoy <jamessan at debian.org>
Date: Wed Aug 14 23:20:19 2013 -0400
Updated Align to 37/43
Signed-off-by: James McCoy <jamessan at debian.org>
---
autoload/Align.vim | 397 +++++++++++++++++----------
autoload/AlignMaps.vim | 215 ++++++++++-----
debian/changelog | 1 +
debian/vim-scripts.status | 4 +-
doc/Align.txt | 561 +++++++++++++++++++++++---------------
html/index.html | 2 +-
html/plugin_AlignPlugin.vim.html | 45 ++-
plugin/AlignMapsPlugin.vim | 257 ++++++++---------
plugin/AlignPlugin.vim | 6 +-
plugin/cecutil.vim | 160 ++++++-----
10 files changed, 1018 insertions(+), 630 deletions(-)
diff --git a/autoload/Align.vim b/autoload/Align.vim
index bce3542..714421e 100644
--- a/autoload/Align.vim
+++ b/autoload/Align.vim
@@ -1,10 +1,10 @@
" Align: tool to align multiple fields based on one or more separators
-" Author: Charles E. Campbell, Jr.
-" Date: Mar 03, 2009
-" Version: 35
+" Author: Charles E. Campbell
+" Date: Mar 12, 2013
+" Version: 37
" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
-" Copyright: Copyright (C) 1999-2007 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,
@@ -18,13 +18,14 @@
" the power of God for salvation for everyone who believes; for the Jew first,
" and also for the Greek. For in it is revealed God's righteousness from
" faith to faith.
+"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" ---------------------------------------------------------------------
" Load Once: {{{1
if exists("g:loaded_Align") || &cp
finish
endif
-let g:loaded_Align = "v35"
+let g:loaded_Align = "v37"
if v:version < 700
echohl WarningMsg
echo "***warning*** this version of Align needs vim 7.0"
@@ -42,7 +43,11 @@ set cpo&vim
" ---------------------------------------------------------------------
" Options: {{{1
if !exists("g:Align_xstrlen")
- if &enc == "latin1" || $LANG == "en_US.UTF-8" || !has("multi_byte")
+ if exists("g:drawit_xstrlen")
+ let g:Align_xstrlen= g:drawit_xstrlen
+ elseif exists("g:netrw_xstrlen")
+ let g:Align_xstrlen= g:netrw_xstrlen
+ elseif &enc == "latin1" || !has("multi_byte")
let g:Align_xstrlen= 0
else
let g:Align_xstrlen= 1
@@ -84,14 +89,13 @@ endif
" | s:AlignSep
fun! Align#AlignCtrl(...)
-" call Dfunc("AlignCtrl(...) a:0=".a:0)
+" call Dfunc("Align#AlignCtrl(...) a:0=".a:0)
- " save options that will be changed
- let keep_search = @/
- let keep_ic = &ic
+ " save options that may be changed later
+ call s:SaveUserOptions()
" turn ignorecase off
- set noic
+ setlocal noic
" clear visual mode so that old visual-mode selections don't
" get applied to new invocations of Align().
@@ -121,19 +125,20 @@ fun! Align#AlignCtrl(...)
let ipat= 2
while ipat <= A[0]
if "" =~ A[ipat]
- echoerr "AlignCtrl: separator<".A[ipat]."> matches zero-length string"
- let &ic= keep_ic
-" call Dret("AlignCtrl")
+ echoerr "(AlignCtrl) separator<".A[ipat]."> matches zero-length string"
+ call s:RestoreUserOptions()
+" call Dret("Align#AlignCtrl")
return
endif
let ipat= ipat + 1
endwhile
endif
endif
+" call Decho("(AlignCtrl) passed bad-separator pattern check (no zero-length matches)")
-" call Decho("AlignCtrl() A[0]=".A[0])
+" call Decho("(AlignCtrl) A[0]=".A[0])
if !exists("s:AlignStyle")
- let s:AlignStyle= "l"
+ let s:AlignStyle= 'l'
endif
if !exists("s:AlignPrePad")
let s:AlignPrePad= 0
@@ -153,7 +158,7 @@ fun! Align#AlignCtrl(...)
let s:AlignPatQty= 0
endif
echo "AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep
-" call Decho("AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep)
+" call Decho("(AlignCtrl) AlignCtrl<".s:AlignCtrl."> qty=".s:AlignPatQty." AlignStyle<".s:AlignStyle."> Padding<".s:AlignPrePad."|".s:AlignPostPad."> LeadingWS=".s:AlignLeadKeep." AlignSep=".s:AlignSep)
if exists("s:AlignGPat") && !exists("s:AlignVPat")
echo "AlignGPat<".s:AlignGPat.">"
elseif !exists("s:AlignGPat") && exists("s:AlignVPat")
@@ -164,7 +169,7 @@ fun! Align#AlignCtrl(...)
let ipat= 1
while ipat <= s:AlignPatQty
echo "Pat".ipat."<".s:AlignPat_{ipat}.">"
-" call Decho("Pat".ipat."<".s:AlignPat_{ipat}.">")
+" call Decho("(AlignCtrl) Pat".ipat."<".s:AlignPat_{ipat}.">")
let ipat= ipat + 1
endwhile
@@ -190,9 +195,8 @@ fun! Align#AlignCtrl(...)
call Align#AlignCtrl("g")
call Align#AlignCtrl("v")
let s:dovisclear = 1
- let &ic = keep_ic
- let @/ = keep_search
-" call Dret("AlignCtrl")
+ call s:RestoreUserOptions()
+" call Dret("Align#AlignCtrl")
return
endif
@@ -205,7 +209,7 @@ fun! Align#AlignCtrl(...)
endif
" = : record a list of alignment patterns that are equivalent
- if style =~# "="
+ if style =~# "=" || (A[0] >= 2 && style !~# "C" && s:AlignCtrl =~# '=')
" call Decho("style case =: record list of equiv alignment patterns")
let s:AlignCtrl = '='
if A[0] >= 2
@@ -221,7 +225,7 @@ fun! Align#AlignCtrl(...)
endif
"c : cycle through alignment pattern(s)
- elseif style =~# 'C'
+ elseif style =~# 'C' || (A[0] >= 2 && s:AlignCtrl =~# '=')
" call Decho("style case C: cycle through alignment pattern(s)")
let s:AlignCtrl = 'C'
if A[0] >= 2
@@ -239,10 +243,9 @@ fun! Align#AlignCtrl(...)
let s:AlignPrePad= substitute(style,'^.*p\(\d\+\).*$','\1','')
" call Decho("style case p".s:AlignPrePad.": pre-separator padding")
if s:AlignPrePad == ""
- echoerr "AlignCtrl: 'p' needs to be followed by a numeric argument'
- let @/ = keep_search
- let &ic= keep_ic
-" call Dret("AlignCtrl")
+ echoerr "(AlignCtrl) 'p' needs to be followed by a numeric argument'"
+ call s:RestoreUserOptions()
+" call Dret("Align#AlignCtrl")
return
endif
endif
@@ -251,10 +254,9 @@ fun! Align#AlignCtrl(...)
let s:AlignPostPad= substitute(style,'^.*P\(\d\+\).*$','\1','')
" call Decho("style case P".s:AlignPostPad.": post-separator padding")
if s:AlignPostPad == ""
- echoerr "AlignCtrl: 'P' needs to be followed by a numeric argument'
- let @/ = keep_search
- let &ic= keep_ic
-" call Dret("AlignCtrl")
+ echoerr "(AlignCtrl) 'P' needs to be followed by a numeric argument'"
+ call s:RestoreUserOptions()
+" call Dret("Align#AlignCtrl")
return
endif
endif
@@ -263,10 +265,10 @@ fun! Align#AlignCtrl(...)
" call Decho("style case w: ignore leading whitespace")
let s:AlignLeadKeep= 'w'
elseif style =~# 'W'
-" call Decho("style case w: keep leading whitespace")
+" call Decho("style case W: keep leading whitespace")
let s:AlignLeadKeep= 'W'
elseif style =~# 'I'
-" call Decho("style case w: retain initial leading whitespace")
+" call Decho("style case I: retain initial leading whitespace")
let s:AlignLeadKeep= 'I'
endif
@@ -274,8 +276,8 @@ fun! Align#AlignCtrl(...)
" first list item is a "g" selector pattern
" call Decho("style case g: global selector pattern")
if A[0] < 2
- if exists("s:AlignGPat")
- unlet s:AlignGPat
+ if exists("s:AlignVPat")
+ unlet s:AlignVPat
" call Decho("unlet s:AlignGPat")
endif
else
@@ -286,8 +288,8 @@ fun! Align#AlignCtrl(...)
" first list item is a "v" selector pattern
" call Decho("style case v: global selector anti-pattern")
if A[0] < 2
- if exists("s:AlignVPat")
- unlet s:AlignVPat
+ if exists("s:AlignGPat")
+ unlet s:AlignGPat
" call Decho("unlet s:AlignVPat")
endif
else
@@ -297,9 +299,9 @@ fun! Align#AlignCtrl(...)
endif
"[-lrc+:] : set up s:AlignStyle
- if style =~# '[-lrc+:]'
+ if style =~# '[-lrc+:*]'
" call Decho("style case [-lrc+:]: field justification")
- let s:AlignStyle= substitute(style,'[^-lrc:+]','','g')
+ let s:AlignStyle= substitute(style,'[^-lrc:+*]','','g')
" call Decho("AlignStyle<".s:AlignStyle.">")
endif
@@ -316,11 +318,9 @@ fun! Align#AlignCtrl(...)
let s:AlignCtrl= '='
endif
- " restore search and options
- let @/ = keep_search
- let &ic= keep_ic
-
-" call Dret("AlignCtrl ".s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle)
+ " restore options and return
+ call s:RestoreUserOptions()
+" call Dret("Align#AlignCtrl ".s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle)
return s:AlignCtrl.'p'.s:AlignPrePad.'P'.s:AlignPostPad.s:AlignLeadKeep.s:AlignStyle
endfun
@@ -355,6 +355,9 @@ fun! Align#Align(hasctrl,...) range
return
endif
+ " save user options
+ call s:SaveUserOptions()
+
" set up a list akin to an argument list
if a:0 > 0
let A= s:QArgSplitter(a:1)
@@ -384,7 +387,8 @@ fun! Align#Align(hasctrl,...) range
let ipat= 1 + hasctrl
while ipat <= A[0]
if "" =~ A[ipat]
- echoerr "Align: separator<".A[ipat]."> matches zero-length string"
+ echoerr "(Align) separator<".A[ipat]."> matches zero-length string"
+ call s:RestoreUserOptions()
" call Dret("Align#Align")
return
endif
@@ -392,10 +396,8 @@ fun! Align#Align(hasctrl,...) range
endwhile
" record current search pattern for subsequent restoration
- let keep_search= @/
- let keep_ic = &ic
- let keep_report= &report
- set noic report=10000
+ " (these are all global-only options)
+ set noic report=10000 nohls
if A[0] > hasctrl
" Align will accept a list of separator regexps
@@ -447,17 +449,32 @@ fun! Align#Align(hasctrl,...) range
let begline = a:lastline
let endline = a:firstline
endif
+
+ " Expand range to cover align-able lines when the given range is only the current line.
+ " Look for the first line above the current line that matches the first separator pattern, and
+ " look for the last line below the current line that matches the first separator pattern.
+ if begline == endline
+" call Decho("case begline == endline")
+ if !exists("s:AlignPat_{1}")
+ echohl Error|echo "(Align) no separators specified!"|echohl None
+ call s:RestoreUserOptions()
+" call Dret("Align#Align")
+ return
+ endif
+ let seppat = s:AlignPat_{1}
+ let begline= search('^\%(\%('.seppat.'\)\@!.\)*$',"bnW")
+ if begline == 0|let begline= 1|else|let begline= begline + 1|endif
+ let endline= search('^\%(\%('.seppat.'\)\@!.\)*$',"nW")
+ if endline == 0|let endline= line("$")|else|let endline= endline - 1|endif
+" call Decho("begline=".begline." endline=".endline." curline#".line("."))
+ endif
" call Decho("begline=".begline." endline=".endline)
let fieldcnt = 0
if (begline == line("'>") && endline == line("'<")) || (begline == line("'<") && endline == line("'>"))
let vmode= visualmode()
" call Decho("vmode=".vmode)
if vmode == "\<c-v>"
- if exists("g:Align_xstrlen") && g:Align_xstrlen
- let ragged = ( col("'>") > s:Strlen(getline("'>")) || col("'<") > s:Strlen(getline("'<")) )
- else
- let ragged = ( col("'>") > strlen(getline("'>")) || col("'<") > strlen(getline("'<")) )
- endif
+ let ragged = ( col("'>") > s:Strlen(getline("'>")) || col("'<") > s:Strlen(getline("'<")) )
else
let ragged= 1
endif
@@ -469,10 +486,14 @@ fun! Align#Align(hasctrl,...) range
endif
" call Decho("lines[".begline.",".endline."] col[".begcol.",".endcol."] ragged=".ragged." AlignCtrl<".s:AlignCtrl.">")
- " Keep user options
- let etkeep = &l:et
- let pastekeep= &l:paste
- setlocal et paste
+ " record initial whitespace
+ if s:AlignLeadKeep == 'W'
+ let wskeep = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')")
+ endif
+
+ " Align needs these options
+ setl et
+ set paste
" convert selected range of lines to use spaces instead of tabs
" but if first line's initial white spaces are to be retained
@@ -480,11 +501,30 @@ fun! Align#Align(hasctrl,...) range
if begcol <= 0 && s:AlignLeadKeep == 'I'
" retain first leading whitespace for all subsequent lines
let bgntxt= substitute(getline(begline),'^\(\s*\).\{-}$','\1','')
+
+ " exception: retain first leading whitespace predicated on g and v patterns
+ " if such a selected line exists
+ if exists("s:AlignGPat")
+ let firstgline= search(s:AlignGPat,"cnW",endline)
+ if firstgline > 0
+ let bgntxt= substitute(getline(firstgline),'^\(\s*\).\{-}$','\1','')
+ endif
+ elseif exists("s:AlignVPat")
+ let firstvline= search(s:AlignVPat,"cnW",endline)
+ if firstvline > 0
+ let bgntxt= substitute('^\%(\%('.getline(firstvline).')\@!\)*$','^\(\s*\).\{-}$','\1','')
+ endif
+ endif
" call Decho("retaining 1st leading whitespace: bgntxt<".bgntxt.">")
- set noet
+ let &l:et= s:keep_et
endif
exe begline.",".endline."ret"
+ " record transformed to spaces leading whitespace
+ if s:AlignLeadKeep == 'W'
+ let wsblanks = map(getline(begline,endline),"substitute(v:val,'^\\(\\s*\\).\\{-}$','\\1','')")
+ endif
+
" Execute two passes
" First pass: collect alignment data (max field sizes)
" Second pass: perform alignment
@@ -493,19 +533,19 @@ fun! Align#Align(hasctrl,...) range
" call Decho(" ")
" call Decho("---- Pass ".pass.": ----")
- let line= begline
- while line <= endline
+ let curline= begline
+ while curline <= endline
" Process each line
- let txt = getline(line)
+ let txt = getline(curline)
" call Decho(" ")
-" call Decho("Pass".pass.": Line ".line." <".txt.">")
+" call Decho("Pass".pass.": Line ".curline." <".txt.">")
" AlignGPat support: allows a selector pattern (akin to g/selector/cmd )
if exists("s:AlignGPat")
" call Decho("Pass".pass.": AlignGPat<".s:AlignGPat.">")
if match(txt,s:AlignGPat) == -1
" call Decho("Pass".pass.": skipping")
- let line= line + 1
+ let curline= curline + 1
continue
endif
endif
@@ -515,7 +555,7 @@ fun! Align#Align(hasctrl,...) range
" call Decho("Pass".pass.": AlignVPat<".s:AlignVPat.">")
if match(txt,s:AlignVPat) != -1
" call Decho("Pass".pass.": skipping")
- let line= line + 1
+ let curline= curline + 1
continue
endif
endif
@@ -523,16 +563,12 @@ fun! Align#Align(hasctrl,...) range
" Always skip blank lines
if match(txt,'^\s*$') != -1
" call Decho("Pass".pass.": skipping")
- let line= line + 1
+ let curline= curline + 1
continue
endif
" Extract visual-block selected text (init bgntxt, endtxt)
- if exists("g:Align_xstrlen") && g:Align_xstrlen
- let txtlen= s:Strlen(txt)
- else
- let txtlen= strlen(txt)
- endif
+ let txtlen= s:Strlen(txt)
if begcol > 0
" Record text to left of selected area
let bgntxt= strpart(txt,0,begcol)
@@ -557,7 +593,8 @@ fun! Align#Align(hasctrl,...) range
" call Decho("Pass".pass.": txt<". txt .">")
" call Decho("Pass".pass.": endtxt<".endtxt.">")
if !exists("s:AlignPat_{1}")
- echohl Error|echo "no separators specified!"|echohl None
+ echohl Error|echo "(Align) no separators specified!"|echohl None
+ call s:RestoreUserOptions()
" call Dret("Align#Align")
return
endif
@@ -575,7 +612,7 @@ fun! Align#Align(hasctrl,...) range
let alignpostpad= s:AlignPostPad
let alignsep = s:AlignSep
let alignophold = " "
- let alignop = "l"
+ let alignop = 'l'
" call Decho("Pass".pass.": initial alignstyle<".alignstyle."> seppat<".seppat.">")
" Process each field on the line
@@ -606,23 +643,41 @@ fun! Align#Align(hasctrl,...) range
endif
endif
- " cylic separator alignment specification handling
+ " cyclic separator alignment specification handling
let alignsepop= strpart(alignsep,0,1)
let alignsep = strpart(alignsep,1).alignsepop
+ " ------------------------------------------------------
" mark end-of-field and the subsequent end-of-separator.
- " Extend field if alignop is '-'
+ " ------------------------------------------------------
let endfield = match(txt,seppat,bgnfield)
let sepfield = matchend(txt,seppat,bgnfield)
let skipfield= sepfield
-" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield)
+" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop)
+
+ " Mark eof: Extend field if alignop is '*' and AlignSkip() is true.
+ if alignop == '*' && exists("g:AlignSkip") && type(g:AlignSkip) == 2
+" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop)
+ " a '*' acts like a '-' while the g:AlignSkip function reference is true except that alignop doesn't advance
+ while g:AlignSkip(curline,endfield) && endfield != -1
+ let endfield = match(txt,seppat,skipfield)
+ let sepfield = matchend(txt,seppat,skipfield)
+ let skipfield = sepfield
+" call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">")
+ endwhile
+ let alignop = strpart(alignstyle,0,1)
+ let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1)
+" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop." (after *)")
+ endif
+
+ " Mark eof: Extend field if alignop is '-'
while alignop == '-' && endfield != -1
let endfield = match(txt,seppat,skipfield)
let sepfield = matchend(txt,seppat,skipfield)
let skipfield = sepfield
let alignop = strpart(alignstyle,0,1)
let alignstyle= strpart(alignstyle,1).strpart(alignstyle,0,1)
-" call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">")
+" call Decho("Pass".pass.": extend field: endfield<".strpart(txt,bgnfield,endfield-bgnfield)."> alignop<".alignop."> alignstyle<".alignstyle.">")
endwhile
let seplen= sepfield - endfield
" call Decho("Pass".pass.": seplen=[sepfield=".sepfield."] - [endfield=".endfield."]=".seplen)
@@ -637,26 +692,20 @@ fun! Align#Align(hasctrl,...) range
let field = bgntxt.field
let bgntxt= ""
endif
- if exists("g:Align_xstrlen") && g:Align_xstrlen
- let fieldlen = s:Strlen(field)
- else
- let fieldlen = strlen(field)
- endif
- let sFieldSize = "FieldSize_".ifield
- if !exists(sFieldSize)
+ let fieldlen= s:Strlen(field)
+ if !exists("FieldSize_{ifield}")
let FieldSize_{ifield}= fieldlen
-" call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field.">")
+" call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (init)")
elseif fieldlen > FieldSize_{ifield}
let FieldSize_{ifield}= fieldlen
-" call Decho("Pass".pass.": oset FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field.">")
+" call Decho("Pass".pass.": set FieldSize_{".ifield."}=".FieldSize_{ifield}." <".field."> (fieldlen>FieldSize_".ifield.")")
endif
- let sSepSize= "SepSize_".ifield
- if !exists(sSepSize)
+ if !exists("SepSize_{ifield}")
let SepSize_{ifield}= seplen
-" call Decho(" set SepSize_{".ifield."}=".SepSize_{ifield}." <".field.">")
+" call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (init)")
elseif seplen > SepSize_{ifield}
let SepSize_{ifield}= seplen
-" call Decho("Pass".pass.": oset SepSize_{".ifield."}=".SepSize_{ifield}." <".field.">")
+" call Decho("Pass".pass.": set SepSize_{".ifield."}=".SepSize_{ifield}." <".field."> (seplen>SepSize_".ifield.")")
endif
else
@@ -667,6 +716,8 @@ fun! Align#Align(hasctrl,...) range
let alignprepad = strpart(alignprepad,1).strpart(alignprepad,0,1)
let alignpostpad = strpart(alignpostpad,1).strpart(alignpostpad,0,1)
let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\1','')
+" call Decho("Pass".pass.": alignprepad <".alignprepad."> prepad =".prepad)
+" call Decho("Pass".pass.": alignpostpad<".alignpostpad."> postpad=".postpad)
if s:AlignLeadKeep == 'W'
let field = bgntxt.field
let bgntxt= ""
@@ -675,27 +726,28 @@ fun! Align#Align(hasctrl,...) range
let prepad = 0
let postpad= 0
endif
- if exists("g:Align_xstrlen") && g:Align_xstrlen
- let fieldlen = s:Strlen(field)
- else
- let fieldlen = strlen(field)
- endif
+ let fieldlen = s:Strlen(field)
let sep = s:MakeSpace(prepad).strpart(txt,endfield,sepfield-endfield).s:MakeSpace(postpad)
+" call Decho("Pass".pass.": sep<".sep."> (after prepad, sepfield-endfield,postpad)")
if seplen < SepSize_{ifield}
if alignsepop == "<"
" left-justify separators
let sep = sep.s:MakeSpace(SepSize_{ifield}-seplen)
+" call Decho("Pass".pass.": sep<".sep."> (left-justified)")
elseif alignsepop == ">"
" right-justify separators
let sep = s:MakeSpace(SepSize_{ifield}-seplen).sep
+" call Decho("Pass".pass.": sep<".sep."> (right-justified)")
else
" center-justify separators
let sepleft = (SepSize_{ifield} - seplen)/2
let sepright = SepSize_{ifield} - seplen - sepleft
let sep = s:MakeSpace(sepleft).sep.s:MakeSpace(sepright)
+" call Decho("Pass".pass.": sep<".sep."> (center-justified)")
endif
endif
- let spaces = FieldSize_{ifield} - fieldlen
+ let spaces = FieldSize_{ifield} - fieldlen
+" call Decho("Pass".pass.": spaces=[FieldSize_".ifield."=".FieldSize_{ifield}."] - [fieldlen=".fieldlen."]=".spaces)
" call Decho("Pass".pass.": Field #".ifield."<".field."> spaces=".spaces." be[".bgnfield.",".endfield."] pad=".prepad.','.postpad." FS_".ifield."<".FieldSize_{ifield}."> sep<".sep."> ragged=".ragged." doend=".doend." alignop<".alignop.">")
" Perform alignment according to alignment style justification
@@ -743,22 +795,33 @@ fun! Align#Align(hasctrl,...) range
if pass == 2
" Write altered line to buffer
-" call Decho("Pass".pass.": bgntxt<".bgntxt."> line=".line)
+" call Decho("Pass".pass.": bgntxt<".bgntxt."> curline=".curline)
" call Decho("Pass".pass.": newtxt<".newtxt.">")
" call Decho("Pass".pass.": endtxt<".endtxt.">")
- call setline(line,bgntxt.newtxt.endtxt)
+ keepj call setline(curline,bgntxt.newtxt.endtxt)
endif
+" call Decho("Pass".pass.": line#".curline."<".getline(".")."> (end-of-while)")
- let line = line + 1
- endwhile " line loop
+ let curline = curline + 1
+ endwhile " curline loop
let pass= pass + 1
endwhile " pass loop
" call Decho("end of two pass loop")
-
- " Restore user options
- let &l:et = etkeep
- let &l:paste = pastekeep
+" call Decho("ENDWHILE: cursor at (".line(".").",".col(".").") curline#".curline)
+
+ " restore original leading whitespace
+ if s:AlignLeadKeep == 'W'
+ let iline= begline
+ let i = 0
+" call Decho("restore original leading whitespace")
+ while iline <= endline
+" call Decho("exe ".iline."s/^".wsblanks[i]."/".wskeep[i]."/")
+ exe "keepj ".iline."s/^".wsblanks[i]."/".wskeep[i]."/"
+ let iline= iline + 1
+ let i = i + 1
+ endwhile
+ endif
if exists("s:DoAlignPop")
" AlignCtrl Map support
@@ -766,11 +829,8 @@ fun! Align#Align(hasctrl,...) range
unlet s:DoAlignPop
endif
- " restore current search pattern
- let @/ = keep_search
- let &ic = keep_ic
- let &report = keep_report
-
+ " restore user options and return
+ call s:RestoreUserOptions()
" call Dret("Align#Align")
return
endfun
@@ -778,7 +838,7 @@ endfun
" ---------------------------------------------------------------------
" Align#AlignPush: this command/function pushes an alignment control string onto a stack {{{1
fun! Align#AlignPush()
-" call Dfunc("AlignPush()")
+" call Dfunc("Align#AlignPush()")
" initialize the stack
if !exists("s:AlignCtrlStackQty")
@@ -806,7 +866,7 @@ fun! Align#AlignPush()
let s:AlignVPat_{s:AlignCtrlStackQty}= ""
endif
-" call Dret("AlignPush")
+" call Dret("Align#AlignPush")
endfun
" ---------------------------------------------------------------------
@@ -817,13 +877,13 @@ fun! Align#AlignPop()
" sanity checks
if !exists("s:AlignCtrlStackQty")
- echoerr "AlignPush needs to be used prior to AlignPop"
+ echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop"
" call Dret("Align#AlignPop <> : AlignPush needs to have been called first")
return ""
endif
if s:AlignCtrlStackQty <= 0
unlet s:AlignCtrlStackQty
- echoerr "AlignPush needs to be used prior to AlignPop"
+ echoerr "(AlignPop) AlignPush needs to be used prior to AlignPop"
" call Dret("Align#AlignPop <> : AlignPop needs to have been called first")
return ""
endif
@@ -857,15 +917,11 @@ endfun
" ---------------------------------------------------------------------
" Align#AlignReplaceQuotedSpaces: {{{1
-fun! Align#AlignReplaceQuotedSpaces()
-" call Dfunc("AlignReplaceQuotedSpaces()")
+fun! Align#AlignReplaceQuotedSpaces()
+" call Dfunc("Align#AlignReplaceQuotedSpaces()")
let l:line = getline(line("."))
- if exists("g:Align_xstrlen") && g:Align_xstrlen
- let l:linelen = s:Strlen(l:line)
- else
- let l:linelen = strlen(l:line)
- endif
+ let l:linelen = s:Strlen(l:line)
let l:startingPos = 0
let l:startQuotePos = 0
let l:endQuotePos = 0
@@ -875,28 +931,28 @@ fun! Align#AlignReplaceQuotedSpaces()
" "call Decho("in replace spaces. line=" . line('.'))
while (1)
let l:startQuotePos = match(l:line, l:quoteRe, l:startingPos)
- if (l:startQuotePos < 0)
-" "call Decho("No more quotes to the end of line")
- break
+ if (l:startQuotePos < 0)
+" call Decho("No more quotes to the end of line")
+ break
endif
let l:endQuotePos = match(l:line, l:quoteRe, l:startQuotePos + 1)
if (l:endQuotePos < 0)
-" "call Decho("Mismatched quotes")
- break
+" call Decho("Mismatched quotes")
+ break
endif
let l:spaceReplaceRe = '^.\{' . (l:startQuotePos + 1) . '}.\{-}\zs\s\ze.*.\{' . (linelen - l:endQuotePos) . '}$'
-" "call Decho('spaceReplaceRe="' . l:spaceReplaceRe . '"')
+" call Decho('spaceReplaceRe="' . l:spaceReplaceRe . '"')
let l:newStr = substitute(l:line, l:spaceReplaceRe, '%', '')
while (l:newStr != l:line)
-" "call Decho('newstr="' . l:newStr . '"')
+" call Decho('newstr="' . l:newStr . '"')
let l:line = l:newStr
let l:newStr = substitute(l:line, l:spaceReplaceRe, '%', '')
endwhile
let l:startingPos = l:endQuotePos + 1
endwhile
- call setline(line('.'), l:line)
+ keepj call setline(line('.'), l:line)
-" call Dret("AlignReplaceQuotedSpaces")
+" call Dret("Align#AlignReplaceQuotedSpaces")
endfun
" ---------------------------------------------------------------------
@@ -923,19 +979,20 @@ fun! s:QArgSplitter(qarg)
while args != ""
let iarg = 0
let arglen = strlen(args)
-" call Decho("args[".iarg."]<".args[iarg]."> arglen=".arglen)
+" call Decho(".args[".iarg."]<".args[iarg]."> arglen=".arglen)
" find index to first not-escaped '"'
+" call Decho("find index to first not-escaped \"")
while args[iarg] != '"' && iarg < arglen
if args[iarg] == '\'
let args= strpart(args,1)
endif
let iarg= iarg + 1
endwhile
-" call Decho("args<".args."> iarg=".iarg." arglen=".arglen)
+" call Decho(".args<".args."> iarg=".iarg." arglen=".arglen)
if iarg > 0
" handle left of quote or remaining section
-" call Decho("handle left of quote or remaining section")
+" call Decho(".handle left of quote or remaining section")
if args[iarg] == '"'
let qarglist= qarglist + split(strpart(args,0,iarg-1))
else
@@ -946,7 +1003,7 @@ fun! s:QArgSplitter(qarg)
elseif iarg < arglen && args[0] == '"'
" handle "quoted" section
-" call Decho("handle quoted section")
+" call Decho(".handle quoted section")
let iarg= 1
while args[iarg] != '"' && iarg < arglen
if args[iarg] == '\'
@@ -954,7 +1011,7 @@ fun! s:QArgSplitter(qarg)
endif
let iarg= iarg + 1
endwhile
-" call Decho("args<".args."> iarg=".iarg." arglen=".arglen)
+" call Decho(".args<".args."> iarg=".iarg." arglen=".arglen)
if args[iarg] == '"'
call add(qarglist,strpart(args,1,iarg-1))
let args= strpart(args,iarg+1)
@@ -963,12 +1020,14 @@ fun! s:QArgSplitter(qarg)
let args = ""
endif
endif
-" call Decho("qarglist".string(qarglist)." iarg=".iarg." args<".args.">")
+" call Decho(".qarglist".string(qarglist)." iarg=".iarg." args<".args.">")
endwhile
+" call Decho("end of loop (handling quoted arguments)")
else
" split at all whitespace
- let qarglist= split(a:qarg)
+" call Decho("split at all whitespace")
+ let qarglist= split(a:qarg,"[ \t]")
endif
let qarglistlen= len(qarglist)
@@ -984,21 +1043,26 @@ endfun
" nonzero value. Solution from Nicolai Weibull, vim docs
" (:help strlen()), Tony Mechelynck, and my own invention.
fun! s:Strlen(x)
-" call Dfunc("s:Strlen(x<".a:x.">")
- if g:Align_xstrlen == 1
+" call Dfunc("s:Strlen(x<".a:x."> g:Align_xstrlen=".g:Align_xstrlen)
+
+ if type(g:Align_xstrlen) == 1
+ " allow user to specify a function to compute the string length
+ exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')"
+
+ elseif g:Align_xstrlen == 1
" number of codepoints (Latin a + combining circumflex is two codepoints)
" (comment from TM, solution from NW)
let ret= strlen(substitute(a:x,'.','c','g'))
elseif g:Align_xstrlen == 2
- " number of spacing codepoints (Latin a + combining circumflex is one spacing
+ " number of spacing codepoints (Latin a + combining circumflex is one spacing
" codepoint; a hard tab is one; wide and narrow CJK are one each; etc.)
" (comment from TM, solution from TM)
- let ret=strlen(substitute(a:x, '.\Z', 'x', 'g'))
+ let ret=strlen(substitute(a:x, '.\Z', 'x', 'g'))
elseif g:Align_xstrlen == 3
- " virtual length (counting, for instance, tabs as anything between 1 and
- " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately
+ " virtual length (counting, for instance, tabs as anything between 1 and
+ " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately
" preceded by lam, one otherwise, etc.)
" (comment from TM, solution from me)
let modkeep= &l:mod
@@ -1006,17 +1070,64 @@ fun! s:Strlen(x)
call setline(line("."),a:x)
let ret= virtcol("$") - 1
d
+ keepj norm! k
let &l:mod= modkeep
else
" at least give a decent default
- ret= strlen(a:x)
+ if v:version >= 703
+ let ret= strdisplaywidth(a:x)
+ else
+ let ret= strlen(a:x)
+ endif
endif
" call Dret("s:Strlen ".ret)
return ret
endfun
" ---------------------------------------------------------------------
+" s:SaveUserOptions: {{{1
+fun! s:SaveUserOptions()
+" call Dfunc("s:SaveUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a'))
+ if !exists("s:saved_user_options")
+ let s:saved_user_options = 1
+ let s:keep_search = @/
+ let s:keep_et = &l:et
+ let s:keep_hls = &hls
+ let s:keep_ic = &ic
+ let s:keep_paste = &paste
+ let s:keep_report = &report
+ else
+ let s:saved_user_options = s:saved_user_options + 1
+ endif
+" call Dret("s:SaveUserOptions : s:saved_user_options=".s:saved_user_options)
+endfun
+
+" ---------------------------------------------------------------------
+" s:RestoreUserOptions: {{{1
+fun! s:RestoreUserOptions()
+" call Dfunc("s:RestoreUserOptions() s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a'))
+ if exists("s:saved_user_options") && s:saved_user_options == 1
+ let @/ = s:keep_search
+ let &l:et = s:keep_et
+ let &hls = s:keep_hls
+ let &ic = s:keep_ic
+ let &paste = s:keep_paste
+ let &report = s:keep_report
+ unlet s:keep_search
+ unlet s:keep_et
+ unlet s:keep_hls
+ unlet s:keep_ic
+ unlet s:keep_paste
+ unlet s:keep_report
+ unlet s:saved_user_options
+ elseif exists("s:saved_user_options")
+ let s:saved_user_options= s:saved_user_options - 1
+ endif
+" call Dret("s:RestoreUserOptions : s:saved_user_options=".(exists("s:saved_user_options")? s:saved_user_options : 'n/a'))
+endfun
+
+" ---------------------------------------------------------------------
" Set up default values: {{{1
"call Decho("-- Begin AlignCtrl Initialization --")
call Align#AlignCtrl("default")
diff --git a/autoload/AlignMaps.vim b/autoload/AlignMaps.vim
index ace2de8..9d20513 100644
--- a/autoload/AlignMaps.vim
+++ b/autoload/AlignMaps.vim
@@ -1,15 +1,25 @@
" AlignMaps.vim : support functions for AlignMaps
-" Author: Charles E. Campbell, Jr.
-" Date: Mar 03, 2009
-" Version: 41
+" Author: Charles E. Campbell
+" Date: Mar 12, 2013
+" Version: 43
+" 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,
+" Align.vim is provided *as is* and comes with no warranty
+" of any kind, either expressed or implied. By using this
+" plugin, you agree that in no event will the copyright
+" holder be liable for any damages resulting from the use
+"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_AlignMaps")
finish
endif
-let g:loaded_AlignMaps= "v41"
+let g:loaded_AlignMaps= "v43"
let s:keepcpo = &cpo
set cpo&vim
+"DechoTabOn
" =====================================================================
" Functions: {{{1
@@ -20,7 +30,7 @@ fun! AlignMaps#WrapperStart(vis) range
" call Dfunc("AlignMaps#WrapperStart(vis=".a:vis.")")
if a:vis
- norm! '<ma'>
+ keepj norm! '<ma'>
endif
if line("'y") == 0 || line("'z") == 0 || !exists("s:alignmaps_wrapcnt") || s:alignmaps_wrapcnt <= 0
@@ -34,22 +44,22 @@ fun! AlignMaps#WrapperStart(vis) range
let s:alignmaps_posn = SaveWinPosn(0)
" set up fencepost blank lines
put =''
- norm! mz'a
+ keepj norm! mz'a
put! =''
ky
let s:alignmaps_zline = line("'z")
- exe "'y,'zs/@/\177/ge"
+ exe "keepj 'y,'zs/@/\177/ge"
else
" call Decho("embedded wrapper")
let s:alignmaps_wrapcnt = s:alignmaps_wrapcnt + 1
- norm! 'yjma'zk
+ keepj norm! 'yjma'zk
endif
" change some settings to align-standard values
set nogd
set ch=2
AlignPush
- norm! 'zk
+ keepj norm! 'zk
" call Dret("AlignMaps#WrapperStart : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
endfun
@@ -59,7 +69,7 @@ fun! AlignMaps#WrapperEnd() range
" call Dfunc("AlignMaps#WrapperEnd() alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
" remove trailing white space introduced by whatever in the modification zone
- 'y,'zs/ \+$//e
+ keepj 'y,'zs/ \+$//e
" restore AlignCtrl settings
AlignPop
@@ -67,14 +77,14 @@ fun! AlignMaps#WrapperEnd() range
let s:alignmaps_wrapcnt= s:alignmaps_wrapcnt - 1
if s:alignmaps_wrapcnt <= 0
" initial wrapper ending
- exe "'y,'zs/\177/@/ge"
+ exe "keepj 'y,'zs/\177/@/ge"
" if the 'z line hasn't moved, then go ahead and restore window position
let zstationary= s:alignmaps_zline == line("'z")
" remove fencepost blank lines.
" restore 'a
- norm! 'yjmakdd'zdd
+ keepj norm! 'yjmakdd'zdd
" restore original 'y, 'z, and window positioning
call RestoreMark(s:alignmaps_keepmy)
@@ -102,6 +112,20 @@ fun! AlignMaps#WrapperEnd() range
endfun
" ---------------------------------------------------------------------
+" AlignMaps#MakeMap: make both a normal-mode and a visual mode map for mapname {{{2
+fun! AlignMaps#MakeMap(mapname)
+ if exists("g:maplocalleader")
+ let maplead= g:maplocalleader
+ elseif exists("g:mapleader")
+ let maplead= g:mapleader
+ else
+ let maplead= '\'
+ endif
+ exe "nmap <unique> ".maplead.a:mapname." <Plug>AM_".a:mapname
+ exe "vmap <silent> ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."<cr>"
+endfun
+
+" ---------------------------------------------------------------------
" AlignMaps#StdAlign: some semi-standard align calls {{{2
fun! AlignMaps#StdAlign(mode) range
" call Dfunc("AlignMaps#StdAlign(mode=".a:mode.")")
@@ -135,10 +159,10 @@ fun! AlignMaps#CharJoiner(chr)
let aline = line("'a")
let rep = line(".") - aline
while rep > 0
- norm! 'a
+ keepj norm! 'a
while match(getline(aline),a:chr . "\s*$") != -1 && rep >= 0
" while = at end-of-line, delete it and join with next
- norm! 'a$
+ keepj norm! 'a$
j!
let rep = rep - 1
endwhile
@@ -149,7 +173,7 @@ fun! AlignMaps#CharJoiner(chr)
break
endif
" prepare for next line
- norm! jma
+ keepj norm! jma
let aline = line("'a")
endwhile
" call Dret("AlignMaps#CharJoiner")
@@ -159,31 +183,32 @@ endfun
" AlignMaps#Equals: supports \t= and \T= {{{2
fun! AlignMaps#Equals() range
" call Dfunc("AlignMaps#Equals()")
- 'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e
- 'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge
- 'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
- 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge
- norm g'zk
+ keepj 'a,'zs/\s\+\([.*/+\-%|&\~^]\==\)/ \1/e
+ keepj 'a,'zs@ \+\([.*/+\-%|&\~^]\)=@\1=@ge
+ keepj 'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
+ keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge
+ keepj norm g'zk
AlignCtrl mIp1P1=l =
AlignCtrl g =
- 'a,'z-1Align
- 'a,'z-1s@\([*/+\-%|&\~^!=]\)\( \+\)=@\2\1=@ge
- 'a,'z-1s/\( \+\);/;\1/ge
+ keepj 'a,'z-1Align
+ keepj 'a,'z-1s@\([.*/%|&\~^!=]\)\( \+\)=@\2\1=@ge
+ keepj 'a,'z-1s@[^+\-]\zs\([+\-]\)\( \+\)=@\2\1=@ge
+ keepj 'a,'z-1s/\( \+\);/;\1/ge
if &ft == "c" || &ft == "cpp"
" call Decho("exception for ".&ft)
- 'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e
- 'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e
+ keepj 'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e
+ keepj 'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e
if exists("g:mapleader")
- exe "norm 'zk"
+ exe "keepj norm 'zk"
call AlignMaps#StdAlign(1)
else
- exe "norm 'zk"
+ exe "keepj norm 'zk"
call AlignMaps#StdAlign(1)
endif
- 'y,'zs/^\(\s*\) @/\1/e
+ keepj 'y,'zs/^\(\s*\) @/\1/e
endif
- 'a,'z-1s/\%x0f/=/ge
- 'y,'zs/ @//eg
+ keepj 'a,'z-1s/\%x0f/=/ge
+ keepj 'y,'zs/ @//eg
" call Dret("AlignMaps#Equals")
endfun
@@ -194,10 +219,11 @@ fun! AlignMaps#Afnc()
" call Dfunc("AlignMaps#Afnc()")
" keep display quiet
- let chkeep = &ch
- let gdkeep = &gd
- let vekeep = &ve
- set ch=2 nogd ve=
+ let chkeep = &l:ch
+ let gdkeep = &l:gd
+ let wwkeep = &l:ww
+ let vekeep = &l:ve
+ setlocal ch=2 nogd ve= ww=b,s,<,>,[,]
" will use marks y,z ; save current values
let mykeep = SaveMark("'y")
@@ -206,7 +232,7 @@ fun! AlignMaps#Afnc()
" Find beginning of function -- be careful to skip over comments
let cmmntid = synIDtrans(hlID("Comment"))
let stringid = synIDtrans(hlID("String"))
- exe "norm! ]]"
+ exe "keepj norm! ]]"
while search(")","bW") != 0
" call Decho("line=".line(".")." col=".col("."))
let parenid= synIDtrans(synID(line("."),col("."),1))
@@ -214,23 +240,23 @@ fun! AlignMaps#Afnc()
break
endif
endwhile
- norm! %my
- s/(\s*\(\S\)/(\r \1/e
- exe "norm! `y%"
- s/)\s*\(\/[*/]\)/)\r\1/e
- exe "norm! `y%mz"
- 'y,'zs/\s\+$//e
- 'y,'zs/^\s\+//e
- 'y+1,'zs/^/ /
+ keepj norm! %my
+ keepj s/(\s*\(\S\)/(\r \1/e
+ exe "keepj norm! `y%"
+ keepj s/)\s*\(\/[*/]\)/)\r\1/e
+ exe "keepj norm! `y%mz"
+ keepj 'y,'zs/\s\+$//e
+ keepj 'y,'zs/^\s\+//e
+ keepj 'y+1,'zs/^/ /
" insert newline after every comma only one parenthesis deep
- sil! exe "norm! `y\<right>h"
+ exe "sil! keepj norm! `y\<right>h"
let parens = 1
let cmmnt = 0
let cmmntline= -1
while parens >= 1
-" call Decho("parens=".parens." @a=". at a)
- exe 'norm! ma "ay`a '
+ exe 'keepj norm! ma "ay`a '
+" call Decho("parens=".parens." cmmnt=".cmmnt." cmmntline=".cmmntline." line(.)=".line(".")." @a<". at a."> line<".getline(".").">")
if @a == "("
let parens= parens + 1
elseif @a == ")"
@@ -261,41 +287,42 @@ fun! AlignMaps#Afnc()
endif
elseif @a == "," && parens == 1 && cmmnt == 0
- exe "norm! i\<CR>\<Esc>"
+ exe "keepj norm! i\<CR>\<Esc>"
endif
endwhile
- norm! `y%mz%
- sil! 'y,'zg/^\s*$/d
+ sil! keepj norm! `y%mz%
+ sil! keepj 'y,'zg/^\s*$/d
" perform substitutes to mark fields for Align
- sil! 'y+1,'zv/^\//s/^\s\+\(\S\)/ \1/e
- sil! 'y+1,'zv/^\//s/\(\S\)\s\+/\1 /eg
- sil! 'y+1,'zv/^\//s/\* \+/*/ge
- sil! 'y+1,'zv/^\//s/\w\zs\s*\*/ */ge
+ sil! keepj 'y+1,'zv/^\//s/^\s\+\(\S\)/ \1/e
+ sil! keepj 'y+1,'zv/^\//s/\(\S\)\s\+/\1 /eg
+ sil! keepj 'y+1,'zv/^\//s/\* \+/*/ge
+ sil! keepj 'y+1,'zv/^\//s/\w\zs\s*\*/ */ge
" func
" ws <- declaration -> <-ptr -> <-var-> <-[array][] -> <-glop-> <-end->
- sil! 'y+1,'zv/^\//s/^\s*\(\(\K\k*\s*\)\+\)\s\+\([(*]*\)\s*\(\K\k*\)\s*\(\(\[.\{-}]\)*\)\s*\(.\{-}\)\=\s*\([,)]\)\s*$/ \1@#\3@\4\5@\7\8/e
- sil! 'y+1,'z+1g/^\s*\/[*/]/norm! kJ
- sil! 'y+1,'z+1s%/[*/]%@&@%ge
- sil! 'y+1,'z+1s%*/%@&%ge
+ sil! keepj 'y+1,'zv/^\//s/^\s*\(\(\K\k*\s*\)\+\)\s\+\([(*]*\)\s*\(\K\k*\)\s*\(\(\[.\{-}]\)*\)\s*\(.\{-}\)\=\s*\([,)]\)\s*$/ \1@#\3@\4\5@\7\8/e
+ sil! keepj 'y+1,'z+1g/^\s*\/[*/]/norm! kJ
+ sil! keepj 'y+1,'z+1s%/[*/]%@&@%ge
+ sil! keepj 'y+1,'z+1s%*/%@&%ge
AlignCtrl mIp0P0=l @
- sil! 'y+1,'zAlign
- sil! 'y,'zs%@\(/[*/]\)@%\t\1 %e
- sil! 'y,'zs%@\*/% */%e
- sil! 'y,'zs/@\([,)]\)/\1/
- sil! 'y,'zs/@/ /
+ sil! keepj 'y+1,'zAlign
+ sil! keepj 'y,'zs%@\(/[*/]\)@%\t\1 %e
+ sil! keepj 'y,'zs%@\*/% */%e
+ sil! keepj 'y,'zs/@\([,)]\)/\1/
+ sil! keepj 'y,'zs/@/ /
AlignCtrl mIlrp0P0= # @
- sil! 'y+1,'zAlign
- sil! 'y+1,'zs/#/ /
- sil! 'y+1,'zs/@//
- sil! 'y+1,'zs/\(\s\+\)\([,)]\)/\2\1/e
+ sil! keepj 'y+1,'zAlign
+ sil! keepj 'y+1,'zs/#/ /
+ sil! keepj 'y+1,'zs/@//
+ sil! keepj 'y+1,'zs/\(\s\+\)\([,)]\)/\2\1/e
" Restore
call RestoreMark(mykeep)
call RestoreMark(mzkeep)
- let &ch= chkeep
- let &gd= gdkeep
- let &ve= vekeep
+ let &l:ch= chkeep
+ let &l:gd= gdkeep
+ let &l:ww= wwkeep
+ let &l:ve= vekeep
" call Dret("AlignMaps#Afnc")
endfun
@@ -310,12 +337,11 @@ fun! AlignMaps#FixMultiDec()
let curline = getline(".")
" call Decho("curline<".curline.">")
- " Get the type. I'm assuming one type per line (ie. int x; double y; on one line will not be handled properly)
- let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9_ \t]*\)\s\+[(*]*\h.*$','\1','')
+ let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+[(*]*\h.*$','\1','')
" call Decho("@x<". at x.">")
" transform line
- exe 's/,/;\r'. at x.' /ge'
+ exe 'keepj s/,/;\r'. at x.' /ge'
"restore register x
let @x= xkeep
@@ -324,6 +350,51 @@ fun! AlignMaps#FixMultiDec()
endfun
" ---------------------------------------------------------------------
+" AlignMaps#AlignMapsClean: this function removes the AlignMaps plugin {{{2
+fun! AlignMaps#AlignMapsClean()
+" call Dfunc("AlignMaps#AlignMapsClean()")
+ for home in split(&rtp,',') + ['']
+" call Decho("considering home<".home.">")
+ if isdirectory(home)
+ if filereadable(home."/autoload/AlignMaps.vim")
+" call Decho("deleting ".home."/autoload/AlignMaps.vim")
+ call delete(home."/autoload/AlignMaps.vim")
+ endif
+ if filereadable(home."/plugin/AlignMapsPlugin.vim")
+" call Decho("deleting ".home."/plugin/AlignMapsPlugin.vim")
+ call delete(home."/plugin/AlignMapsPlugin.vim")
+ endif
+ endif
+ endfor
+" call Dret("AlignMaps#AlignMapsClean")
+endfun
+
+" ---------------------------------------------------------------------
+" AlignMaps#Vis: interfaces with visual maps {{{2
+fun! AlignMaps#Vis(plugmap) range
+" call Dfunc("AlignMaps#VisCall(plugmap<".a:plugmap.">) ".a:firstline.",".a:lastline)
+
+ let amark= SaveMark("a")
+ exe a:firstline
+ ka
+ exe a:lastline
+
+ if exists("g:maplocalleader")
+ let maplead= g:maplocalleader
+ elseif exists("g:mapleader")
+ let maplead= g:mapleader
+ else
+ let maplead= '\'
+ endif
+
+" call Decho("exe norm ".maplead.a:plugmap)
+ exe " norm ".maplead.a:plugmap
+
+ call RestoreMark(amark)
+" call Dret("AlignMaps#VisCall")
+endfun
+
+" ---------------------------------------------------------------------
" Restore: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
diff --git a/debian/changelog b/debian/changelog
index 4fbd198..960d5c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ vim-scripts (20121008) UNRELEASED; urgency=low
- bufexplorer: Updated to 7.3.6
- gnupg: Updated to 2.5 (Closes: #717049)
- taglist: Updated to 4.6 (Closes: #719613)
+ - Align: Updated to 37/43
* Add po-escape.diff to properly escape filenames when calling msgfmt.
(Closes: #697135)
* debian/vim-scripts.pl: Remove logged ip address from downloaded
diff --git a/debian/vim-scripts.status b/debian/vim-scripts.status
index 8c03f74..61f3b3e 100644
--- a/debian/vim-scripts.status
+++ b/debian/vim-scripts.status
@@ -110,13 +110,13 @@ script_name: plugin/AlignPlugin.vim
addon: align
description: commands and maps for aligned text, equations, declarations, ...
script_url: http://www.vim.org/scripts/script.php?script_id=294
-author: Charles Campbell
+author: Charles E. Campbell
author_url: http://www.vim.org/account/profile.php?user_id=96
email: drchip at campbellfamily.biz
license: licese [4], see below
extras: doc/Align.txt, plugin/AlignMapsPlugin.vim, plugin/cecutil.vim, autoload/Align.vim, autoload/AlignMaps.vim
disabledby: let loaded_alignPlugin = 1
-version: 35/41
+version: 37/43
script_name: plugin/cvsmenu.vim
addon: cvsmenu
diff --git a/doc/Align.txt b/doc/Align.txt
index c447372..8c8c716 100644
--- a/doc/Align.txt
+++ b/doc/Align.txt
@@ -1,8 +1,8 @@
-*align.txt* The Alignment Tool Mar 04, 2009
+*align.txt* The Alignment Tool Jan 07, 2013
-Author: Charles E. Campbell, Jr. <NdrOchip at ScampbellPfamily.AbizM>
+Author: Charles E. Campbell <NdrOchip at ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
-Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright*
+Copyright: (c) 2004-2012 by Charles E. Campbell *Align-copyright*
The VIM LICENSE applies to Align.vim, AlignMaps.vim, and Align.txt
(see |copyright|) except use "Align and AlignMaps" instead of "Vim"
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
@@ -26,6 +26,7 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright*
Temporary Settings.....: |alignctrl-m|
Padding................: |alignctrl-p| |alignctrl-P|
Current Options........: |alignctrl-settings| |alignctrl-|
+ Alignment Control Init...: |alignctrl-init|
Alignment................: |align-align|
4. Alignment Maps...........: |align-maps|
\a,....................: |alignmap-a,|
@@ -77,9 +78,9 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright*
|| | | ||
|| | +-------------------------------------------------------++
|| 1st arg | = | = all separator patterns are equivalent and are ||
-|| | | simultaneously active. Patterns are |regexp|. ||
+|| | | simultaneously active. Patterns are |regexp|. ||
|| | | C cycle through separator patterns. Patterns are ||
-|| | | |regexp| and are active sequentially. ||
+|| | | |regexp| and are active sequentially. ||
|| | | ||
|| | < | < left justify separator Separators are justified, ||
|| | | > right justify separator too. Separator styles ||
@@ -91,6 +92,7 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright*
|| | | - skip this separator ||
|| | | + re-use last justification method ||
|| | | : treat rest of text as a field ||
+|| | | * use AlignSkip() function (to skip or not) ||
|| | | ||
|| | p1 | p### pad separator on left by # blanks ||
|| | P1 | P### pad separator on right by # blanks ||
@@ -142,7 +144,7 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright*
3. Alignment Usage *alignusage* *align-usage* *align-userguide* {{{1
-ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2
+ALIGNMENT CONCEPTS *align-concept* *align-concepts* *alignctrl* {{{1
The typical text to be aligned is considered to be:
@@ -176,12 +178,14 @@ ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2
< Note how each "=" sign is surrounded by a single space; the
default padding is p1P1 (p1 means one space before the separator,
and P1 means one space after it). If you wish to change the
- padding, say to no padding, use (see |alignctrl-p|) >
+ padding, say, to no padding, use (see |alignctrl-p|) >
+
:AlignCtrl lp0P0
< Next, note how each field is left justified; that's what the "l"
- (a small letter "ell") does. If right-justification of the fields
- had been desired, an "r" could've been used: >
+ in the AlignCtrl parameters (a small letter "ell") does. If
+ right-justification of the fields had been desired, an "r"
+ could've been used: >
:AlignCtrl r
< yielding >
x = y = z = 3;
@@ -196,10 +200,10 @@ ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2
justify, right justify, or center them, too (see |alignctrl-<|).
Assume that for some reason a left-right-left-right-... justification
- sequence was wished. This wish is simply achieved with >
+ sequence was desired. This wish is simply achieved with >
:AlignCtrl lr
:1,4Align =
-< because the justification commands are considered to be "cylic"; ie.
+< because the justification commands are considered to be "cyclic"; ie.
lr is the same as lrlrlrlrlrlrlr...
There's a lot more discussed under |alignctrl|; hopefully the examples
@@ -261,7 +265,7 @@ ALIGNMENT COMMANDS *align-command* *align-commands* {{{2
< Also see |alignctrl-m| for a way to automatically do
an AlignPop after an Align (primarily this is for maps).
-ALIGNMENT OPTIONS *align-option* *align-options* {{{2
+ALIGNMENT OPTIONS *align-option* *align-options* *align-xstrlen* {{{2
*align-utf8* *align-utf* *align-codepoint* *align-strlen* *align-multibyte*
For those of you who are using 2-byte (or more) characters such as are
@@ -279,7 +283,7 @@ ALIGNMENT OPTIONS *align-option* *align-options* {{{2
vim compiled without multi-byte support
$LANG is en_US.UTF-8 (assuming USA english)
- Number of codepoints (Latin a + combining circumflex is two codepoints)~
+ Number of codepoints (Latin a + combining circumflex are two codepoints)~
>
let g:Align_xstrlen= 1 (default)
<
@@ -295,16 +299,23 @@ ALIGNMENT OPTIONS *align-option* *align-options* {{{2
>
let g:Align_xstrlen= 3
<
+ User may specify a function to compute the string length~
+>
+ let g:Align_xstrlen= "strlen"
+< This method will cause Align to call upon the named function returning
+ string length. it should resemble the |strlen()| function, taking one
+ argument (the string) for input and returning the string length.
+
By putting one of these settings into your <.vimrc>, Align will use an
internal (interpreted) function to determine a string's length instead
- of the Vim's built-in |strlen()| function. Since the function is
+ of Vim's built-in |strlen()| function. Since the function is
interpreted, Align will run a bit slower but will handle such strings
- correctly. The last setting (g:Align_xstrlen= 3) probably will run
- the slowest but be the most accurate. (thanks to Tony Mechelynck for
- these)
+ correctly. The last settings (g:Align_xstrlen= 3 and
+ g:Align_xstrlen="userfuncname") probably will run the slowest but be
+ the most accurate. (thanks to Tony Mechelynck for these)
-ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
+ALIGNMENT CONTROL *:AlignCtrl* *align-control* {{{2
This command doesn't do the alignment operation itself; instead, it
controls subsequent alignment operation(s).
@@ -322,7 +333,7 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
<
where "ws" stands for "white space" such as blanks and/or tabs.
-
+
SEPARATORS *alignctrl-separators* {{{3
As a result, separators may not have white space (tabs or blanks) on
@@ -337,10 +348,11 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
(ie. @), and then perform a substitute to revert the separators back
to their desired condition (ie. s/@/ :: /g).
- The Align#Align() function will first convert tabs over the region into
- spaces and then apply alignment control. Except for initial white
- space, white space surrounding the fields is ignored. One has three
- options just for handling initial white space:
+ The Align#Align() function (which is invoked by the :Align command)
+ will first convert tabs over the region into spaces and then apply
+ alignment control. Except for initial white space, white space
+ surrounding the fields is ignored. One has three options just for
+ handling initial white space:
--- *alignctrl-w*
@@ -357,9 +369,9 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
+------------------+---------------+-------------------+-----------------+
| Original | w option | W option | I option |
+------------------+---------------+-------------------+-----------------+
- | a := baaa |a := baaa | a : = baaa | a := baaa |
- | caaaa := deeee |caaaa := deeee | caaaa : = deeee| caaaa := deeee|
- | ee := f |ee := f | ee : = f | ee := f |
+ | a := baaa |a := baaa | a := baaa | a := baaa |
+ | caaaa := deeee |caaaa := deeee | caaaa := deeee | caaaa := deeee|
+ | ee := f |ee := f | ee := f | ee := f |
+------------------+---------------+-------------------+-----------------+
<
The original has at least one leading white space on every line.
@@ -397,17 +409,19 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
cycle only consists of one character (the "l").
Every time left-justification is used for fields.
AlignCtrl r : The = separator is repeatedly re-used, as the
- cycle only consists of one character (the "l").
+ cycle only consists of one character (the "r").
Every time right-justification is used for fields
AlignCtrl lr: Again, the "=" separator is repeatedly re-used,
but the fields are justified alternately between
left and right.
- Even more separator control is available. With "-+:":
+ Even more separator control is available! With "-+:":
- - : skip treating the separator as a separator. *alignctrl--*
- + : repeat use of the last "lrc" justification *alignctrl-+*
- : : treat the rest of the line as a single field *alignctrl-:*
+ - : skip treating the separator as a separator. *alignctrl--*
+ + : repeat use of the last "lrc" justification *alignctrl-+*
+ : : treat the rest of the line as a single field *alignctrl-:*
+ * : like -, but only if g:AlignSkip() returns true *alignctrl-star*
+ (see |alignctrl-alignskip|)
Example: More justification options: Align = >
+------------+---------------+--------------------+---------------+
@@ -452,6 +466,35 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
3rd separator only: AlignCtrl --l:
etc.
+ *g:AlignSkip*
+ Align Skip Control *alignctrl-alignskip*
+
+ The separator control '*' permits a function to decide whether or
+ not a character which matches the current separator pattern should
+ instead be skipped.
+
+ 1. Define a function; example: >
+
+ fun! AlignSkipString(lineno,indx)
+ let synid = synID(a:lineno,a:indx+1,1)
+ let synname = synIDattr(synIDtrans(synid),"name")
+ let ret= (synname == "String")? 1 : 0
+ return ret
+ endfun
+<
+ Input: lineno: current line number
+ indx : index to character; leftmost character
+ in the line has an indx of 0 (like |strpart()|)
+ Output: 0 : if separator is ok
+ 1 : skip separator like it was a '-'
+
+ 2. Set up |g:AlignSkip| as a function reference (see |Funcref|): >
+
+ let g:AlignSkip= function("AlignSkipString")
+<
+ 3. Use * as a separator control where a separator potentially should
+ be skipped over.
+
--- *alignctrl-=*
=C CYCLIC VS ALL-ACTIVE SEPARATORS *alignctrl-C* {{{3
@@ -465,8 +508,10 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
constructed: >
AlignCtrl ... pat1 pat2 pat3
+< becomes >
\(pat1\|pat2\|pat3\)
-<
+< (ie. pat1 -or- pat2 -or- pat3; see |/bar|)
+
Each separator pattern is thus equivalent and simultaneously active.
The cyclic separator AlignCtrl option stores a list of patterns, only
one of which is active for each field at a time.
@@ -606,12 +651,12 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
|five= 6; |five = 6; |five = 6; |
+----------------+------------------+----------------+
<
- The first "Align =" aligned with all "="s, including that one in the
- "skip=this" comment.
+ The first "Align =" aligned with all "="s, including the one in the
+ "/* skip=this */" comment.
The second "Align =" had a AlignCtrl v-pattern which caused it to skip
- (ignore) the "skip=this" line when aligning.
-
+ (ignore) the "/* skip=this */" line when aligning.
+
To remove AlignCtrl's g and v patterns, use (as appropriate) >
AlignCtrl g
@@ -683,7 +728,7 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
AlignCtrl......|alignctrl|
qty............|align-concept|
- AlignStyle.....|alignctrl--| |alignctrl-+| |alignctrl-:||alignctrl-c|
+ AlignStyle.....|alignctrl--| |alignctrl-+| |alignctrl-:| |alignctrl-c|
Padding........|alignctrl-p| |alignctrl-P|
One may get a string which can be fed back into AlignCtrl: >
@@ -697,9 +742,21 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
however: >
:let alignctrl= Align#AlignCtrl("d")
-<
-ALIGNMENT *align-align* {{{2
+
+ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{2
+
+ If you'd like to have your own default AlignCtrl, you'll be wanting to
+ put it in a file such as: >
+
+ $HOME/.vim/after/plugin/AlignPlugin.vim
+
+< Anything in that file would be sourced at startup, but after your
+ .vimrc and after $HOME/.vim/plugin/AlignPlugin.vim; hence, :Align
+ and :AlignCtrl will then be defined.
+
+
+ALIGNMENT *:Align* *align-align* {{{2
Once the alignment control has been determined, the user specifies a
range of lines for the Align command/function to do its thing.
@@ -758,23 +815,31 @@ ALIGNMENT *align-align* {{{2
==============================================================================
4. Alignment Maps *alignmaps* *align-maps* {{{1
- There are a number of maps using Align#AlignCtrl() and Align#Align()
- in the <AlignMapsPlugin.vim> file. This file may also be put into the
- plugins subdirectory. Since AlignCtrl and Align supercede textab and
- its <ttalign.vim> file, the maps either have a leading "t" (for
- "textab") or the more complicated ones an "a" (for "alignment") for
- backwards compatibility.
-
- The maps are shown below with a leading backslash (\). Actually, the
- <Leader> construct is used (see |mapleader|), so the maps' leading
- kick-off character is easily customized.
-
- Furthermore, all AlignMapsPlugin.vim maps use the <Plug> construct (see
- |<Plug>|and |usr_41.txt|). Hence, if one wishes to override the
- mapping entirely, one may do that, too. As an example: >
+ There are a number of maps provided in the AlignMaps plugin which
+ depend upon the Align plugin. The maps provided by AlignMaps
+ typically start with a leading "t" (for the older "textab" program
+ which Align supercedes) or with an "a" for the more complicated
+ alignment maps.
+
+ The AlignMaps plugin, although provided in the vimball containing
+ Align.vim, is really a separate plugin (Align doesn't depend on
+ AlignMaps). Consequently, if you'd rather not have AlignMaps's
+ mappings, just use the *:AlignMapsClean* command to remove its
+ components. The :AlignMapsClean command does not remove any maps
+ generated by AlignMaps in the current instance of vim.
+
+ The maps are shown below with a leading backslash (\). However, the
+ actual maps use the <Leader> construct (see |mapleader|), so the maps'
+ leading kick-off character is easily customized.
+
+ Furthermore, all the maps specified by the AlignMaps plugin use the
+ <Plug> construct (see |<Plug>|and |usr_41.txt|). Hence, if one wishes
+ to override the mapping(s) entirely, one may do that, too. As an
+ example: >
map <Leader>ACOM <Plug>AM_acom
-< would have \ACOM do what \acom previously did (assuming that the
- mapleader has been left at its default value of a backslash).
+< would have \ACOM do
+ what \acom previously did (assuming that the mapleader has been left
+ at its default value of a backslash).
\a, : useful for breaking up comma-separated
declarations prior to \adec |alignmap-a,|
@@ -787,7 +852,7 @@ ALIGNMENT *align-align* {{{2
\adcom: useful for aligning comments in declarations |alignmap-adcom|
\anum : useful for aligning numbers |alignmap-anum|
NOTE: For the visual-mode use of \anum, <vis.vim> is needed!
- See http://mysite.verizon.net/astronaut/vim/index.html#VIS
+ See http://www.drchip.org/astronaut/vim/index.html#VIS
\aenum: align a European-style number |alignmap-anum|
\aunum: align a USA-style number |alignmap-anum|
\adec : useful for aligning declarations |alignmap-adec|
@@ -831,9 +896,9 @@ ALIGNMENT *align-align* {{{2
character "x" where "x" is: ,:<=@# |alignmap-T=|
\m= : like \t= but aligns with %... style comments
- The leading backslash is actually <leader> (see |mapleader| for how to
- customize the leader to be whatever you like). These maps use the
- <Align.vim> package and are defined in the <AlignMaps.vim> file.
+ The leading backslash is actually <leader> (see |mapleader| to learn
+ how to customize the leader to be whatever you like). These maps use
+ the <Align.vim> package and are defined in the <AlignMaps.vim> file.
Although the maps use AlignCtrl options, they typically use the "m"
option which pushes the options (AlignPush). The associated Align
call which follows will then AlignPop the user's original options
@@ -847,6 +912,18 @@ ALIGNMENT *align-align* {{{2
Alternatively, one may select the text with the "V" visual mode
command.
+ If you want to use visual-block mode (ctrl-v), I suggest using
+ an AlignMap with the vis.vim plugin, available at either
+
+ stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195
+ devel : http://www.drchip.org/astronaut/vim/index.html#VIS
+
+ Use it with commands such as >
+
+ ctrl-v (move)
+ :B norm \alignmap_sequence
+<
+
ALIGNMENT MAP USE WITH MENUS~
One may use the mark-and-move style (ma, move, use the menu) or
the visual mode style (use the V visual mode, move, then select
@@ -862,7 +939,6 @@ ALIGNMENT *align-align* {{{2
must be included).
COMPLEX ALIGNMENT MAP METHOD~
-
For those complex alignment maps which do alignment on constructs
(e.g. \acom, \adec, etc), a series of substitutes is used to insert
"@" symbols in appropriate locations. Align#Align() is then used to
@@ -934,7 +1010,7 @@ ALIGNMENT *align-align* {{{2
aa:=bb:=cc:=1;
a:=b:=c:=1;
aaa:=bbb:=ccc:=1;
-<
+<
Bcomes: select the three assignment lines, then \a:= >
aa := bb := cc := 1;
a := b := c := 1;
@@ -981,6 +1057,17 @@ ALIGNMENT *align-align* {{{2
Alignment Map Examples: \anum *alignmap-anum* {{{3
---------------------------
+ First, note that the behavior of the \anum map depends on the existence
+ of either the vim variable >
+ g:alignmaps_usanumber
+< or >
+ g:alignmaps_euronumber
+< when AlignMaps is loaded.
+
+ Essentially, "usa" numbers use "."s and "euro" numbers use ","s to
+ separate the integer from the fractional portion of a number.
+ "Usa" numbers are default.
+
Original: illustrates how to get numbers lined up >
-1.234 .5678 -.901e-4
1.234 5.678 9.01e-4
@@ -1012,7 +1099,8 @@ ALIGNMENT *align-align* {{{2
12,34 56,78 90,1e-4
123,4 567,8 901,e-4
<
- Becomes: Go to first line, ma. Go to last line, press \anum >
+ Becomes: (assuming g:alignmaps_euronumber exists)
+ Go to first line, ma. Go to last line, press \anum >
-1,234 ,5678 -,901e-4
1,234 5,678 9,01e-4
12,34 56,78 90,1e-4
@@ -1022,9 +1110,10 @@ ALIGNMENT *align-align* {{{2
\aenum is provided to support European-style numbers
\aunum is provided to support USA-style numbers
- One may get \aenum behavior for \anum >
+ *g:alignmaps_usanumber* *g:alignmaps_euronumber*
+ One may get \aenum behavior for \anum by putting >
let g:alignmaps_euronumber= 1
-< or \aunum behavior for \anum if one puts >
+< or \aunum behavior for \anum by putting >
let g:alignmaps_usanumber= 1
< in one's <.vimrc>.
@@ -1311,158 +1400,202 @@ ALIGNMENT *align-align* {{{2
4. Alignment Tools' History *align-history* {{{1
ALIGN HISTORY {{{2
- 35 : Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading
- installed
- Nov 19, 2008 * new sanity check for an AlignStyle of just ":"
- Jan 08, 2009 * save&restore of |'mod'| now done with local
- variant
- 34 : Jul 08, 2008 * using :AlignCtrl before entering any alignment
- control commands was causing an error.
- 33 : Sep 20, 2007 * s:Strlen() introduced to support various ways
- used to represent characters and their effects
- on string lengths. See |align-strlen|.
- * Align now accepts "..." -- so it can accept
- whitespace as separators.
- 32 : Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a
- custom argument splitter to allow patterns with
- backslashes to slide in unaltered.
- 31 : Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s)
- implemented.
- 30 : Feb 12, 2007 * now uses |setline()|
- 29 : Jan 18, 2006 * cecutil updated to use keepjumps
- Feb 23, 2006 * Align now converted to vim 7.0 style using
- auto-loading functions.
- 28 : Aug 17, 2005 * report option workaround
- Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed
- 27 : Apr 15, 2005 : cpo workaround
- ignorecase workaround
- 26 : Aug 20, 2004 : loaded_align now also indicates version number
- GetLatestVimScripts :AutoInstall: now supported
- 25 : Jul 27, 2004 : For debugging, uses Dfunc(), Dret(), and Decho()
- 24 : Mar 03, 2004 : (should've done this earlier!) visualmode(1)
- not supported until v6.2, now Align will avoid
- calling it for earlier versions. Visualmode
- clearing won't take place then, of course.
- 23 : Oct 07, 2003 : Included Leif Wickland's ReplaceQuotedSpaces()
- function which supports \tsq
- 22 : Jan 29, 2003 : Now requires 6.1.308 or later to clear visualmode()
- 21 : Jan 10, 2003 : BugFix: similar problem to #19; new code
- bypasses "norm! v\<Esc>" until initialization
- is over.
- 20 : Dec 30, 2002 : BugFix: more on "unable to highlight" fixed
- 19 : Nov 21, 2002 : BugFix: some terminals gave an "unable to highlight"
- message at startup; Hari Krishna Dara tracked it
- down; a silent! now included to prevent noise.
- 18 : Nov 04, 2002 : BugFix: re-enabled anti-repeated-loading
- 17 : Nov 04, 2002 : BugFix: forgot to have AlignPush() push s:AlignSep
- AlignCtrl now clears visual-block mode when used so
- that Align won't try to use old visual-block
- selection marks '< '>
- 16 : Sep 18, 2002 : AlignCtrl <>| options implemented (separator
- justification)
- 15 : Aug 22, 2002 : bug fix: AlignCtrl's ":" now acts as a modifier of
- the preceding alignment operator (lrc)
- 14 : Aug 20, 2002 : bug fix: AlignCtrl default now keeps &ic unchanged
- bug fix: Align, on end-field, wasn't using correct
- alignop bug fix: Align, on end-field, was appending
- padding
- 13 : Aug 19, 2002 : bug fix: zero-length g/v patterns are accepted
- bug fix: always skip blank lines
- bug fix: AlignCtrl default now also clears g and v
- patterns
- 12 : Aug 16, 2002 : moved keep_ic above zero-length pattern checks
- added "AlignCtrl default"
- fixed bug with last field getting separator spaces
- at end line
- 11 : Jul 08, 2002 : prevent separator patterns which match zero length
- -+: included as additional alignment/justification
- styles
- 10 : Jun 26, 2002 : =~# used instead of =~ (for matching case)
- ignorecase option handled
- 9 : Jun 25, 2002 : implemented cyclic padding
+ v37 Nov 29, 2012 * (Kim Jang-hwan) reported that with g:Align_xstrlen
+ set to 3 that the cursor was moved (linewise)
+ after invocation. Fixed.
+ Jan 07, 2013 * now has visual mode mappings to accompany all
+ normal mode mappings (use |V| to invoke)
+ v36 May 20, 2009 * Previously, the "W" AlignCtrl setting, intended
+ to retain initial white space, did so by convert-
+ ing any leading tabs into an equivalent quantity
+ of blanks (using the current tabstop setting).
+ Align will now retain leading tabs.
+ Nov 24, 2009 * QArgSplitter() used split(), intending to split
+ on white space only. However, the \tab map
+ uses ctrl-o as a separator instead of tabs; the
+ split() function treated the ctrl-o as a whitespace
+ character, too. Solution: give split() an explicit
+ pattern matching blanks and tabs, only. \tab now
+ works again!
+ Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support
+ May 10, 2011 * if the range is only one line, then Align will
+ automatically grow the range to accommodate all
+ lines containing the first separator pattern
+ surrounding the current line.
+ Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to
+ specify a function by name which computes string
+ length.
+ Oct 27, 2011 * (reported by Fco Javier) reported a problem with
+ the default s:Strlen() result; there was a missing
+ "let". Fixed.
+ Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when
+ it should've been doing "setlocal noet".
+ Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when
+ g:Align_xstrlen is zero.
+ v35 Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading
+ installed
+ Nov 19, 2008 * new sanity check for an AlignStyle of just ":"
+ Jan 08, 2009 * save&restore of |'mod'| now done with local
+ variant
+ v34 Jul 08, 2008 * using :AlignCtrl before entering any alignment
+ control commands was causing an error.
+ v33 Sep 20, 2007 * s:Strlen() introduced to support various ways
+ used to represent characters and their effects
+ on string lengths. See |align-strlen|.
+ * Align now accepts "..." -- so it can accept
+ whitespace as separators.
+ v32 Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a
+ custom argument splitter to allow patterns with
+ backslashes to slide in unaltered.
+ v31 Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s)
+ implemented.
+ v30 Feb 12, 2007 * now uses |setline()|
+ v29 Jan 18, 2006 * cecutil updated to use keepjumps
+ Feb 23, 2006 * Align now converted to vim 7.0 style using
+ auto-loading functions.
+ v28 Aug 17, 2005 * report option workaround
+ Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed
+ v27 Apr 15, 2005 * cpo workaround
+ ignorecase workaround
+ v26 Aug 20, 2004 * loaded_align now also indicates version number
+ GetLatestVimScripts :AutoInstall: now supported
+ v25 Jul 27, 2004 * For debugging, uses Dfunc(), Dret(), and Decho()
+ v24 Mar 03, 2004 * (should've done this earlier!) visualmode(1)
+ not supported until v6.2, now Align will avoid
+ calling it for earlier versions. Visualmode
+ clearing won't take place then, of course.
+ v23 Oct 07, 2003 * Included Leif Wickland's ReplaceQuotedSpaces()
+ function which supports \tsq
+ v22 Jan 29, 2003 * Now requires 6.1.308 or later to clear visualmode()
+ v21 Jan 10, 2003 * BugFix: similar problem to #19; new code
+ bypasses "norm! v\<Esc>" until initialization
+ is over.
+ v20 Dec 30, 2002 * BugFix: more on "unable to highlight" fixed
+ v19 Nov 21, 2002 * BugFix: some terminals gave an "unable to highlight"
+ message at startup; Hari Krishna Dara tracked it
+ down; a silent! now included to prevent noise.
+ v18 Nov 04, 2002 * BugFix: re-enabled anti-repeated-loading
+ v17 Nov 04, 2002 * BugFix: forgot to have AlignPush() push s:AlignSep
+ AlignCtrl now clears visual-block mode when used so
+ that Align won't try to use old visual-block
+ selection marks '< '>
+ v16 Sep 18, 2002 * AlignCtrl <>| options implemented (separator
+ justification)
+ v15 Aug 22, 2002 * bug fix: AlignCtrl's ":" now acts as a modifier of
+ the preceding alignment operator (lrc)
+ v14 Aug 20, 2002 * bug fix: AlignCtrl default now keeps &ic unchanged
+ bug fix: Align, on end-field, wasn't using correct
+ alignop bug fix: Align, on end-field, was appending
+ padding
+ v13 Aug 19, 2002 * bug fix: zero-length g/v patterns are accepted
+ bug fix: always skip blank lines
+ bug fix: AlignCtrl default now also clears g and v
+ patterns
+ v12 Aug 16, 2002 * moved keep_ic above zero-length pattern checks
+ added "AlignCtrl default"
+ fixed bug with last field getting separator spaces
+ at end line
+ v11 Jul 08, 2002 * prevent separator patterns which match zero length
+ -+: included as additional alignment/justification
+ styles
+ v10 Jun 26, 2002 * =~# used instead of =~ (for matching case)
+ ignorecase option handled
+ v09 Jun 25, 2002 * implemented cyclic padding
ALIGNMENT MAP HISTORY *alignmap-history* {{{2
- v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent
- re-loading installed
- * AlignMaps now use 0x0f (ctrl-p) for special
- character substitutions (instead of 0xff).
- Seems to avoid some problems with having to
- use Strlen().
- * bug fixed with \ts,
- * new maps: \ts; \ts, \ts: \ts< \ts= \a(
- v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s
- and <script>s. \t@ and related maps have been
- changed to call StdAlign() instead. The
- WrapperStart function now takes an argument and
- handles being called via visual mode. The
- former nmaps and vmaps have thus been replaced
- with a simple map.
- Oct 24, 2008 * broke AlignMaps into a plugin and autoload
- pair of scripts.
- v39 Mar 06, 2008 : * \t= only does /* ... */ aligning when in *.c
- *.cpp files.
- v38 Aug 18, 2007 : * \tt altered so that it works with the new
- use of |<q-args>| plus a custom argument
- splitter
- v36 Sep 27, 2006 : * AlignWrapperStart() now has tests that marks
- y and z are not set
- May 15, 2007 * \anum and variants improved
- v35 Sep 01, 2006 : * \t= and cousins used "`"s. They now use \xff
- characters.
- * \acom now works with doxygen style /// comments
- * <char-0xff> used in \t= \T= \w= and \m= instead
- of backquotes.
- v34 Feb 23, 2006 : * AlignMaps now converted to vim 7.0 style using
- auto-loading functions.
- v33 Oct 12, 2005 : * \ts, now uses P1 in its AlignCtrl call
- v32 Jun 28, 2005 : * s:WrapperStart() changed to AlignWrapperStart()
- s:WrapperEnd() changed to AlignWrapperEnd()
- These changes let the AlignWrapper...()s to be
- used outside of AlignMaps.vim
- v31 Feb 01, 2005 : * \adcom included, with help
- * \a, now works across multiple lines with
- different types
- * AlignMaps now uses <cecutil.vim> for its mark and
- window-position saving and restoration
- Mar 04, 2005 * improved \a,
- Apr 06, 2005 * included \aenum, \aunum, and provided
- g:alignmaps_{usa|euro]number} options
- v30 Aug 20, 2004 : * \a, : handles embedded assignments and does \adec
- * \acom now can handle Doxygen-style comments
- * g:loaded_alignmaps now also indicates version
- * internal maps \WE and \WS are now re-entrant
- v29 Jul 27, 2004 : * \tml aligns trailing multi-line single
- backslashes (thanks to Raul Benavente!)
- v28 May 13, 2004 : * \a, had problems with leading blanks; fixed!
- v27 Mar 31, 2004 : * \T= was having problems with == and !=
- * Fixed more problems with \adec
- v26 Dec 09, 2003 : * \ascom now also ignores lines without comments
- * \tt \& now not matched
- * \a< handles both << and >>
- v25 Nov 14, 2003 : * included \anum (aligns numbers with periods and
- commas). \anum also supported with ctrl-v mode.
- * \ts, \Ts, : (aligns on commas, then swaps leading
- spaces with commas)
- * \adec ignores preprocessor lines and lines with
- with comments-only
- v23 Sep 10, 2003 : * Bugfix for \afnc - no longer overwrites marks y,z
- * fixed bug in \tsp, \tab, \Tsp, and \Tab - lines
- containing backslashes were having their
- backslashes removed. Included Leif Wickland's
- patch for \tsq.
- * \adef now ignores lines holding comments only
- v18 Aug 22, 2003 : \a< lines up C++'s << operators
- saves/restores gdefault option (sets to nogd)
- all b:..varname.. are now b:alignmaps_..varname..
- v17 Nov 04, 2002 : \afnc now handles // comments correctly and
- commas within comments
- v16 Sep 10, 2002 : changed : to :silent! for \adec
- v15 Aug 27, 2002 : removed some <c-v>s
- v14 Aug 20, 2002 : \WS, \WE mostly moved to functions, marks y and z
- now restored
- v11 Jul 08, 2002 : \abox bug fix
- v9 Jun 25, 2002 : \abox now handles leading initial whitespace
- : various bugfixes to \afnc, \T=, etc
+ v43 Nov 28, 2012 * changed a lot of maps to use nnoremap (instead
+ of map)
+ Jan 07, 2013 *
+ v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum
+ Feb 16, 2010 * map for \t=, \T= now handles x++ = something;
+ for c, c++ correctly.
+ Oct 29, 2010 * added a note on having one's own default
+ AlignCtrl (see |alignctrl-init|)
+ Feb 22, 2011 * for menus, &go =~# used to insure correct case
+ Jun 10, 2011 * |:AlignMapsClean| command provided to make it
+ easy for those who would prefer not to have
+ AlignMaps' maps not to have them.
+ v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent
+ re-loading installed
+ * AlignMaps now use 0x0f (ctrl-p) for special
+ character substitutions (instead of 0xff).
+ Seems to avoid some problems with having to
+ use Strlen().
+ * bug fixed with \ts,
+ * new maps: \ts; \ts, \ts: \ts< \ts= \a(
+ v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s
+ and <script>s. \t@ and related maps have been
+ changed to call StdAlign() instead. The
+ WrapperStart function now takes an argument and
+ handles being called via visual mode. The
+ former nmaps and vmaps have thus been replaced
+ with a simple map.
+ Oct 24, 2008 * broke AlignMaps into a plugin and autoload
+ pair of scripts.
+ v39 Mar 06, 2008 * \t= only does /* ... */ aligning when in *.c
+ *.cpp files.
+ v38 Aug 18, 2007 * \tt altered so that it works with the new
+ use of |<q-args>| plus a custom argument
+ splitter
+ v36 Sep 27, 2006 * AlignWrapperStart() now has tests that marks
+ y and z are not set
+ May 15, 2007 * \anum and variants improved
+ v35 Sep 01, 2006 * \t= and cousins used "`"s. They now use \xff
+ characters.
+ * \acom now works with doxygen style /// comments
+ * <char-0xff> used in \t= \T= \w= and \m= instead
+ of backquotes.
+ v34 Feb 23, 2006 * AlignMaps now converted to vim 7.0 style using
+ auto-loading functions.
+ v33 Oct 12, 2005 * \ts, now uses P1 in its AlignCtrl call
+ v32 Jun 28, 2005 * s:WrapperStart() changed to AlignWrapperStart()
+ s:WrapperEnd() changed to AlignWrapperEnd()
+ These changes let the AlignWrapper...()s to be
+ used outside of AlignMaps.vim
+ v31 Feb 01, 2005 * \adcom included, with help
+ * \a, now works across multiple lines with
+ different types
+ * AlignMaps now uses <cecutil.vim> for its mark and
+ window-position saving and restoration
+ Mar 04, 2005 * improved \a,
+ Apr 06, 2005 * included \aenum, \aunum, and provided
+ g:alignmaps_{usa|euro]number} options
+ v30 Aug 20, 2004 * * \a, : handles embedded assignments and does \adec
+ * \acom now can handle Doxygen-style comments
+ * g:loaded_alignmaps now also indicates version
+ * internal maps \WE and \WS are now re-entrant
+ v29 Jul 27, 2004 * \tml aligns trailing multi-line single
+ backslashes (thanks to Raul Benavente!)
+ v28 May 13, 2004 * \a, had problems with leading blanks; fixed!
+ v27 Mar 31, 2004 * \T= was having problems with == and !=
+ * Fixed more problems with \adec
+ v26 Dec 09, 2003 * \ascom now also ignores lines without comments
+ * \tt \& now not matched
+ * \a< handles both << and >>
+ v25 Nov 14, 2003 * included \anum (aligns numbers with periods and
+ commas). \anum also supported with ctrl-v mode.
+ * \ts, \Ts, : (aligns on commas, then swaps leading
+ spaces with commas)
+ * \adec ignores preprocessor lines and lines with
+ with comments-only
+ v23 Sep 10, 2003 * Bugfix for \afnc - no longer overwrites marks y,z
+ * fixed bug in \tsp, \tab, \Tsp, and \Tab - lines
+ containing backslashes were having their
+ backslashes removed. Included Leif Wickland's
+ patch for \tsq.
+ * \adef now ignores lines holding comments only
+ v18 Aug 22, 2003 * \a< lines up C++'s << operators
+ saves/restores gdefault option (sets to nogd)
+ all b:..varname.. are now b:alignmaps_..varname..
+ v17 Nov 04, 2002 * \afnc now handles // comments correctly and
+ commas within comments
+ v16 Sep 10, 2002 * changed : to :silent! for \adec
+ v15 Aug 27, 2002 * removed some <c-v>s
+ v14 Aug 20, 2002 * \WS, \WE mostly moved to functions, marks y and z
+ now restored
+ v11 Jul 08, 2002 * \abox bug fix
+ v9 Jun 25, 2002 * \abox now handles leading initial whitespace
+ various bugfixes to \afnc, \T=, etc
==============================================================================
Modelines: {{{1
diff --git a/html/index.html b/html/index.html
index f240eb1..09fd88f 100644
--- a/html/index.html
+++ b/html/index.html
@@ -49,7 +49,7 @@
<li><a href="syntax_CVSAnnotate.vim.html">syntax/CVSAnnotate.vim.html</a></li>
</ul>
<p>
- Page generated on Wed, 14 Aug 2013 22:59:58 -0400
+ Page generated on Wed, 14 Aug 2013 23:16:45 -0400
.
</p>
</body>
diff --git a/html/plugin_AlignPlugin.vim.html b/html/plugin_AlignPlugin.vim.html
index 4e18622..3de170d 100644
--- a/html/plugin_AlignPlugin.vim.html
+++ b/html/plugin_AlignPlugin.vim.html
@@ -102,7 +102,7 @@
<td class="sidebarheader"><a href="/docs.php">Documentation</a></td>
</tr>
<tr>
- <td class="sidebarheader"><a href="/download.php">Download</a></td>
+ <td class="sidebarheader download"><a href="/download.php">Download</a></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" alt="" border="0" width="1" height="7"></td>
@@ -135,6 +135,8 @@
<td class="sidebarheader"><a href="/huh.php">Site Help</a></td>
</tr>
</table>
+<br>
+<g:plusone></g:plusone>
<table width="172" cellpadding="0" cellspacing="0" border="0">
<tr><td><img src="/images/spacer.gif" alt="" border="0" width="1" height="8"></td></tr>
@@ -166,8 +168,16 @@
<tr>
<td class="lightbg"><b> script karma </b></td>
<td>
- Rating <b>1211/371</b>,
- Downloaded by 15569 </td>
+ Rating <b>1621/766</b>,
+ Downloaded by 31538
+ <g:plusone></g:plusone>
+ </td>
+ <td class="lightbg">
+ <b> Comments, bugs, improvements </b>
+ </td>
+ <td>
+ <a href="http://vim.wikia.com/wiki/Script:294">Vim wiki</a>
+ </td>
</tr>
</table>
<p>
@@ -180,7 +190,7 @@
<tr><td>utility</td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">description</td></tr>
-<tr><td> [ALIGN/ALIGNMAPS NEEDS VIM 7.0 AS OF V29/34]
<br>
<br>Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc.
<br>
<br>Note: this plugin is not a left&right margin justification tool! See <a href="/scripts/script.php?script_id=177">vimscript#177</a> or <a href="/scripts/script.php?script_id=2324">vimscript#2324</a> for that.
<br>Note: if you have vim 7.1 or later, your vimball should unpack just fine without having to update it.
<br>
<br>There are two basic commands provided by this package:
<br>
<br> AlignCtrl options sep1 sep2 sep3 ...
<br> [range]Align sep1 sep2 sep3 ...
<br>
<br>The "sep#" are regular expressions which describe separators that delineate fields; Align will line up the separators. The range may be any Vim range, _including_ visual-blocks. Align works on lines of the form:
<br>(ws==whitespace, sep==separator, field==text)
<br>
<br> ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br> ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br>
<br>Note that white-space (ws) surrounding separators is ignored.
<br>
<br>The Align package includes:
<br>
<br> Align : the basic alignment command
<br> AlignCtrl : provides options for the next call to :Align
<br> AlignMaps : many three or four key maps which support aligning C/C++ style declarations, ()?..:.., expressions, C/C++ comments, numbers, C preprocessor definitions, tables based on tabs or spaces, and more.
<br>
<br>In addition, AutoAlign (<a href="/scripts/script.php?script_id=884">vimscript#884</a>) uses the Align function to align =s as you type.
<br>
<br>Align handles alignment on multiple separators, not just the first one, and the separators may be the same across the line or different. With AlignCtrl one may specify that separators are cyclic (re-used sequentially) or equivalent (all separators are simultaneously active).
<br>
<br>There are several options to help with deciding what to do with initial white space. By default Align re-uses the first line's initial white space, but one may use AlignCtrl to retain or remove each line's initial white space.
<br>
<br>The <Align.vim> and <AlignMaps.vim> files are plugins and require vim 6.1 or higher.
<br>
<br>
<br>EXAMPLES:
<br>
<br>:5,10Align =
<br> Align on '=' signs
<br>
<br>:'<,'>Align = + - \* /
<br> Align on any of the five separator characters shown.
<br> Note that visual block mode was used to fire off Align.
<br>
<br>:AlignCtrl =lp1P1I
<br> which means:
<br> = all separators are equivalent
<br> l fields will be left-justified
<br> p1 pad one space before each separator
<br> P1 pad one space after each separator
<br> I preserve and apply the first line's leading white space to all
<br> Align'd lines
<br>
<br>:help align
<br> Gives help for Align
<br>
<br>
<br>ALIGNMENT CONTROL
<br>
<br>Alignment control allows for left or right justification or centering of fields, cyclic (sequentially active) or equivalent (simultaneously active) regular expressions to specify field separators, initial white space control, optional visual-block use (ie. apply Alignment only within a block), user-specified white-space padding about separators, and multiple separators.
<br>
<br>MANY ALIGNMENT MAPS
<br>
<br>AlignMaps.vim provides a number of maps which make using this package easy. They typically either apply to the range 'a,. (from mark a to current line) or use the visual-selection (V, v, or ctrl-v selected):
<br>
<br> \t= : align assignments (don't count logic, like == or !=)
<br> \t, : align on commas
<br> \t| : align on vertical bars (|)
<br> \tsp : align on whitespace
<br> \tt : align LaTeX tabular tables
<br>
<br>AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments:
<br>
<br> \acom : align comments
<br> \adec : align C declarations (one variable per line)
<br> \afnc : align ansi-style C function input arguments
<br> \Htd : align html tables
<br>
<br>To see some examples of this, check out
<br>
<br> <a target="_blank" href="http://mysite.verizon.net/astronaut/vim/align.html#Examples">http://mysite.verizon.net/astronaut/vim/align.html#Examples</A>
<br>
<br>(the proportional fonts used by most browsers in showing you this page preclude showing the examples here). The help for Align and AlignCtrl also contains many examples.
<br>
<br>ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL
<br>
<br>Sometimes one wants to align only a subset of text in a range, based on patterns or column extents. Align supports both types of restrictions!
<br>
<br> Visual-block selection may be used to restrict Align to operate only
<br> within that visual block.
<br>
<br> AlignCtrl supports "g" and "v" patterns that restrict Align to
<br>
<br> operate on lines which match (or don't match, respectively) those
<br> patterns.
<br>
<br>NEW STUFF:
<br>
<br>There's a number of new AlignCtrl options:
<br>
<br> - allows one to skip a separator (treat it as part of a field)
<br> + repeat the last lrc justification (ex. lr+ == lrrrrrr... )
<br> : treat the rest of the line as a field; acts as a modifier
<br> to the last lrc.
<br> < left-justify the separator
<br> > right-justify the separator
<br> | center the separator
<br>
<br>These are, except for the ":", cyclic parameters. In other words, >< is equivalent to ><><><><... . Thus separators can be of differing lengths (ex. -\+ as a separator pattern can match -, --, ---, etc and the separators will be left/right/center justified as you wish).
<br>
<br>To get automatic, as-you-type, aligning of = in the C, vimL, and other languages, check out <a href="/scripts/script.php?script_id=884">vimscript#884</a> for several ftplugins (which use Align).
<br>
<br>
<br>Alternative Aligners:
<br> Gergely Kontra's <a href="/scripts/script.php?script_id=176">vimscript#176</a>
<br>
<br>Thank you for rating Align!
<br>
<br>---------------------------------------
<br>DISCUSSION and COMMENTS:
<br>---------------------------------------
<br>
<br>Please use email for bugs. Enjoy!
<br>
<br></td></tr>
+<tr><td> [ALIGN/ALIGNMAPS NEEDS VIM 7.0 AS OF V29/34]
<br>
<br>Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc.
<br>
<br>Note: this plugin is not a left&right margin justification tool! See <a href="/scripts/script.php?script_id=177">vimscript#177</a>, <a href="/scripts/script.php?script_id=2324">vimscript#2324</a>, or <a href="/scripts/script.php?script_id=3728">vimscript#3728</a> for that.
<br>Note: if you have vim 7.1 or later, your vimball should unpack just fine without having to update it.
<br>
<br>There are two basic commands provided by this package:
<br>
<br> AlignCtrl options sep1 sep2 sep3 ...
<br> [range]Align sep1 sep2 sep3 ...
<br>
<br>The "sep#" are regular expressions which describe separators that delineate fields; Align will line up the separators. The range may be any Vim range, _including_ visual-blocks. Align works on lines of the form:
<br>(ws==whitespace, sep==separator, field==text)
<br>
<br> ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br> ws-field-ws-sep-ws-field-ws-sep-ws-field-...
<br>
<br>Note that white-space (ws) surrounding separators is ignored.
<br>
<br>The Align package includes:
<br>
<br> Align : the basic alignment command
<br> AlignCtrl : provides options for the next call to :Align
<br> AlignMaps : many three or four key maps which support aligning C/C++ style declarations, ()?..:.., expressions, C/C++ comments, numbers, C preprocessor definitions, tables based on tabs or spaces, and more.
<br>
<br>In addition, AutoAlign (<a href="/scripts/script.php?script_id=884">vimscript#884</a>) uses the Align function to align =s as you type.
<br>
<br>Align handles alignment on multiple separators, not just the first one, and the separators may be the same across the line or different. With AlignCtrl one may specify that separators are cyclic (re-used sequentially) or equivalent (all separators are simultaneously active).
<br>
<br>There are several options to help with deciding what to do with initial white space. By default Align re-uses the first line's initial white space, but one may use AlignCtrl to retain or remove each line's initial white space.
<br>
<br>The <Align.vim> and <AlignMaps.vim> files are plugins and require vim 6.1 or higher.
<br>
<br>
<br>EXAMPLES:
<br>
<br>:5,10Align =
<br> Align on '=' signs
<br>
<br>:'<,'>Align = + - \* /
<br> Align on any of the five separator characters shown.
<br> Note that visual block mode was used to fire off Align.
<br>
<br>:AlignCtrl =lp1P1I
<br> which means:
<br> = all separators are equivalent
<br> l fields will be left-justified
<br> p1 pad one space before each separator
<br> P1 pad one space after each separator
<br> I preserve and apply the first line's leading white space to all
<br> Align'd lines
<br>
<br>:help align
<br> Gives help for Align
<br>
<br>
<br>ALIGNMENT CONTROL
<br>
<br>Alignment control allows for left or right justification or centering of fields, cyclic (sequentially active) or equivalent (simultaneously active) regular expressions to specify field separators, initial white space control, optional visual-block use (ie. apply Alignment only within a block), user-specified white-space padding about separators, and multiple separators.
<br>
<br>MANY ALIGNMENT MAPS
<br>
<br>AlignMaps.vim provides a number of maps which make using this package easy. They typically either apply to the range 'a,. (from mark a to current line) or use the visual-selection (V, v, or ctrl-v selected):
<br>
<br> \t= : align assignments (don't count logic, like == or !=)
<br> \t, : align on commas
<br> \t| : align on vertical bars (|)
<br> \tsp : align on whitespace
<br> \tt : align LaTeX tabular tables
<br>
<br>AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments:
<br>
<br> \acom : align comments
<br> \adec : align C declarations (one variable per line)
<br> \afnc : align ansi-style C function input arguments
<br> \Htd : align html tables
<br>
<br>To see some examples of this, check out
<br>
<br> <a target="_blank" href="http://www.drchip.org/astronaut/vim/align.html#Examples">http://www.drchip.org/astronaut/vim/align.html#Examples</A>
<br>
<br>(the proportional fonts used by most browsers in showing you this page preclude showing the examples here). The help for Align and AlignCtrl also contains many examples.
<br>(for those of you who prefer not to have the maps that AlignMaps.vim provides, simply remove the AlignMapsPlugin.vim from .vim/plugin and AlignMaps.vim from .vim/autoload - that's why AlignMaps is separate from Align)
<br>
<br>ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL
<br>
<br>Sometimes one wants to align only a subset of text in a range, based on patterns or column extents. Align supports both types of restrictions!
<br>
<br> Visual-block selection may be used to restrict Align to operate only
<br> within that visual block.
<br>
<br> AlignCtrl supports "g" and "v" patterns that restrict Align to
<br>
<br> operate on lines which match (or don't match, respectively) those
<br> patterns.
<br>
<br>NEW STUFF:
<br>
<br>There's a number of new AlignCtrl options:
<br>
<br> - allows one to skip a separator (treat it as part of a field)
<br> + repeat the last lrc justification (ex. lr+ == lrrrrrr... )
<br> : treat the rest of the line as a field; acts as a modifier
<br> to the last lrc.
<br> < left-justify the separator
<br> > right-justify the separator
<br> | center the separator
<br>
<br>These are, except for the ":", cyclic parameters. In other words, >< is equivalent to ><><><><... . Thus separators can be of differing lengths (ex. -\+ as a separator pattern can match -, --, ---, etc and the separators will be left/right/center justified as you wish).
<br>
<br>To get automatic, as-you-type, aligning of = in the C, vimL, and other languages, check out <a href="/scripts/script.php?script_id=884">vimscript#884</a> for several ftplugins (which use Align).
<br>
<br>
<br>Alternative Aligners:
<br> Gergely Kontra's <a href="/scripts/script.php?script_id=176">vimscript#176</a>
<br>
<br>Thank you for rating Align!
<br>
<br>---------------------------------------
<br>DISCUSSION and COMMENTS:
<br>---------------------------------------
<br>
<br>Please use email for bugs. Enjoy!
<br>
<br>(alpha/beta version available at <a target="_blank" href="http://mysite.verizon.net/astronaut/vim/index.html#ALIGN">http://mysite.verizon.net/astronaut/vim/index.html#ALIGN</A>)
<br></td></tr>
<tr><td> </td></tr>
<tr><td class="prompt">install details</td></tr>
<tr><td>1. You'll need to have plugins enabled: in your home directory, have at least the following two lines in your .vimrc file:
<br> set nocp
<br> filetype plugin on
<br>
<br>2. Using vim 7.1 or later:
<br> vim Align.vba.gz
<br> :so %
<br> :q
<br>
<br>3. Using vim 7.0: see <a target="_blank" href="http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL">http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL</A> to get and install an up-to-date version of vimball. Then follow the simple directions for installation of Align/AlignMaps above! Or, preferably: upgrade your copy of vim.
<br>
<br>(this version of Align/AlignMaps requires vim 7.0)
<br></td></tr>
@@ -188,7 +198,7 @@
</table>
<!-- rating table -->
-<form name="rating">
+<form name="rating" method="post">
<input type="hidden" name="script_id" value="294">
<table cellpadding="4" cellspacing="0" border="1" bordercolor="#000066">
<tr>
@@ -217,6 +227,22 @@ Click on the package to download.
<th valign="top">release notes</th>
</tr>
<tr>
+ <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=19633">Align.vba.gz</a></td>
+ <td class="rowodd" valign="top" nowrap><b>37/43</b></td>
+ <td class="rowodd" valign="top" nowrap><i>2013-03-12</i></td>
+ <td class="rowodd" valign="top" nowrap>7.0</td>
+ <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=96">Charles Campbell</a></i></td>
+ <td class="rowodd" valign="top" width="2000">(Align) has visual maps to accompany all normal mode mappings (use V to invoke them)
<br>(Align) a bugfix (cursor moved when g:Align_xstrlen=3)
<br>(AlignMaps) use nnoremaps instead of nmaps</td>
+</tr>
+<tr>
+ <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=18148">Align.vba.gz</a></td>
+ <td class="roweven" valign="top" nowrap><b>36/42</b></td>
+ <td class="roweven" valign="top" nowrap><i>2012-06-18</i></td>
+ <td class="roweven" valign="top" nowrap>7.3</td>
+ <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=96">Charles Campbell</a></i></td>
+ <td class="roweven" valign="top" width="2000">new : users may specify a function to decide whether or not a character should be skipped with the AlignCtrl \"*\" character
<br>new : Align will automatically grow the range if the given range is only one line to accommodate all lines which match the first separator pattern
<br>improved: AlignMaps' \\anum, \\aenum, \\aunum and \\t=, \\T=
<br>bugfixes: various; see :help align-history
<br></td>
+</tr>
+<tr>
<td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=10110">Align.vba.gz</a></td>
<td class="rowodd" valign="top" nowrap><b>35/41</b></td>
<td class="rowodd" valign="top" nowrap><i>2009-03-04</i></td>
@@ -353,6 +379,15 @@ Click on the package to download.
</tr>
</table>
+<!-- for Google +1 button -->
+<script type="text/javascript">
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+</script>
+
</body>
</html>
diff --git a/plugin/AlignMapsPlugin.vim b/plugin/AlignMapsPlugin.vim
index eed0293..7296f7f 100644
--- a/plugin/AlignMapsPlugin.vim
+++ b/plugin/AlignMapsPlugin.vim
@@ -1,11 +1,9 @@
" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
-" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS at PcampbellAfamily.Mbiz>
-" Date: Mar 03, 2009
+" Maintainer: Dr. Charles E. Campbell. <NdrOchipS at PcampbellAfamily.Mbiz>
+" Date: Jan 07, 2013
"
-" NOTE: the code herein needs vim 6.0 or later
-" needs <Align.vim> v6 or later
-" needs <cecutil.vim> v5 or later
-" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
+" NOTE: the code herein needs vim 7.0 or later
+" 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,
@@ -14,7 +12,12 @@
" plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
" of this software.
-"
+" Romans 1:20 For the invisible things of Him since the creation of the {{{1
+" world are clearly seen, being perceived through the things that are
+" made, even His everlasting power and divinity; that they may be
+" without excuse.
+
+" ---------------------------------------------------------------------
" Usage: {{{1
" Use 'a to mark beginning of to-be-aligned region, Alternative: use V
" move cursor to end of region, and execute map. (linewise visual mode) to
@@ -29,21 +32,19 @@
"
" Note: these maps all use <Align.vim>.
"
-" Romans 1:20 For the invisible things of Him since the creation of the {{{1
-" world are clearly seen, being perceived through the things that are
-" made, even His everlasting power and divinity; that they may be
-" without excuse.
-
-" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_AlignMapsPlugin")
finish
endif
let s:keepcpo = &cpo
-let g:loaded_AlignMapsPlugin = "v41"
+let g:loaded_AlignMapsPlugin = "v43"
set cpo&vim
" =====================================================================
+" Public Interface: {{{1
+com! AlignMapsClean :call AlignMaps#AlignMapsClean()
+
+" =====================================================================
" Maps: {{{1
" ---------------------------------------------------------------------
@@ -52,8 +53,8 @@ set cpo&vim
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
@@ -61,48 +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_aunum')|map <unique> <Leader>aunum <Plug>AM_aenum|endif
-if !hasmapto('<Plug>AM_aenum')|map <unique> <Leader>aenum <Plug>AM_aunum|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')|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
-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*\%(\K\k*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[* [...]
-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/\%([0-9.]\)\s\+\zs\([-+.]\=\d\)/@\1/ge<CR>:'a,'zs/\(\(^\|\s\)\d\+\)\(\s\+\)@/\1@\3@/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [.@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(\.\)\(\s\+\)\([0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\%([0-9.]\)\s\+\([-+]\=\d\)/\1@\2/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [,@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(,\)\(\s\+\)\([-0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
-
+" ---------------------------------------------------------------------
+" Plug maps: (the real thing) {{{2
+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> [...]
+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
@@ -110,88 +115,94 @@ 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_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_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_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 #<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)#/,\1/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\),/,\1/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\):/:\1/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\);/;\1/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)</<\1/ge<CR><SID>WE
-map <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)=/=\1/ge<CR><SID>WE
-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) [...]
-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_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 \<Char-0x0f>"<bar>endif<CR>:'a,.Align<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:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
-map <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:'y+1,'z-1s/[%@]/ /g<CR><SID>WE
-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#StdAli [...]
+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< [...]
+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
" ma ..move.. use menu
" v V or ctrl-v ..move.. use menu
-if has("menu") && has("gui_running") && &go =~ 'm' && !exists("s:firstmenu")
+if has("menu") && has("gui_running") && &go =~# 'm' && !exists("s:firstmenu")
let s:firstmenu= 1
if !exists("g:DrChipTopLvlMenu")
let g:DrChipTopLvlMenu= "DrChip."
diff --git a/plugin/AlignPlugin.vim b/plugin/AlignPlugin.vim
index 727fe7e..50c53d6 100644
--- a/plugin/AlignPlugin.vim
+++ b/plugin/AlignPlugin.vim
@@ -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-2007 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 = "v35"
+let g:loaded_AlignPlugin = "v37"
let s:keepcpo = &cpo
set cpo&vim
diff --git a/plugin/cecutil.vim b/plugin/cecutil.vim
index 0bf3434..f837120 100644
--- a/plugin/cecutil.vim
+++ b/plugin/cecutil.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: 18b ASTRO-ONLY
-" Date: Aug 27, 2008
+" 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,16 +27,17 @@
" 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 = "v18b"
+let g:loaded_cecutil = "v18h"
let s:keepcpo = &cpo
set cpo&vim
-"DechoTabOn
+"DechoRemOn
" =======================
" Public Interface: {{{1
@@ -56,15 +57,17 @@ 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
" ===============
@@ -77,9 +80,9 @@ endif
" 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 = &l:so
@@ -87,14 +90,20 @@ fun! SaveWinPosn(...)
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>"
@@ -106,11 +115,11 @@ 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
@@ -118,12 +127,12 @@ fun! SaveWinPosn(...)
let &siso = siso_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
@@ -132,11 +141,11 @@ endfun
" 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 = &l:so
@@ -147,15 +156,15 @@ fun! RestoreWinPosn(...)
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
@@ -167,29 +176,29 @@ 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
@@ -197,17 +206,34 @@ fun! RestoreWinPosn(...)
" 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
- silent norm! hl
+ exe s:modifier."norm! hl"
elseif virtcol(".") < virtcol("$")
- silent norm! lh
+ exe s:modifier."norm! lh"
endif
+ let &ve= vekeep
let &l:so = so_keep
let &l:siso = siso_keep
let &l:ss = ss_keep
-" call Dret("RestoreWinPosn")
+" echomsg "Decho: RestoreWinPosn"
+endfun
+
+" ---------------------------------------------------------------------
+" 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
" ---------------------------------------------------------------------
@@ -416,11 +442,11 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let dobuffer = ""
while mapmode =~ '^[bu]'
if mapmode =~ '^u'
- let dounmap= 1
- let mapmode= strpart(a:mapmode,1)
+ let dounmap = 1
+ let mapmode = strpart(a:mapmode,1)
elseif mapmode =~ '^b'
- let dobuffer= "<buffer> "
- let mapmode= strpart(a:mapmode,1)
+ let dobuffer = "<buffer> "
+ let mapmode = strpart(a:mapmode,1)
endif
endwhile
" call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
@@ -433,13 +459,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap
endif
let amap = a:maplead.amap
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".dobuffer.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 ".dobuffer.amap." ".maprhs
endif
if dounmap
- exe "silent! ".mapmode."unmap ".dobuffer.amap
+ exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save single map <something>
@@ -450,13 +476,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap
" call Decho("amap[[".amap."]]")
endif
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.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." ".dobuffer.maprhs
+ let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
- exe "silent! ".mapmode."unmap ".dobuffer.amap
+ exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save multiple maps
@@ -468,13 +494,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
- let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.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." ".dobuffer.maprhs
+ let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
- exe "silent! ".mapmode."unmap ".dobuffer.amap
+ exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
let i= i + 1
endwhile
@@ -491,7 +517,7 @@ 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
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim-scripts.git
More information about the pkg-vim-maintainers
mailing list