diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..926ccaa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +doc/tags diff --git a/README b/README index c5ff5db..c99294c 100644 --- a/README +++ b/README @@ -1,19 +1,24 @@ This is a mirror of http://www.vim.org/scripts/script.php?script_id=294 - [ALIGN/ALIGNMAPS NEEDS VIM 7.0 AS OF V29/34] + [ALIGN/ALIGNMAPS NEEDS VIM 7.0 AS OF V29/34] -Align and AlignMaps lets you align statements on their equal signs, make comment boxes, align comments, align declarations, etc. +Align and AlignMaps lets you align statements on their equal signs, make +comment boxes, align comments, align declarations, etc. -Note: this plugin is not a left&right margin justification tool! See vimscript#177, vimscript#2324, or vimscript#3728 for that. -Note: if you have vim 7.1 or later, your vimball should unpack just fine without having to update it. +Note: this plugin is not a left&right margin justification tool! See +vimscript#177, vimscript#2324, or vimscript#3728 for that. +Note: if you have vim 7.1 or later, your vimball should unpack just fine +without having to update it. There are two basic commands provided by this package: - AlignCtrl options sep1 sep2 sep3 ... - [range]Align sep1 sep2 sep3 ... + AlignCtrl options sep1 sep2 sep3 ... + [range]Align sep1 sep2 sep3 ... -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: -(ws==whitespace, sep==separator, field==text) +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: (ws==whitespace, +sep==separator, field==text) ws-field-ws-sep-ws-field-ws-sep-ws-field-... ws-field-ws-sep-ws-field-ws-sep-ws-field-... @@ -22,18 +27,27 @@ Note that white-space (ws) surrounding separators is ignored. The Align package includes: - Align : the basic alignment command - AlignCtrl : provides options for the next call to :Align - 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. + Align : the basic alignment command + AlignCtrl : provides options for the next call to :Align + 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. -In addition, AutoAlign (vimscript#884) uses the Align function to align =s as you type. +In addition, AutoAlign (vimscript#884) uses the Align function to align =s as +you type. -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). +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). -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. - -The and files are plugins and require vim 6.1 or higher. +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. +The and files are plugins and require vim 6.1 or +higher. EXAMPLES: @@ -46,8 +60,8 @@ EXAMPLES: :AlignCtrl =lp1P1I which means: - = all separators are equivalent - l fields will be left-justified + = all separators are equivalent + l fields will be left-justified p1 pad one space before each separator P1 pad one space after each separator I preserve and apply the first line's leading white space to all @@ -56,66 +70,80 @@ EXAMPLES: :help align Gives help for Align - ALIGNMENT CONTROL -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. +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. MANY ALIGNMENT MAPS -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): +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): + + \t= : align assignments (don't count logic, like == or !=) + \t, : align on commas + \t| : align on vertical bars (|) + \tsp : align on whitespace + \tt : align LaTeX tabular tables - \t= : align assignments (don't count logic, like == or !=) - \t, : align on commas - \t| : align on vertical bars (|) - \tsp : align on whitespace - \tt : align LaTeX tabular tables +AlignMaps also provides some internally complex maps for aligning C +declarations, Ansi C function arguments, html tables, LaTeX tabulars, and +trailing comments: -AlignMaps also provides some internally complex maps for aligning C declarations, Ansi C function arguments, html tables, LaTeX tabulars, and trailing comments: + \acom : align comments + \adec : align C declarations (one variable per line) + \afnc : align ansi-style C function input arguments + \Htd : align html tables - \acom : align comments - \adec : align C declarations (one variable per line) - \afnc : align ansi-style C function input arguments - \Htd : align html tables - To see some examples of this, check out http://www.drchip.org/astronaut/vim/align.html#Examples -(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. -(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) +(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. +(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) ALIGNMENT ON VISUAL BLOCKS AND g,v-LIKE CONTROL -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! - +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! + Visual-block selection may be used to restrict Align to operate only within that visual block. - - AlignCtrl supports "g" and "v" patterns that restrict Align to + AlignCtrl supports "g" and "v" patterns that restrict Align to operate on lines which match (or don't match, respectively) those patterns. NEW STUFF: There's a number of new AlignCtrl options: - + - allows one to skip a separator (treat it as part of a field) + repeat the last lrc justification (ex. lr+ == lrrrrrr... ) : treat the rest of the line as a field; acts as a modifier - to the last lrc. + to the last lrc. < left-justify the separator > right-justify the separator | center the separator -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). - -To get automatic, as-you-type, aligning of = in the C, vimL, and other languages, check out vimscript#884 for several ftplugins (which use Align). +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). +To get automatic, as-you-type, aligning of = in the C, vimL, and other +languages, check out vimscript#884 for several ftplugins (which use Align). Alternative Aligners: - Gergely Kontra's vimscript#176 + Gergely Kontra's vimscript#176 Thank you for rating Align! @@ -123,7 +151,14 @@ Thank you for rating Align! DISCUSSION and COMMENTS: --------------------------------------- -Please use email for bugs. Enjoy! +Please use email for bugs. Enjoy! + +(alpha/beta version available at +http://mysite.verizon.net/astronaut/vim/index.html#ALIGN) -(alpha/beta version available at http://mysite.verizon.net/astronaut/vim/index.html#ALIGN) +install details +You'll need to have plugins enabled: in your home directory, have at least the +following two lines in your .vimrc file: + set nocp + filetype plugin on diff --git a/autoload/Align.vim b/autoload/Align.vim index e393584..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: 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,6 +1070,7 @@ fun! s:Strlen(x) call setline(line("."),a:x) let ret= virtcol("$") - 1 d + keepj norm! k let &l:mod= modkeep else diff --git a/autoload/AlignMaps.vim b/autoload/AlignMaps.vim index 9b0f3bc..9d20513 100644 --- a/autoload/AlignMaps.vim +++ b/autoload/AlignMaps.vim @@ -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 @@ -111,6 +111,20 @@ fun! AlignMaps#WrapperEnd() range " call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) 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 ".maplead.a:mapname." AM_".a:mapname + exe "vmap ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."" +endfun + " --------------------------------------------------------------------- " AlignMaps#StdAlign: some semi-standard align calls {{{2 fun! AlignMaps#StdAlign(mode) range @@ -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/==/\="\\"/ge keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\"/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).";\" -" 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).";\" -" 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.">") @@ -386,6 +369,31 @@ fun! AlignMaps#AlignMapsClean() " 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 diff --git a/doc/Align.txt b/doc/Align.txt index b08eca3..8c8c716 100644 --- a/doc/Align.txt +++ b/doc/Align.txt @@ -1,4 +1,4 @@ -*align.txt* The Alignment Tool Jun 18, 2012 +*align.txt* The Alignment Tool Jan 07, 2013 Author: Charles E. Campbell (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, 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 || instead of || 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\" 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 || instead of || 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\" 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 s - and