Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update Align.vim to v37

  • Loading branch information...
commit bf2efeba30be6ad6f762d4cd69b994e532a3b9ba 1 parent 97c34c6
依云 authored
2  .VimballRecord
View
@@ -10,5 +10,5 @@ CountJump.vba: call delete('/home/lilydjwg/.vim/autoload/CountJump.vim')|call de
tagbar.vmb: call delete('/home/lilydjwg/.vim/autoload/tagbar.vim')|call delete('/home/lilydjwg/.vim/doc/tagbar.txt')|call delete('/home/lilydjwg/.vim/plugin/tagbar.vim')|call delete('/home/lilydjwg/.vim/syntax/tagbar.vim')
manpageview.vba: call delete('/home/lilydjwg/.vim/plugin/manpageviewPlugin.vim')|call delete('/home/lilydjwg/.vim/autoload/manpageview.vim')|call delete('/home/lilydjwg/.vim/syntax/man.vim')|call delete('/home/lilydjwg/.vim/syntax/mangl.vim')|call delete('/home/lilydjwg/.vim/syntax/mankey.vim')|call delete('/home/lilydjwg/.vim/syntax/info.vim')|call delete('/home/lilydjwg/.vim/syntax/manphp.vim')|call delete('/home/lilydjwg/.vim/doc/manpageview.txt')|call delete('/home/lilydjwg/.vim/plugin/cecutil.vim')
mark.vba: call delete('/home/lilydjwg/.vim/autoload/mark.vim')|call delete('/home/lilydjwg/.vim/plugin/mark.vim')|call delete('/home/lilydjwg/.vim/doc/mark.txt')
-Align.vba: call delete('/home/lilydjwg/.vim/plugin/AlignPlugin.vim')|call delete('/home/lilydjwg/.vim/plugin/AlignMapsPlugin.vim')|call delete('/home/lilydjwg/.vim/plugin/cecutil.vim')|call delete('/home/lilydjwg/.vim/doc/Align.txt')|call delete('/home/lilydjwg/.vim/autoload/Align.vim')|call delete('/home/lilydjwg/.vim/autoload/AlignMaps.vim')
NrrwRgn-0.29.vmb: call delete('/home/lilydjwg/.vim/plugin/NrrwRgn.vim')|call delete('/home/lilydjwg/.vim/autoload/nrrwrgn.vim')|call delete('/home/lilydjwg/.vim/doc/NarrowRegion.txt')
+Align.vba: call delete('/home/lilydjwg/.vim/plugin/AlignPlugin.vim')|call delete('/home/lilydjwg/.vim/plugin/AlignMapsPlugin.vim')|call delete('/home/lilydjwg/.vim/plugin/cecutil.vim')|call delete('/home/lilydjwg/.vim/doc/Align.txt')|call delete('/home/lilydjwg/.vim/autoload/Align.vim')|call delete('/home/lilydjwg/.vim/autoload/AlignMaps.vim')
70 autoload/Align.vim
View
@@ -1,10 +1,10 @@
" Align: tool to align multiple fields based on one or more separators
-" Author: Charles E. Campbell, Jr.
-" Date: Jun 18, 2012
-" Version: 36
+" 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-2012 Charles E. Campbell, Jr. {{{1
+" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -25,7 +25,7 @@
if exists("g:loaded_Align") || &cp
finish
endif
-let g:loaded_Align = "v36"
+let g:loaded_Align = "v37"
if v:version < 700
echohl WarningMsg
echo "***warning*** this version of Align needs vim 7.0"
@@ -43,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
@@ -529,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
@@ -551,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
@@ -559,12 +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)
- let txtlen= s:Strlen(txt)
+ let txtlen= s:Strlen(txt)
if begcol > 0
" Record text to left of selected area
let bgntxt= strpart(txt,0,begcol)
@@ -655,7 +659,7 @@ fun! Align#Align(hasctrl,...) range
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(line,endfield) && endfield != -1
+ while g:AlignSkip(curline,endfield) && endfield != -1
let endfield = match(txt,seppat,skipfield)
let sepfield = matchend(txt,seppat,skipfield)
let skipfield = sepfield
@@ -688,22 +692,20 @@ fun! Align#Align(hasctrl,...) range
let field = bgntxt.field
let bgntxt= ""
endif
- let fieldlen = s:Strlen(field)
- 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
@@ -714,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= ""
@@ -724,21 +728,26 @@ fun! Align#Align(hasctrl,...) range
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
+" 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
@@ -786,18 +795,20 @@ 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.">")
- keepj 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")
+" call Decho("ENDWHILE: cursor at (".line(".").",".col(".").") curline#".curline)
" restore original leading whitespace
if s:AlignLeadKeep == 'W'
@@ -1059,8 +1070,7 @@ fun! s:Strlen(x)
call setline(line("."),a:x)
let ret= virtcol("$") - 1
d
- " lilydjwg: 这样才不会让光标乱跑
- normal k
+ keepj norm! k
let &l:mod= modkeep
else
86 autoload/AlignMaps.vim
View
@@ -1,8 +1,8 @@
" AlignMaps.vim : support functions for AlignMaps
-" Author: Charles E. Campbell, Jr.
-" Date: Jun 18, 2012
-" Version: 42
-" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
+" 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,
@@ -16,7 +16,7 @@
if &cp || exists("g:loaded_AlignMaps")
finish
endif
-let g:loaded_AlignMaps= "v42"
+let g:loaded_AlignMaps= "v43"
let s:keepcpo = &cpo
set cpo&vim
"DechoTabOn
@@ -112,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.")")
@@ -169,15 +183,15 @@ endfun
" AlignMaps#Equals: supports \t= and \T= {{{2
fun! AlignMaps#Equals() range
" call Dfunc("AlignMaps#Equals()")
- keepj 'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e
- keepj 'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge
+ 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 =
keepj 'a,'z-1Align
- keepj 'a,'z-1s@\([*/%|&\~^!=]\)\( \+\)=@\2\1=@ge
+ 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"
@@ -323,37 +337,6 @@ fun! AlignMaps#FixMultiDec()
let curline = getline(".")
" call Decho("curline<".curline.">")
-" " Attempt to ignore function calls (ie. double x=pow(2.,3.),...
-" let leader= substitute(curline,'^\s*\([a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+.*$','\1','')
-" let i = strlen(leader)
-" let paren = 0
-" let fmd = strpart(curline,i)
-" let ifmd = i
-" call Decho("fmd<".fmd."> ifmd=".ifmd)
-" while i < strlen(curline)
-" if strpart(curline,i,1) == '('
-" let paren= paren+1
-" elseif strpart(curline,i,1) == ')' && paren > 0
-" let paren= paren-1
-" elseif strpart(curline,i,1) == '='
-" let eq= 1
-" elseif strpart(curline,i,1) == ';'
-" let paren = 0
-" let eq = 0
-" let fmd = fmd.strpart(fmd,ifmd,i-ifmd).";\<cr>"
-" let ifmd = i + 2
-" let i = i + 1
-" let leader= substitute(curline,'^\s*\([a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+.*$','\1','')
-" elseif strpart(curline,i,1) == ','
-" if paren == 0
-" let fmd = fmd.strpart(fmd,ifmd,i-ifmd).";\<cr>"
-" let ifmd = i + 2
-" let i = i + 1
-" endif
-" endif
-" let i= i + 1
-" endwhile
- " 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','')
" call Decho("@x<".@x.">")
@@ -387,6 +370,31 @@ fun! 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
396 doc/Align.txt
View
@@ -1,4 +1,4 @@
-*align.txt* The Alignment Tool Jun 18, 2012
+*align.txt* The Alignment Tool Jan 07, 2013
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
@@ -78,9 +78,9 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *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 ||
@@ -144,7 +144,7 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *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:
@@ -315,7 +315,7 @@ ALIGNMENT OPTIONS *align-option* *align-options* *align-xstrlen* {{{2
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).
@@ -756,7 +756,7 @@ ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{
and :AlignCtrl will then be defined.
-ALIGNMENT *align-align* {{{2
+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.
@@ -852,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|
@@ -916,7 +916,7 @@ ALIGNMENT *align-align* {{{2
an AlignMap with the vis.vim plugin, available at either
stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195
- devel : http://mysite.verizon.net/astronaut/vim/index.html#VIS
+ devel : http://www.drchip.org/astronaut/vim/index.html#VIS
Use it with commands such as >
@@ -1400,194 +1400,202 @@ ALIGNMENT *align-align* {{{2
4. Alignment Tools' History *align-history* {{{1
ALIGN HISTORY {{{2
- 36 : 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.
- 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
- 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
+ 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
2  doc/tags
View
@@ -59,6 +59,8 @@
:AgFile ag.txt /*:AgFile*
:AgFromSearch ag.txt /*:AgFromSearch*
:AgHelp ag.txt /*:AgHelp*
+:Align Align.txt /*:Align*
+:AlignCtrl Align.txt /*:AlignCtrl*
:AlignMapsClean Align.txt /*:AlignMapsClean*
:ColorSchemeEditor ColorSchemeEditor.txt /*:ColorSchemeEditor*
:Explore pi_netrw.txt /*:Explore*
6 plugin/AlignPlugin.vim
View
@@ -1,9 +1,9 @@
" AlignPlugin: tool to align multiple fields based on one or more separators
-" Author: Charles E. Campbell, Jr.
+" Author: Charles E. Campbell
" Date: Nov 02, 2008
" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
-" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
+" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@@ -22,7 +22,7 @@
if &cp || exists("g:loaded_AlignPlugin")
finish
endif
-let g:loaded_AlignPlugin = "v36"
+let g:loaded_AlignPlugin = "v37"
let s:keepcpo = &cpo
set cpo&vim
18 plugin/cecutil.vim
View
@@ -1,9 +1,9 @@
" cecutil.vim : save/restore window position
" save/restore mark position
" save/restore selected user maps
-" Author: Charles E. Campbell, Jr.
+" Author: Charles E. Campbell
" Version: 18h ASTRO-ONLY
-" Date: Apr 05, 2010
+" Date: Oct 16, 2012
"
" Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname)
@@ -459,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>
@@ -476,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 ".dobuffer.amap." ".maprhs
endif
if dounmap
- exe "silent! ".mapmode."unmap ".dobuffer.amap
+ exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save multiple maps
@@ -494,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 ".dobuffer.amap." ".maprhs
endif
if dounmap
- exe "silent! ".mapmode."unmap ".dobuffer.amap
+ exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
let i= i + 1
endwhile
@@ -517,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
Please sign in to comment.
Something went wrong with that request. Please try again.