GetLatestVimScripts

Align, gundo, netrw, tcomment, LogiPat, editsrec, vcscommand
This commit is contained in:
Stefan Liebl 2013-09-04 14:00:54 +02:00
parent 3e4585dd7a
commit d1c4a9bc21
33 changed files with 4763 additions and 3524 deletions

View File

@ -14,7 +14,7 @@ ScriptID SourceID Filename
1772 7248 DAMOS.zip DAMOS tools (von Stefan) 1772 7248 DAMOS.zip DAMOS tools (von Stefan)
987 14064 DoxygenToolkit.vim 987 14064 DoxygenToolkit.vim
1397 16076 xml.vim 1397 16076 xml.vim
1290 5190 LogiPat.vim 1290 19635 LogiPat.vim
1462 5612 dtd2xml 1462 5612 dtd2xml
1046 4249 Lusty Explorer 1046 4249 Lusty Explorer
2043 7805 VimPdb (debugging python) 2043 7805 VimPdb (debugging python)
@ -23,16 +23,16 @@ ScriptID SourceID Filename
39 8196 matchit.vim 39 8196 matchit.vim
2092 8095 reloaded.vim (matrix colorscheme) 2092 8095 reloaded.vim (matrix colorscheme)
848 14668 SrchRplcHiGrp.vim (Search/Replace on Syntax Group) 848 14668 SrchRplcHiGrp.vim (Search/Replace on Syntax Group)
294 18148 Align.vim 294 19633 Align.vim
479 9276 MultipleSearch.vba 479 9276 MultipleSearch.vba
1066 7618 cecutil.vim 1066 7618 cecutil.vim
1173 17289 tComment.vim 1173 19247 tComment.vim
2701 13194 editsrec 2701 18988 editsrec
3280 14334 Tabbi 3280 14334 Tabbi
642 15781 :AutoInstall: getscript.vim 642 15781 :AutoInstall: getscript.vim
1075 15782 :AutoInstall: netrw.vim 1075 19823 :AutoInstall: netrw.vim
1502 15362 :AutoInstall: vimball.vim 1502 15362 :AutoInstall: vimball.vim
3304 18081 Gundo 3304 20505 Gundo
90 17031 vcscommand 90 19809 vcscommand
974 4316 python.vim (indent) 974 4316 python.vim (indent)

View File

@ -1,10 +1,10 @@
" Align: tool to align multiple fields based on one or more separators " Align: tool to align multiple fields based on one or more separators
" Author: Charles E. Campbell, Jr. " Author: Charles E. Campbell
" Date: Jun 18, 2012 " Date: Mar 12, 2013
" Version: 36 " Version: 37
" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim " GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.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, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -25,7 +25,7 @@
if exists("g:loaded_Align") || &cp if exists("g:loaded_Align") || &cp
finish finish
endif endif
let g:loaded_Align = "v36" let g:loaded_Align = "v37"
if v:version < 700 if v:version < 700
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of Align needs vim 7.0" echo "***warning*** this version of Align needs vim 7.0"
@ -43,7 +43,11 @@ set cpo&vim
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Options: {{{1 " Options: {{{1
if !exists("g:Align_xstrlen") 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 let g:Align_xstrlen= 0
else else
let g:Align_xstrlen= 1 let g:Align_xstrlen= 1
@ -529,19 +533,19 @@ fun! Align#Align(hasctrl,...) range
" call Decho(" ") " call Decho(" ")
" call Decho("---- Pass ".pass.": ----") " call Decho("---- Pass ".pass.": ----")
let line= begline let curline= begline
while line <= endline while curline <= endline
" Process each line " Process each line
let txt = getline(line) let txt = getline(curline)
" call Decho(" ") " 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 ) " AlignGPat support: allows a selector pattern (akin to g/selector/cmd )
if exists("s:AlignGPat") if exists("s:AlignGPat")
" call Decho("Pass".pass.": AlignGPat<".s:AlignGPat.">") " call Decho("Pass".pass.": AlignGPat<".s:AlignGPat.">")
if match(txt,s:AlignGPat) == -1 if match(txt,s:AlignGPat) == -1
" call Decho("Pass".pass.": skipping") " call Decho("Pass".pass.": skipping")
let line= line + 1 let curline= curline + 1
continue continue
endif endif
endif endif
@ -551,7 +555,7 @@ fun! Align#Align(hasctrl,...) range
" call Decho("Pass".pass.": AlignVPat<".s:AlignVPat.">") " call Decho("Pass".pass.": AlignVPat<".s:AlignVPat.">")
if match(txt,s:AlignVPat) != -1 if match(txt,s:AlignVPat) != -1
" call Decho("Pass".pass.": skipping") " call Decho("Pass".pass.": skipping")
let line= line + 1 let curline= curline + 1
continue continue
endif endif
endif endif
@ -559,12 +563,12 @@ fun! Align#Align(hasctrl,...) range
" Always skip blank lines " Always skip blank lines
if match(txt,'^\s*$') != -1 if match(txt,'^\s*$') != -1
" call Decho("Pass".pass.": skipping") " call Decho("Pass".pass.": skipping")
let line= line + 1 let curline= curline + 1
continue continue
endif endif
" Extract visual-block selected text (init bgntxt, endtxt) " Extract visual-block selected text (init bgntxt, endtxt)
let txtlen= s:Strlen(txt) let txtlen= s:Strlen(txt)
if begcol > 0 if begcol > 0
" Record text to left of selected area " Record text to left of selected area
let bgntxt= strpart(txt,0,begcol) let bgntxt= strpart(txt,0,begcol)
@ -655,7 +659,7 @@ fun! Align#Align(hasctrl,...) range
if alignop == '*' && exists("g:AlignSkip") && type(g:AlignSkip) == 2 if alignop == '*' && exists("g:AlignSkip") && type(g:AlignSkip) == 2
" call Decho("Pass".pass.": endfield=match(txt<".txt.">,seppat<".seppat.">,bgnfield=".bgnfield.")=".endfield." alignop=".alignop) " 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 " 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 endfield = match(txt,seppat,skipfield)
let sepfield = matchend(txt,seppat,skipfield) let sepfield = matchend(txt,seppat,skipfield)
let skipfield = sepfield let skipfield = sepfield
@ -688,22 +692,20 @@ fun! Align#Align(hasctrl,...) range
let field = bgntxt.field let field = bgntxt.field
let bgntxt= "" let bgntxt= ""
endif endif
let fieldlen = s:Strlen(field) let fieldlen= s:Strlen(field)
let sFieldSize = "FieldSize_".ifield if !exists("FieldSize_{ifield}")
if !exists(sFieldSize)
let FieldSize_{ifield}= fieldlen 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} elseif fieldlen > FieldSize_{ifield}
let FieldSize_{ifield}= fieldlen 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 endif
let sSepSize= "SepSize_".ifield if !exists("SepSize_{ifield}")
if !exists(sSepSize)
let SepSize_{ifield}= seplen 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} elseif seplen > SepSize_{ifield}
let SepSize_{ifield}= seplen 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 endif
else else
@ -714,6 +716,8 @@ fun! Align#Align(hasctrl,...) range
let alignprepad = strpart(alignprepad,1).strpart(alignprepad,0,1) let alignprepad = strpart(alignprepad,1).strpart(alignprepad,0,1)
let alignpostpad = strpart(alignpostpad,1).strpart(alignpostpad,0,1) let alignpostpad = strpart(alignpostpad,1).strpart(alignpostpad,0,1)
let field = substitute(strpart(txt,bgnfield,endfield-bgnfield),'^\s*\(.\{-}\)\s*$','\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' if s:AlignLeadKeep == 'W'
let field = bgntxt.field let field = bgntxt.field
let bgntxt= "" let bgntxt= ""
@ -724,21 +728,26 @@ fun! Align#Align(hasctrl,...) range
endif endif
let fieldlen = s:Strlen(field) let fieldlen = s:Strlen(field)
let sep = s:MakeSpace(prepad).strpart(txt,endfield,sepfield-endfield).s:MakeSpace(postpad) 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 seplen < SepSize_{ifield}
if alignsepop == "<" if alignsepop == "<"
" left-justify separators " left-justify separators
let sep = sep.s:MakeSpace(SepSize_{ifield}-seplen) let sep = sep.s:MakeSpace(SepSize_{ifield}-seplen)
" call Decho("Pass".pass.": sep<".sep."> (left-justified)")
elseif alignsepop == ">" elseif alignsepop == ">"
" right-justify separators " right-justify separators
let sep = s:MakeSpace(SepSize_{ifield}-seplen).sep let sep = s:MakeSpace(SepSize_{ifield}-seplen).sep
" call Decho("Pass".pass.": sep<".sep."> (right-justified)")
else else
" center-justify separators " center-justify separators
let sepleft = (SepSize_{ifield} - seplen)/2 let sepleft = (SepSize_{ifield} - seplen)/2
let sepright = SepSize_{ifield} - seplen - sepleft let sepright = SepSize_{ifield} - seplen - sepleft
let sep = s:MakeSpace(sepleft).sep.s:MakeSpace(sepright) let sep = s:MakeSpace(sepleft).sep.s:MakeSpace(sepright)
" call Decho("Pass".pass.": sep<".sep."> (center-justified)")
endif endif
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.">") " 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 " Perform alignment according to alignment style justification
@ -786,18 +795,20 @@ fun! Align#Align(hasctrl,...) range
if pass == 2 if pass == 2
" Write altered line to buffer " 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.": newtxt<".newtxt.">")
" call Decho("Pass".pass.": endtxt<".endtxt.">") " call Decho("Pass".pass.": endtxt<".endtxt.">")
keepj call setline(line,bgntxt.newtxt.endtxt) keepj call setline(curline,bgntxt.newtxt.endtxt)
endif endif
" call Decho("Pass".pass.": line#".curline."<".getline(".")."> (end-of-while)")
let line = line + 1 let curline = curline + 1
endwhile " line loop endwhile " curline loop
let pass= pass + 1 let pass= pass + 1
endwhile " pass loop endwhile " pass loop
" call Decho("end of two pass loop") " call Decho("end of two pass loop")
" call Decho("ENDWHILE: cursor at (".line(".").",".col(".").") curline#".curline)
" restore original leading whitespace " restore original leading whitespace
if s:AlignLeadKeep == 'W' if s:AlignLeadKeep == 'W'
@ -1059,6 +1070,7 @@ fun! s:Strlen(x)
call setline(line("."),a:x) call setline(line("."),a:x)
let ret= virtcol("$") - 1 let ret= virtcol("$") - 1
d d
keepj norm! k
let &l:mod= modkeep let &l:mod= modkeep
else else

View File

@ -1,8 +1,8 @@
" AlignMaps.vim : support functions for AlignMaps " AlignMaps.vim : support functions for AlignMaps
" Author: Charles E. Campbell, Jr. " Author: Charles E. Campbell
" Date: Jun 18, 2012 " Date: Mar 12, 2013
" Version: 42 " Version: 43
" 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, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -16,7 +16,7 @@
if &cp || exists("g:loaded_AlignMaps") if &cp || exists("g:loaded_AlignMaps")
finish finish
endif endif
let g:loaded_AlignMaps= "v42" let g:loaded_AlignMaps= "v43"
let s:keepcpo = &cpo let s:keepcpo = &cpo
set cpo&vim set cpo&vim
"DechoTabOn "DechoTabOn
@ -111,6 +111,20 @@ fun! AlignMaps#WrapperEnd() range
" call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) " call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
endfun 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 " AlignMaps#StdAlign: some semi-standard align calls {{{2
fun! AlignMaps#StdAlign(mode) range fun! AlignMaps#StdAlign(mode) range
@ -169,15 +183,15 @@ endfun
" AlignMaps#Equals: supports \t= and \T= {{{2 " AlignMaps#Equals: supports \t= and \T= {{{2
fun! AlignMaps#Equals() range fun! AlignMaps#Equals() range
" call Dfunc("AlignMaps#Equals()") " call Dfunc("AlignMaps#Equals()")
keepj 'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e keepj 'a,'zs/\s\+\([.*/+\-%|&\~^]\==\)/ \1/e
keepj 'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge keepj 'a,'zs@ \+\([.*/+\-%|&\~^]\)=@\1=@ge
keepj 'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge keepj 'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge
keepj norm g'zk keepj norm g'zk
AlignCtrl mIp1P1=l = AlignCtrl mIp1P1=l =
AlignCtrl g = AlignCtrl g =
keepj 'a,'z-1Align 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@[^+\-]\zs\([+\-]\)\( \+\)=@\2\1=@ge
keepj 'a,'z-1s/\( \+\);/;\1/ge keepj 'a,'z-1s/\( \+\);/;\1/ge
if &ft == "c" || &ft == "cpp" if &ft == "c" || &ft == "cpp"
@ -323,37 +337,6 @@ fun! AlignMaps#FixMultiDec()
let curline = getline(".") let curline = getline(".")
" call Decho("curline<".curline.">") " 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','') let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+[(*]*\h.*$','\1','')
" call Decho("@x<".@x.">") " call Decho("@x<".@x.">")
@ -386,6 +369,31 @@ fun! AlignMaps#AlignMapsClean()
" call Dret("AlignMaps#AlignMapsClean") " call Dret("AlignMaps#AlignMapsClean")
endfun 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 " Restore: {{{1
let &cpo= s:keepcpo let &cpo= s:keepcpo

View File

@ -273,7 +273,7 @@ def _undo_to(n):
INLINE_HELP = '''\ INLINE_HELP = '''\
" Gundo for %s (%d) " Gundo for %s (%d)
" j/k - move between undo states " %s/%s - move between undo states
" p - preview diff of selected and current states " p - preview diff of selected and current states
" <cr> - revert to selected state " <cr> - revert to selected state
@ -424,9 +424,11 @@ def GundoRenderGraph():
result = [' ' + l for l in result] result = [' ' + l for l in result]
target = (vim.eval('g:gundo_target_f'), int(vim.eval('g:gundo_target_n'))) target = (vim.eval('g:gundo_target_f'), int(vim.eval('g:gundo_target_n')))
mappings = (vim.eval('g:gundo_map_move_older'),
vim.eval('g:gundo_map_move_newer'))
if int(vim.eval('g:gundo_help')): if int(vim.eval('g:gundo_help')):
header = (INLINE_HELP % target).splitlines() header = (INLINE_HELP % (target + mappings)).splitlines()
else: else:
header = [] header = []
@ -524,6 +526,7 @@ def GundoPlayTo():
target_n = int(vim.eval('s:GundoGetTargetState()')) target_n = int(vim.eval('s:GundoGetTargetState()'))
back = int(vim.eval('g:gundo_target_n')) back = int(vim.eval('g:gundo_target_n'))
delay = int(vim.eval('g:gundo_playback_delay'))
vim.command('echo "%s"' % back) vim.command('echo "%s"' % back)
@ -570,7 +573,7 @@ def GundoPlayTo():
normal('zz') normal('zz')
_goto_window_for_buffer(back) _goto_window_for_buffer(back)
vim.command('redraw') vim.command('redraw')
vim.command('sleep 60m') vim.command('sleep %dm' % delay)
def initPythonModule(): def initPythonModule():
if sys.version_info[:2] < (2, 4): if sys.version_info[:2] < (2, 4):

View File

@ -49,6 +49,9 @@ endif"}}}
if !exists("g:gundo_auto_preview")"{{{ if !exists("g:gundo_auto_preview")"{{{
let g:gundo_auto_preview = 1 let g:gundo_auto_preview = 1
endif"}}} endif"}}}
if !exists("g:gundo_playback_delay")"{{{
let g:gundo_playback_delay = 60
endif"}}}
let s:has_supported_python = 0 let s:has_supported_python = 0
if g:gundo_prefer_python3 && has('python3')"{{{ if g:gundo_prefer_python3 && has('python3')"{{{

View File

@ -9,6 +9,7 @@
" 00.02.00 | 29.03.10 | Fun added, MkS5() " 00.02.00 | 29.03.10 | Fun added, MkS5()
" 00.02.10 | 15.06.10 | BugFix, in libsrec#CrCS() " 00.02.10 | 15.06.10 | BugFix, in libsrec#CrCS()
" | | wrong Source for CS " | | wrong Source for CS
" 00.02.20 | | -
" create ByteCount " create ByteCount
fun libsrec#CrBC(line) fun libsrec#CrBC(line)

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
" netrwFileHandlers: contains various extension-based file handlers for " netrwFileHandlers: contains various extension-based file handlers for
" netrw's browsers' x command ("eXecute launcher") " netrw's browsers' x command ("eXecute launcher")
" Author: Charles E. Campbell, Jr. " Author: Charles E. Campbell
" Date: Sep 30, 2008 " Date: Mar 14, 2012
" Version: 10 " Version: 11a
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -20,7 +20,7 @@
if exists("g:loaded_netrwFileHandlers") || &cp if exists("g:loaded_netrwFileHandlers") || &cp
finish finish
endif endif
let g:loaded_netrwFileHandlers= "v10" let g:loaded_netrwFileHandlers= "v11a"
if v:version < 702 if v:version < 702
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of netrwFileHandlers needs vim 7.2" echo "***warning*** this version of netrwFileHandlers needs vim 7.2"
@ -64,7 +64,7 @@ fun! netrwFileHandlers#Invoke(exten,fname)
" call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') " call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")')
exe "let ret= s:NFH_".a:exten.'("'.fname.'")' exe "let ret= s:NFH_".a:exten.'("'.fname.'")'
endif endif
" call Dret("netrwFileHandlers#Invoke 0 : ret=".ret) " call Dret("netrwFileHandlers#Invoke 0 : ret=".ret)
return 0 return 0
endfun endfun
@ -356,6 +356,7 @@ fun! s:NFH_obj(obj)
endfun endfun
let &cpo= s:keepcpo let &cpo= s:keepcpo
unlet s:keepcpo
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Modelines: {{{1 " Modelines: {{{1
" vim: fdm=marker " vim: fdm=marker

View File

@ -1,8 +1,8 @@
" netrwSettings.vim: makes netrw settings simpler " netrwSettings.vim: makes netrw settings simpler
" Date: Sep 03, 2008 " Date: Sep 03, 2008
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> " Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
" Version: 13 " Version: 13
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -63,7 +63,7 @@ fun! netrwSettings#NetrwSettings()
endif endif
put ='+ ---------------------------------------------' put ='+ ---------------------------------------------'
put ='+ NetrwSettings: by Charles E. Campbell, Jr.' put ='+ NetrwSettings: by Charles E. Campbell'
put ='+ Press <F1> with cursor atop any line for help' put ='+ Press <F1> with cursor atop any line for help'
put ='+ ---------------------------------------------' put ='+ ---------------------------------------------'
let s:netrw_settings_stop= line(".") let s:netrw_settings_stop= line(".")
@ -106,7 +106,7 @@ fun! netrwSettings#NetrwSettings()
put = 'let g:netrw_browsex_viewer = (not defined)' put = 'let g:netrw_browsex_viewer = (not defined)'
endif endif
put = 'let g:netrw_compress = '.g:netrw_compress put = 'let g:netrw_compress = '.g:netrw_compress
put = 'let g:netrw_cursorline = '.g:netrw_cursorline put = 'let g:netrw_cursor = '.g:netrw_cursor
let decompressline= line("$") let decompressline= line("$")
put ='let g:netrw_decompress...' put ='let g:netrw_decompress...'
put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
@ -125,9 +125,9 @@ fun! netrwSettings#NetrwSettings()
put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_list_hide = '.g:netrw_list_hide
put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_liststyle = '.g:netrw_liststyle
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
put = 'let g:netrw_menu = '.g:netrw_menu put = 'let g:netrw_menu = '.g:netrw_menu
put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd

View File

@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037 " @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-09-17. " @Created: 2007-09-17.
" @Last Change: 2011-04-12. " @Last Change: 2012-12-10.
" @Revision: 0.0.407 " @Revision: 0.0.614
" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile " call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile
@ -13,9 +13,20 @@ if !exists("g:tcommentBlankLines")
let g:tcommentBlankLines = 1 "{{{2 let g:tcommentBlankLines = 1 "{{{2
endif endif
if !exists("g:tcommentModeExtra")
" Modifies how commenting works.
" > ... Move the cursor to the end of the comment
" >> ... Like above but move the cursor to the next line
" # ... Move the cursor to the position of the commented text
" (NOTE: this only works when creating empty comments using
" |:TCommentInline| from normal or insert mode and should
" not be set here as a global option.)
let g:tcommentModeExtra = '' "{{{2
endif
if !exists("g:tcommentOpModeExtra") if !exists("g:tcommentOpModeExtra")
" Modifies how the operator works. " Modifies how the operator works.
" > ... Move the cursor to the end of the comment " See |g:tcommentModeExtra| for a list of possible values.
let g:tcommentOpModeExtra = '' "{{{2 let g:tcommentOpModeExtra = '' "{{{2
endif endif
@ -53,7 +64,7 @@ if !exists("g:tcommentGuessFileType")
let g:tcommentGuessFileType = 0 "{{{2 let g:tcommentGuessFileType = 0 "{{{2
endif endif
if !exists("g:tcommentGuessFileType_dsl") if !exists("g:tcommentGuessFileType_dsl")
" For dsl documents, assumet filetype = xml. " For dsl documents, assume filetype = xml.
let g:tcommentGuessFileType_dsl = 'xml' "{{{2 let g:tcommentGuessFileType_dsl = 'xml' "{{{2
endif endif
if !exists("g:tcommentGuessFileType_php") if !exists("g:tcommentGuessFileType_php")
@ -74,9 +85,15 @@ endif
if !exists("g:tcommentGuessFileType_django") if !exists("g:tcommentGuessFileType_django")
let g:tcommentGuessFileType_django = 1 "{{{2 let g:tcommentGuessFileType_django = 1 "{{{2
endif endif
if !exists("g:tcommentGuessFileType_eruby")
let g:tcommentGuessFileType_eruby = 1 "{{{2
endif
if !exists("g:tcommentGuessFileType_smarty")
let g:tcommentGuessFileType_smarty = 1 "{{{2
endif
if !exists("g:tcommentIgnoreTypes_php") if !exists("g:tcommentIgnoreTypes_php")
" In php files, some syntax regions are wongly highlighted as sql " In php files, some syntax regions are wrongly highlighted as sql
" markup. We thus ignore sql syntax when guessing the filetype in " markup. We thus ignore sql syntax when guessing the filetype in
" php files. " php files.
let g:tcommentIgnoreTypes_php = 'sql' "{{{2 let g:tcommentIgnoreTypes_php = 'sql' "{{{2
@ -102,18 +119,49 @@ if !exists('g:tcommentSyntaxMap')
\ 'vimPythonRegion': 'python', \ 'vimPythonRegion': 'python',
\ 'vimRubyRegion': 'ruby', \ 'vimRubyRegion': 'ruby',
\ 'vimTclRegion': 'tcl', \ 'vimTclRegion': 'tcl',
\ 'Delimiter': {
\ 'filetype': {
\ 'php': 'php',
\ },
\ },
\ 'phpRegionDelimiter': {
\ 'prevnonblank': [
\ {'match': '<?php', 'filetype': 'php'},
\ {'match': '?>', 'filetype': 'html'},
\ ],
\ 'nextnonblank': [
\ {'match': '?>', 'filetype': 'php'},
\ {'match': '<?php', 'filetype': 'html'},
\ ],
\ },
\ } \ }
endif endif
if !exists("g:tcommentBlockC") if !exists('g:tcomment#replacements_c')
" Replacements for c filetype.
" :read: let g:tcomment#replacements_c = {...} "{{{2
let g:tcomment#replacements_c = {
\ '/*': '#<{(|',
\ '*/': '|)}>#',
\ }
endif
if !exists("g:tcommentLineC")
" Generic c-like block comments. " Generic c-like block comments.
" :read: let g:tcommentBlockC = {...} "{{{2 " :read: let g:tcommentBlockC = {...} "{{{2
let g:tcommentLineC = {
\ 'commentstring': '/* %s */',
\ 'replacements': g:tcomment#replacements_c
\ }
endif
if !exists("g:tcommentBlockC")
let g:tcommentBlockC = { let g:tcommentBlockC = {
\ 'commentstring': '/*%s */', \ 'commentstring': '/*%s */',
\ 'middle': ' * ', \ 'middle': ' * ',
\ 'rxbeg': '\*\+', \ 'rxbeg': '\*\+',
\ 'rxend': '\*\+', \ 'rxend': '\*\+',
\ 'rxmid': '\*\+', \ 'rxmid': '\*\+',
\ 'replacements': g:tcomment#replacements_c
\ } \ }
endif endif
if !exists("g:tcommentBlockC2") if !exists("g:tcommentBlockC2")
@ -125,11 +173,12 @@ if !exists("g:tcommentBlockC2")
\ 'rxbeg': '\*\+', \ 'rxbeg': '\*\+',
\ 'rxend': '\*\+', \ 'rxend': '\*\+',
\ 'rxmid': '\*\+', \ 'rxmid': '\*\+',
\ 'replacements': g:tcomment#replacements_c
\ } \ }
endif endif
if !exists("g:tcommentInlineC") if !exists("g:tcommentInlineC")
" Generic c-like comments. " Generic c-like comments.
let g:tcommentInlineC = "/* %s */" "{{{2 let g:tcommentInlineC = g:tcommentLineC "{{{2
endif endif
if !exists("g:tcommentBlockXML") if !exists("g:tcommentBlockXML")
@ -150,6 +199,12 @@ let s:definitions = {}
" to have a blank after the comment marker. Block comments work only if " to have a blank after the comment marker. Block comments work only if
" we explicitly define the markup. " we explicitly define the markup.
" "
" NAME usually is a 'filetype'. You can use special suffixes to define
" special comment types. E.g. the name "FILETYPE_block" is used for
" block comments for 'filetype'. The name "FILETYPE_inline" is used for
" inline comments. If no specialized comment definition exists, the
" normal one with name "FILETYPE" is used.
"
" The comment definition can be either a string or a dictionary. " The comment definition can be either a string or a dictionary.
" "
" If it is a string: " If it is a string:
@ -158,8 +213,14 @@ let s:definitions = {}
" that defines how "middle lines" (see :h format-comments) should be " that defines how "middle lines" (see :h format-comments) should be
" displayed. " displayed.
" "
" Example: If the string is "--%s--\n-- ", lines will be commented as
" "--%s--" but the middle lines in block comments will be commented as
" "--%s".
"
" If it is a dictionary: " If it is a dictionary:
" See the help on the args argument of |tcomment#Comment|. " See the help on the args argument of |tcomment#Comment| (see item 1,
" args is a list of key=value pairs) to find out which fields can be
" used.
function! tcomment#DefineType(name, commentdef) function! tcomment#DefineType(name, commentdef)
if !has_key(s:definitions, a:name) if !has_key(s:definitions, a:name)
if type(a:commentdef) == 4 if type(a:commentdef) == 4
@ -173,12 +234,30 @@ function! tcomment#DefineType(name, commentdef)
let s:typesDirty = 1 let s:typesDirty = 1
endf endf
" :nodoc:
" Return comment definition
function! tcomment#GetCommentDef(name)
return get(s:definitions, a:name, "")
endf
" :nodoc: " :nodoc:
" Return 1 if a comment type is defined. " Return 1 if a comment type is defined.
function! tcomment#TypeExists(name) function! tcomment#TypeExists(name)
return has_key(s:definitions, a:name) return has_key(s:definitions, a:name)
endf endf
" :doc:
" A dictionary of NAME => COMMENT DEFINITION (see |tcomment#DefineType|)
" that can be set in vimrc to override tcomment's default comment
" styles.
" :read: let g:tcomment_types = {} "{{{2
if exists('g:tcomment_types')
for [s:name, s:def] in items(g:tcomment_types)
call tcomment#DefineType(s:name, s:def)
endfor
unlet! s:name s:def
endif
call tcomment#DefineType('aap', '# %s' ) call tcomment#DefineType('aap', '# %s' )
call tcomment#DefineType('ada', '-- %s' ) call tcomment#DefineType('ada', '-- %s' )
call tcomment#DefineType('apache', '# %s' ) call tcomment#DefineType('apache', '# %s' )
@ -193,11 +272,17 @@ call tcomment#DefineType('cpp_block', g:tcommentBlockC )
call tcomment#DefineType('css', '/* %s */' ) call tcomment#DefineType('css', '/* %s */' )
call tcomment#DefineType('css_inline', g:tcommentInlineC ) call tcomment#DefineType('css_inline', g:tcommentInlineC )
call tcomment#DefineType('css_block', g:tcommentBlockC ) call tcomment#DefineType('css_block', g:tcommentBlockC )
call tcomment#DefineType('c', '/* %s */' ) call tcomment#DefineType('c', g:tcommentLineC )
call tcomment#DefineType('c_inline', g:tcommentInlineC ) call tcomment#DefineType('c_inline', g:tcommentInlineC )
call tcomment#DefineType('c_block', g:tcommentBlockC ) call tcomment#DefineType('c_block', g:tcommentBlockC )
call tcomment#DefineType('cfg', '# %s' ) call tcomment#DefineType('cfg', '# %s' )
call tcomment#DefineType('clojure', {'commentstring': '; %s', 'count': 2})
call tcomment#DefineType('clojure_inline', '; %s' )
call tcomment#DefineType('clojurescript', ';; %s' )
call tcomment#DefineType('clojurescript_inline', '; %s' )
call tcomment#DefineType('coffee', '# %s' )
call tcomment#DefineType('conf', '# %s' ) call tcomment#DefineType('conf', '# %s' )
call tcomment#DefineType('conkyrc', '# %s' )
call tcomment#DefineType('crontab', '# %s' ) call tcomment#DefineType('crontab', '# %s' )
call tcomment#DefineType('cs', '// %s' ) call tcomment#DefineType('cs', '// %s' )
call tcomment#DefineType('cs_inline', g:tcommentInlineC ) call tcomment#DefineType('cs_inline', g:tcommentInlineC )
@ -205,8 +290,7 @@ call tcomment#DefineType('cs_block', g:tcommentBlockC )
call tcomment#DefineType('debsources', '# %s' ) call tcomment#DefineType('debsources', '# %s' )
call tcomment#DefineType('debcontrol', '# %s' ) call tcomment#DefineType('debcontrol', '# %s' )
call tcomment#DefineType('desktop', '# %s' ) call tcomment#DefineType('desktop', '# %s' )
call tcomment#DefineType('django', '{# %s #}' ) call tcomment#DefineType('dnsmasq', '# %s' )
call tcomment#DefineType('django_block', "{%% comment %%}%s{%% endcomment %%}\n ")
call tcomment#DefineType('docbk', '<!-- %s -->' ) call tcomment#DefineType('docbk', '<!-- %s -->' )
call tcomment#DefineType('docbk_inline', g:tcommentInlineXML) call tcomment#DefineType('docbk_inline', g:tcommentInlineXML)
call tcomment#DefineType('docbk_block', g:tcommentBlockXML ) call tcomment#DefineType('docbk_block', g:tcommentBlockXML )
@ -219,6 +303,7 @@ call tcomment#DefineType('erlang', '%%%% %s' )
call tcomment#DefineType('eruby', '<%%# %s' ) call tcomment#DefineType('eruby', '<%%# %s' )
call tcomment#DefineType('fstab', '# %s' ) call tcomment#DefineType('fstab', '# %s' )
call tcomment#DefineType('gitcommit', '# %s' ) call tcomment#DefineType('gitcommit', '# %s' )
call tcomment#DefineType('gitignore', '# %s' )
call tcomment#DefineType('gtkrc', '# %s' ) call tcomment#DefineType('gtkrc', '# %s' )
call tcomment#DefineType('go', '// %s' ) call tcomment#DefineType('go', '// %s' )
call tcomment#DefineType('go_inline', g:tcommentInlineC ) call tcomment#DefineType('go_inline', g:tcommentInlineC )
@ -227,13 +312,18 @@ call tcomment#DefineType('groovy', '// %s' )
call tcomment#DefineType('groovy_inline', g:tcommentInlineC ) call tcomment#DefineType('groovy_inline', g:tcommentInlineC )
call tcomment#DefineType('groovy_block', g:tcommentBlockC ) call tcomment#DefineType('groovy_block', g:tcommentBlockC )
call tcomment#DefineType('groovy_doc_block', g:tcommentBlockC2 ) call tcomment#DefineType('groovy_doc_block', g:tcommentBlockC2 )
call tcomment#DefineType('haml', '-# %s' )
call tcomment#DefineType('haskell', '-- %s' ) call tcomment#DefineType('haskell', '-- %s' )
call tcomment#DefineType('haskell_block', "{-%s-}\n " ) call tcomment#DefineType('haskell_block', "{-%s-}\n " )
call tcomment#DefineType('haskell_inline', '{- %s -}' ) call tcomment#DefineType('haskell_inline', '{- %s -}' )
call tcomment#DefineType('html', '<!-- %s -->' ) call tcomment#DefineType('html', '<!-- %s -->' )
call tcomment#DefineType('html_inline', g:tcommentInlineXML) call tcomment#DefineType('html_inline', g:tcommentInlineXML)
call tcomment#DefineType('html_block', g:tcommentBlockXML ) call tcomment#DefineType('html_block', g:tcommentBlockXML )
call tcomment#DefineType('htmldjango', '{# %s #}' )
call tcomment#DefineType('htmldjango_block', "{%% comment %%}%s{%% endcomment %%}\n ")
call tcomment#DefineType('ini', '; %s' ) " php ini (/etc/php5/...)
call tcomment#DefineType('io', '// %s' ) call tcomment#DefineType('io', '// %s' )
call tcomment#DefineType('jasmine', '# %s' )
call tcomment#DefineType('javaScript', '// %s' ) call tcomment#DefineType('javaScript', '// %s' )
call tcomment#DefineType('javaScript_inline', g:tcommentInlineC ) call tcomment#DefineType('javaScript_inline', g:tcommentInlineC )
call tcomment#DefineType('javaScript_block', g:tcommentBlockC ) call tcomment#DefineType('javaScript_block', g:tcommentBlockC )
@ -250,6 +340,7 @@ call tcomment#DefineType('lynx', '# %s' )
call tcomment#DefineType('matlab', '%% %s' ) call tcomment#DefineType('matlab', '%% %s' )
call tcomment#DefineType('m4', 'dnl %s' ) call tcomment#DefineType('m4', 'dnl %s' )
call tcomment#DefineType('mail', '> %s' ) call tcomment#DefineType('mail', '> %s' )
call tcomment#DefineType('monkey', ''' %s' )
call tcomment#DefineType('msidl', '// %s' ) call tcomment#DefineType('msidl', '// %s' )
call tcomment#DefineType('msidl_block', g:tcommentBlockC ) call tcomment#DefineType('msidl_block', g:tcommentBlockC )
call tcomment#DefineType('nginx', '# %s' ) call tcomment#DefineType('nginx', '# %s' )
@ -261,6 +352,7 @@ call tcomment#DefineType('objc_block', g:tcommentBlockC )
call tcomment#DefineType('ocaml', '(* %s *)' ) call tcomment#DefineType('ocaml', '(* %s *)' )
call tcomment#DefineType('ocaml_inline', '(* %s *)' ) call tcomment#DefineType('ocaml_inline', '(* %s *)' )
call tcomment#DefineType('ocaml_block', "(*%s*)\n " ) call tcomment#DefineType('ocaml_block', "(*%s*)\n " )
call tcomment#DefineType('pac', '// %s' )
call tcomment#DefineType('pascal', '(* %s *)' ) call tcomment#DefineType('pascal', '(* %s *)' )
call tcomment#DefineType('pascal_inline', '(* %s *)' ) call tcomment#DefineType('pascal_inline', '(* %s *)' )
call tcomment#DefineType('pascal_block', "(*%s*)\n " ) call tcomment#DefineType('pascal_block', "(*%s*)\n " )
@ -272,9 +364,12 @@ call tcomment#DefineType('php_block', g:tcommentBlockC )
call tcomment#DefineType('php_2_block', g:tcommentBlockC2 ) call tcomment#DefineType('php_2_block', g:tcommentBlockC2 )
call tcomment#DefineType('po', '# %s' ) call tcomment#DefineType('po', '# %s' )
call tcomment#DefineType('prolog', '%% %s' ) call tcomment#DefineType('prolog', '%% %s' )
call tcomment#DefineType('puppet', '# %s' )
call tcomment#DefineType('python', '# %s' ) call tcomment#DefineType('python', '# %s' )
call tcomment#DefineType('rc', '// %s' ) call tcomment#DefineType('rc', '// %s' )
call tcomment#DefineType('readline', '# %s' ) call tcomment#DefineType('readline', '# %s' )
call tcomment#DefineType('resolv', '# %s' )
call tcomment#DefineType('robots', '# %s' )
call tcomment#DefineType('ruby', '# %s' ) call tcomment#DefineType('ruby', '# %s' )
call tcomment#DefineType('ruby_3', '### %s' ) call tcomment#DefineType('ruby_3', '### %s' )
call tcomment#DefineType('ruby_block', "=begin rdoc%s=end") call tcomment#DefineType('ruby_block', "=begin rdoc%s=end")
@ -291,16 +386,20 @@ call tcomment#DefineType('sgml', '<!-- %s -->' )
call tcomment#DefineType('sgml_inline', g:tcommentInlineXML) call tcomment#DefineType('sgml_inline', g:tcommentInlineXML)
call tcomment#DefineType('sgml_block', g:tcommentBlockXML ) call tcomment#DefineType('sgml_block', g:tcommentBlockXML )
call tcomment#DefineType('sh', '# %s' ) call tcomment#DefineType('sh', '# %s' )
call tcomment#DefineType('sql', '-- %s' ) call tcomment#DefineType('smarty', '{* %s *}' )
call tcomment#DefineType('spec', '# %s' ) call tcomment#DefineType('spec', '# %s' )
call tcomment#DefineType('sps', '* %s.' ) call tcomment#DefineType('sps', '* %s.' )
call tcomment#DefineType('sps_block', "* %s." ) call tcomment#DefineType('sps_block', "* %s." )
call tcomment#DefineType('spss', '* %s.' ) call tcomment#DefineType('spss', '* %s.' )
call tcomment#DefineType('spss_block', "* %s." ) call tcomment#DefineType('spss_block', "* %s." )
call tcomment#DefineType('sql', '-- %s' )
call tcomment#DefineType('squid', '# %s' )
call tcomment#DefineType('st', '" %s "' )
call tcomment#DefineType('tcl', '# %s' ) call tcomment#DefineType('tcl', '# %s' )
call tcomment#DefineType('tex', '%% %s' ) call tcomment#DefineType('tex', '%% %s' )
call tcomment#DefineType('tpl', '<!-- %s -->' ) call tcomment#DefineType('tpl', '<!-- %s -->' )
call tcomment#DefineType('typoscript', '# %s' ) call tcomment#DefineType('typoscript', '# %s' )
call tcomment#DefineType('vhdl', '-- %s' )
call tcomment#DefineType('viki', '%% %s' ) call tcomment#DefineType('viki', '%% %s' )
call tcomment#DefineType('viki_3', '%%%%%% %s' ) call tcomment#DefineType('viki_3', '%%%%%% %s' )
call tcomment#DefineType('viki_inline', '{cmt: %s}' ) call tcomment#DefineType('viki_inline', '{cmt: %s}' )
@ -336,6 +435,7 @@ let s:nullCommentString = '%s'
" 1. a list of key=value pairs where known keys are (see also " 1. a list of key=value pairs where known keys are (see also
" |g:tcommentOptions|): " |g:tcommentOptions|):
" as=STRING ... Use a specific comment definition " as=STRING ... Use a specific comment definition
" count=N ... Repeat the comment string N times
" col=N ... Start the comment at column N (in block " col=N ... Start the comment at column N (in block
" mode; must be smaller than |indent()|) " mode; must be smaller than |indent()|)
" mode=STRING ... See the notes below on the "commentMode" argument " mode=STRING ... See the notes below on the "commentMode" argument
@ -343,7 +443,7 @@ let s:nullCommentString = '%s'
" end=STRING ... Comment postfix " end=STRING ... Comment postfix
" middle=STRING ... Middle line comments in block mode " middle=STRING ... Middle line comments in block mode
" rxbeg=N ... Regexp to find the substring of "begin" " rxbeg=N ... Regexp to find the substring of "begin"
" that should be multipied by "count" " that should be multiplied by "count"
" rxend=N ... The above for "end" " rxend=N ... The above for "end"
" rxmid=N ... The above for "middle" " rxmid=N ... The above for "middle"
" commentstring_rx ... A regexp format string that matches " commentstring_rx ... A regexp format string that matches
@ -366,12 +466,13 @@ let s:nullCommentString = '%s'
" By default, each line in range will be commented by adding the comment " By default, each line in range will be commented by adding the comment
" prefix and postfix. " prefix and postfix.
function! tcomment#Comment(beg, end, ...) function! tcomment#Comment(beg, end, ...)
let commentMode = a:0 >= 1 ? a:1 : 'G' let commentMode = (a:0 >= 1 ? a:1 : 'G') . g:tcommentModeExtra
let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0 let commentAnyway = a:0 >= 2 ? (a:2 == '!') : 0
" TLogVAR a:beg, a:end, a:1, commentMode, commentAnyway " TLogVAR a:beg, a:end, commentMode, commentAnyway
" save the cursor position " save the cursor position
let pos = getpos('.') let s:current_pos = getpos('.')
let s:pos_end = getpos("'>") let cursor_pos = getpos("'>")
let s:cursor_pos = []
if commentMode =~# 'i' if commentMode =~# 'i'
let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g') let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g')
endif endif
@ -379,10 +480,17 @@ function! tcomment#Comment(beg, end, ...)
" TLogVAR commentMode, lbeg, cbeg, lend, cend " TLogVAR commentMode, lbeg, cbeg, lend, cend
" get the correct commentstring " get the correct commentstring
let cdef = copy(g:tcommentOptions) let cdef = copy(g:tcommentOptions)
" TLogVAR 1, cdef
if exists('b:tcommentOptions')
let cdef = extend(cdef, copy(b:tcommentOptions))
" TLogVAR 2, cdef
endif
if a:0 >= 3 && type(a:3) == 4 if a:0 >= 3 && type(a:3) == 4
call extend(cdef, a:3) call extend(cdef, a:3)
" TLogVAR 3, cdef
else else
call extend(cdef, s:GetCommentDefinition(lbeg, lend, commentMode)) call extend(cdef, s:GetCommentDefinition(lbeg, lend, commentMode))
" TLogVAR 4, cdef
let ax = 3 let ax = 3
if a:0 >= 3 && a:3 != '' && stridx(a:3, '=') == -1 if a:0 >= 3 && a:3 != '' && stridx(a:3, '=') == -1
let ax = 4 let ax = 4
@ -392,8 +500,10 @@ function! tcomment#Comment(beg, end, ...)
let cdef.end = a:4 let cdef.end = a:4
endif endif
endif endif
" TLogVAR ax, a:0, a:000
if a:0 >= ax if a:0 >= ax
call extend(cdef, s:ParseArgs(lbeg, lend, commentMode, a:000[ax - 1 : -1])) let cdef = extend(cdef, s:ParseArgs(lbeg, lend, commentMode, a:000[ax - 1 : -1]))
" TLogVAR 5, cdef
endif endif
if !empty(get(cdef, 'begin', '')) || !empty(get(cdef, 'end', '')) if !empty(get(cdef, 'begin', '')) || !empty(get(cdef, 'end', ''))
let cdef.commentstring = s:EncodeCommentPart(get(cdef, 'begin', '')) let cdef.commentstring = s:EncodeCommentPart(get(cdef, 'begin', ''))
@ -402,11 +512,19 @@ function! tcomment#Comment(beg, end, ...)
endif endif
let commentMode = cdef.mode let commentMode = cdef.mode
endif endif
if exists('s:temp_options')
let cdef = s:ExtendCDef(lbeg, lend, commentMode, cdef, s:temp_options)
" TLogVAR cdef
" echom "DBG s:temp_options" string(s:temp_options)
unlet s:temp_options
endif
" TLogVAR cdef
if !empty(filter(['count', 'cbeg', 'cend', 'cmid'], 'has_key(cdef, v:val)')) if !empty(filter(['count', 'cbeg', 'cend', 'cmid'], 'has_key(cdef, v:val)'))
call s:RepeatCommentstring(cdef) call s:RepeatCommentstring(cdef)
endif endif
" echom "DBG" string(cdef) string(a:000) " echom "DBG" string(a:000)
let cms0 = s:BlockGetCommentRx(cdef) let cms0 = s:BlockGetCommentRx(cdef)
" TLogVAR cms0
" make whitespace optional; this conflicts with comments that require some " make whitespace optional; this conflicts with comments that require some
" whitespace " whitespace
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g') let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
@ -421,6 +539,7 @@ function! tcomment#Comment(beg, end, ...)
let indent = len(indentStr) let indent = len(indentStr)
if col > indent if col > indent
let cms0 = repeat(' ', col - indent) . cms0 let cms0 = repeat(' ', col - indent) . cms0
" TLogVAR cms0
else else
let indentStr = repeat(' ', col) let indentStr = repeat(' ', col)
endif endif
@ -439,25 +558,54 @@ function! tcomment#Comment(beg, end, ...)
let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\') let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\')
" final pattern for commenting " final pattern for commenting
let cmtReplace = s:GetCommentReplace(cdef, cms0) let cmtReplace = s:GetCommentReplace(cdef, cms0)
" echom "DBG tcomment#Comment" lbeg .','. lend .'s/\V'. " TLogVAR cmtReplace
" \ s:StartPosRx(commentMode, lbeg, cbeg) . indentStr .'\zs\(\_.\{-}\)'. s:EndPosRx(commentMode, lend, cend) .'/'. let s:cdef = cdef
" \ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge' let cmd = lbeg .','. lend .'s/\V'.
exec lbeg .','. lend .'s/\V'.
\ s:StartPosRx(commentMode, lbeg, cbeg) . indentStr .'\zs\(\_.\{-}\)'. s:EndPosRx(commentMode, lend, cend) .'/'. \ s:StartPosRx(commentMode, lbeg, cbeg) . indentStr .'\zs\(\_.\{-}\)'. s:EndPosRx(commentMode, lend, cend) .'/'.
\ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge' \ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
" TLogVAR cmd
exec cmd
call histdel('search', -1)
unlet s:cdef
endif endif
" reposition cursor " reposition cursor
" TLogVAR commentMode " TLogVAR commentMode
if commentMode =~ '>' if !empty(s:cursor_pos)
call setpos('.', s:pos_end) let cursor_pos = s:cursor_pos
else
" TLogVAR pos
call setpos('.', pos)
endif endif
if commentMode =~ '>'
call setpos('.', cursor_pos)
if commentMode !~ 'i' && commentMode =~ '>>'
norm! l^
endif
elseif commentMode =~ '#'
call setpos('.', cursor_pos)
else
call setpos('.', s:current_pos)
endif
unlet s:cursor_pos s:current_pos
endf
function! tcomment#SetOption(name, arg) "{{{3
" TLogVAR a:name, a:arg
if !exists('s:temp_options')
let s:temp_options = {}
endif
" if index(['count', 'as'], a:name) != -1
if empty(a:arg)
if has_key(s:temp_options, a:name)
call remove(s:temp_options, a:name)
endif
else
let s:temp_options[a:name] = a:arg
endif
" endif
endf endf
function! s:GetStartEnd(beg, end, commentMode) "{{{3 function! s:GetStartEnd(beg, end, commentMode) "{{{3
" TLogVAR a:beg, a:end, a:commentMode
if type(a:beg) == 3 if type(a:beg) == 3
let [lbeg, cbeg] = a:beg let [lbeg, cbeg] = a:beg
let [lend, cend] = a:end let [lend, cend] = a:end
@ -465,25 +613,27 @@ function! s:GetStartEnd(beg, end, commentMode) "{{{3
let lbeg = a:beg let lbeg = a:beg
let lend = a:end let lend = a:end
let commentMode = a:commentMode let commentMode = a:commentMode
if commentMode =~# 'R' || commentMode =~# 'I' " TLogVAR commentMode
if commentMode =~# 'R'
let cbeg = col('.')
let cend = 0
let commentMode = substitute(commentMode, '\CR', 'G', 'g')
elseif commentMode =~# 'I'
let cbeg = col("'<") let cbeg = col("'<")
if cbeg == 0 if cbeg == 0
let cbeg = col('.') let cbeg = col('.')
endif endif
if commentMode =~# 'R' let cend = col("'>")
let commentMode = substitute(commentMode, '\CR', 'G', 'g') if cend < col('$') && (commentMode =~# 'o' || &selection == 'inclusive')
let cend = 0 let cend += 1
else " TLogVAR cend, col('$')
let cend = col("'>")
if commentMode =~# 'o'
let cend += 1
endif
endif endif
else else
let cbeg = 0 let cbeg = 0
let cend = 0 let cend = 0
endif endif
endif endif
" TLogVAR lbeg, cbeg, lend, cend
return [lbeg, cbeg, lend, cend] return [lbeg, cbeg, lend, cend]
endf endf
@ -517,19 +667,34 @@ function! s:ParseArgs(beg, end, commentMode, arglist) "{{{3
for arg in a:arglist for arg in a:arglist
let key = matchstr(arg, '^[^=]\+') let key = matchstr(arg, '^[^=]\+')
let value = matchstr(arg, '=\zs.*$') let value = matchstr(arg, '=\zs.*$')
if key == 'as' if !empty(key)
call extend(args, s:GetCommentDefinitionForType(a:beg, a:end, a:commentMode, value))
else
let args[key] = value let args[key] = value
endif endif
endfor endfor
return args return s:ExtendCDef(a:beg, a:end, a:commentMode, {}, args)
endf
function! s:ExtendCDef(beg, end, commentMode, cdef, args)
for [key, value] in items(a:args)
if key == 'as'
call extend(a:cdef, s:GetCommentDefinitionForType(a:beg, a:end, a:commentMode, value))
elseif key == 'mode'
let a:cdef[key] = a:commentMode . value
elseif key == 'count'
let a:cdef[key] = str2nr(value)
else
let a:cdef[key] = value
endif
endfor
return a:cdef
endf endf
function! tcomment#Operator(type, ...) "{{{3 function! tcomment#Operator(type, ...) "{{{3
let commentMode = a:0 >= 1 ? a:1 : '' let commentMode = a:0 >= 1 ? a:1 : ''
let bang = a:0 >= 2 ? a:2 : '' let bang = a:0 >= 2 ? a:2 : ''
" TLogVAR a:type, commentMode, bang
if !exists('w:tcommentPos') if !exists('w:tcommentPos')
let w:tcommentPos = getpos(".") let w:tcommentPos = getpos(".")
endif endif
@ -537,7 +702,6 @@ function! tcomment#Operator(type, ...) "{{{3
set selection=inclusive set selection=inclusive
let reg_save = @@ let reg_save = @@
" let pos = getpos('.') " let pos = getpos('.')
" TLogVAR a:type
try try
if a:type == 'line' if a:type == 'line'
silent exe "normal! '[V']" silent exe "normal! '[V']"
@ -559,6 +723,7 @@ function! tcomment#Operator(type, ...) "{{{3
let lend = line("']") let lend = line("']")
let cbeg = col("'[") let cbeg = col("'[")
let cend = col("']") let cend = col("']")
" TLogVAR lbeg, lend, cbeg, cend
" echom "DBG tcomment#Operator" lbeg col("'[") col("'<") lend col("']") col("'>") " echom "DBG tcomment#Operator" lbeg col("'[") col("'<") lend col("']") col("'>")
norm!  norm! 
let commentMode .= g:tcommentOpModeExtra let commentMode .= g:tcommentOpModeExtra
@ -666,7 +831,7 @@ endf
" :nodoc: " :nodoc:
function! tcomment#CompleteArgs(ArgLead, CmdLine, CursorPos) "{{{3 function! tcomment#CompleteArgs(ArgLead, CmdLine, CursorPos) "{{{3
let completions = ['as=', 'col=', 'count=', 'mode=', 'begin=', 'end='] let completions = ['as=', 'col=', 'count=', 'mode=', 'begin=', 'end=', 'rxbeg=', 'rxend=', 'rxmid=']
if !empty(a:ArgLead) if !empty(a:ArgLead)
if a:ArgLead =~ '^as=' if a:ArgLead =~ '^as='
call tcomment#CollectFileTypes() call tcomment#CollectFileTypes()
@ -685,11 +850,12 @@ endf
function! s:GetCommentDefinitionForType(beg, end, commentMode, filetype) "{{{3 function! s:GetCommentDefinitionForType(beg, end, commentMode, filetype) "{{{3
let cdef = s:GetCommentDefinition(a:beg, a:end, a:commentMode, a:filetype) let cdef = s:GetCommentDefinition(a:beg, a:end, a:commentMode, a:filetype)
" TLogVAR cdef
let cms = cdef.commentstring let cms = cdef.commentstring
let commentMode = cdef.mode let commentMode = cdef.mode
let pre = substitute(cms, '%s.*$', '', '') let pre = substitute(cms, '%\@<!%s.*$', '', '')
let pre = substitute(pre, '%%', '%', 'g') let pre = substitute(pre, '%%', '%', 'g')
let post = substitute(cms, '^.\{-}%s', '', '') let post = substitute(cms, '^.\{-}%\@<!%s', '', '')
let post = substitute(post, '%%', '%', 'g') let post = substitute(post, '%%', '%', 'g')
let cdef.begin = pre let cdef.begin = pre
let cdef.end = post let cdef.end = post
@ -705,14 +871,17 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
else else
let cdef = {'mode': a:commentMode} let cdef = {'mode': a:commentMode}
endif endif
" TLogVAR cdef
let cms = get(cdef, 'commentstring', '') let cms = get(cdef, 'commentstring', '')
if empty(cms) if empty(cms)
let filetype = s:Filetype() let filetype = s:Filetype()
if exists('b:commentstring') if exists('b:commentstring')
let cms = b:commentstring let cms = b:commentstring
" TLogVAR 1, cms
return s:GetCustomCommentString(filetype, a:commentMode, cms) return s:GetCustomCommentString(filetype, a:commentMode, cms)
elseif exists('b:commentStart') && b:commentStart != '' elseif exists('b:commentStart') && b:commentStart != ''
let cms = s:EncodeCommentPart(b:commentStart) .' %s' let cms = s:EncodeCommentPart(b:commentStart) .' %s'
" TLogVAR 2, cms
if exists('b:commentEnd') && b:commentEnd != '' if exists('b:commentEnd') && b:commentEnd != ''
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd) let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
endif endif
@ -724,6 +893,7 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
else else
let altFiletype = g:tcommentGuessFileType_{filetype} let altFiletype = g:tcommentGuessFileType_{filetype}
endif endif
" TLogVAR altFiletype
return s:GuessFileType(a:beg, a:end, a:commentMode, filetype, altFiletype) return s:GuessFileType(a:beg, a:end, a:commentMode, filetype, altFiletype)
else else
return s:GetCustomCommentString(filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode)) return s:GetCustomCommentString(filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
@ -734,6 +904,7 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
endf endf
function! s:StartPosRx(mode, line, col) function! s:StartPosRx(mode, line, col)
" TLogVAR a:mode, a:line, a:col
if a:mode =~# 'I' if a:mode =~# 'I'
return s:StartLineRx(a:line) . s:StartColRx(a:col) return s:StartLineRx(a:line) . s:StartColRx(a:col)
else else
@ -824,19 +995,31 @@ function! s:ProcessedLine(uncomment, match, checkRx, replace)
let ml = len(a:match) let ml = len(a:match)
if a:uncomment if a:uncomment
let rv = substitute(a:match, a:checkRx, '\1\2', '') let rv = substitute(a:match, a:checkRx, '\1\2', '')
let rv = s:UnreplaceInLine(rv)
else else
let rv = printf(a:replace, a:match) let rv = s:ReplaceInLine(a:match)
let rv = printf(a:replace, rv)
endif endif
" TLogVAR rv " TLogVAR rv
" let md = len(rv) - ml " let md = len(rv) - ml
let s:pos_end = getpos('.') if s:cdef.mode =~ '>'
let s:pos_end[2] += len(rv) let s:cursor_pos = getpos('.')
let s:cursor_pos[2] += len(rv)
elseif s:cdef.mode =~ '#'
if empty(s:cursor_pos)
let prefix_len = match(a:replace, '%\@<!%s')
if prefix_len != -1
let s:cursor_pos = copy(s:current_pos)
let s:cursor_pos[2] += prefix_len
endif
endif
endif
" TLogVAR pe, md, a:match " TLogVAR pe, md, a:match
" TLogVAR rv " TLogVAR rv
if v:version > 702 || (v:version == 702 && has('patch407')) if v:version > 702 || (v:version == 702 && has('patch407'))
let rv = escape(rv, ' ') let rv = escape(rv, "\r")
else else
let rv = escape(rv, '\ ') let rv = escape(rv, "\\r")
endif endif
" TLogVAR rv " TLogVAR rv
" let rv = substitute(rv, '\n', '\\\n', 'g') " let rv = substitute(rv, '\n', '\\\n', 'g')
@ -844,19 +1027,43 @@ function! s:ProcessedLine(uncomment, match, checkRx, replace)
return rv return rv
endf endf
" function! s:CommentLines(beg, end, cstart, cend, uncomment, cmtCheck, cms0, indentStr) "{{{3
" " We want commented lines function! s:ReplaceInLine(text) "{{{3
" " final search pattern for uncommenting if has_key(s:cdef, 'replacements')
" let cmtCheck = escape('\V\^\(\s\{-}\)'. a:cmtCheck .'\$', '"/\') let text = a:text
" " final pattern for commenting " TLogVAR text
" let cmtReplace = escape(a:cms0, '"/') for [token, substitution] in items(s:cdef.replacements)
" silent exec a:beg .','. a:end .'s/\V'. let text = substitute(text, '\V'. escape(token, '\'), substitution, 'g')
" \ s:StartColRx(a:cstart) . a:indentStr .'\zs\(\.\{-}\)'. s:EndColRx(a:cend) .'/'. " TLogVAR token, substitution, text
" \ '\=s:ProcessedLine('. a:uncomment .', submatch(0), "'. a:cmtCheck .'", "'. cmtReplace .'")/ge' endfor
" endf " TLogVAR text
return text
else
return a:text
endif
endf
function! s:UnreplaceInLine(text) "{{{3
if has_key(s:cdef, 'replacements')
let text = a:text
" TLogVAR text
for [substitution, token] in items(s:cdef.replacements)
" TLogVAR substitution, token
let text = substitute(text, '\V'. escape(token, '\'), substitution, 'g')
endfor
return text
else
return a:text
endif
endf
function! s:CommentBlock(beg, end, uncomment, checkRx, cdef, indentStr) function! s:CommentBlock(beg, end, uncomment, checkRx, cdef, indentStr)
" TLogVAR a:beg, a:end, a:uncomment, a:checkRx, a:cdef, a:indentStr
let t = @t let t = @t
let sel_save = &selection
set selection=exclusive
try try
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td' silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
let ms = s:BlockGetMiddleString(a:cdef) let ms = s:BlockGetMiddleString(a:cdef)
@ -870,7 +1077,7 @@ function! s:CommentBlock(beg, end, uncomment, checkRx, cdef, indentStr)
let @t = substitute(@t, '\n\s*$', '', '') let @t = substitute(@t, '\n\s*$', '', '')
else else
let cs = s:BlockGetCommentString(a:cdef) let cs = s:BlockGetCommentString(a:cdef)
let cs = a:indentStr . substitute(cs, '%s', '%s'. a:indentStr, '') let cs = a:indentStr . substitute(cs, '%\@<!%s', '%s'. a:indentStr, '')
if ms != '' if ms != ''
let ms = a:indentStr . ms let ms = a:indentStr . ms
let mx = a:indentStr . mx let mx = a:indentStr . mx
@ -881,6 +1088,7 @@ function! s:CommentBlock(beg, end, uncomment, checkRx, cdef, indentStr)
endif endif
silent norm! "tP silent norm! "tP
finally finally
let &selection = sel_save
let @t = t let @t = t
endtry endtry
endf endf
@ -893,28 +1101,99 @@ function! s:Filetype(...) "{{{3
endf endf
" A function that makes the s:GuessFileType() function usable for other
" library developers.
"
" The argument is a dictionary with the following keys:
"
" beg ................ (default = line("."))
" end ................ (default = line("."))
" commentMode ........ (default = "G")
" filetype ........... (default = &filetype)
" fallbackFiletype ... (default = "")
"
" This function return a dictionary that contains information about how
" to make comments. The information about the filetype of the text
" between lines "beg" and "end" is in the "filetype" key of the return
" value. It returns the first discernible filetype it encounters.
" :display: tcomment#GuessFileType(?options={})
function! tcomment#GuessCommentType(...) "{{{3
let options = a:0 >= 1 ? a:1 : {}
let beg = get(options, 'beg', line('.'))
let end = get(options, 'end', line('.'))
let commentMode = get(options, 'commentMode', '')
let filetype = get(options, 'filetype', &filetype)
let fallbackFiletype = get(options, 'filetype', '')
return s:GuessFileType(beg, end, commentMode, filetype, fallbackFiletype)
endf
" inspired by Meikel Brandmeyer's EnhancedCommentify.vim " inspired by Meikel Brandmeyer's EnhancedCommentify.vim
" this requires that a syntax names are prefixed by the filetype name " this requires that a syntax names are prefixed by the filetype name
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype) " s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
function! s:GuessFileType(beg, end, commentMode, filetype, ...) function! s:GuessFileType(beg, end, commentMode, filetype, ...)
" TLogVAR a:beg, a:end, a:commentMode, a:filetype, a:000
if a:0 >= 1 && a:1 != '' if a:0 >= 1 && a:1 != ''
let cdef = s:GetCustomCommentString(a:1, a:commentMode) let cdef = s:GetCustomCommentString(a:1, a:commentMode)
if empty(get(cdef, 'commentstring', '')) if empty(get(cdef, 'commentstring', ''))
let cdef.commentstring = s:GuessCurrentCommentString(a:commentMode) let cdef.commentstring = s:GuessCurrentCommentString(a:commentMode)
endif endif
else else
let cdef = {'commentstring': s:GuessCurrentCommentString(0), 'mode': s:CommentMode(a:commentMode, 'G')} let cdef = s:GetCustomCommentString(a:filetype, a:commentMode)
if !has_key(cdef, 'commentstring')
let cdef = {'commentstring': s:GuessCurrentCommentString(0), 'mode': s:CommentMode(a:commentMode, 'G')}
endif
endif endif
let n = a:beg let beg = a:beg
" TLogVAR n, a:beg, a:end let end = nextnonblank(a:end)
while n <= a:end if end == 0
let end = a:end
let beg = prevnonblank(a:beg)
if beg == 0
let beg = a:beg
endif
endif
let n = beg
" TLogVAR n, beg, end
while n <= end
let m = indent(n) + 1 let m = indent(n) + 1
let le = len(getline(n)) let text = getline(n)
let le = len(text)
" TLogVAR m, le " TLogVAR m, le
while m < le while m <= le
let syntaxName = s:GetSyntaxName(n, m) let syntaxName = s:GetSyntaxName(n, m)
" TLogVAR syntaxName, n, m " TLogVAR syntaxName, n, m
let ftypeMap = get(g:tcommentSyntaxMap, syntaxName) let ftypeMap = get(g:tcommentSyntaxMap, syntaxName, '')
" TLogVAR ftypeMap
if !empty(ftypeMap) && type(ftypeMap) == 4
if n < a:beg
let key = 'prevnonblank'
elseif n > a:end
let key = 'nextnonblank'
else
let key = ''
endif
if empty(key) || !has_key(ftypeMap, key)
let ftypeftype = get(ftypeMap, 'filetype', {})
" TLogVAR ftypeMap, ftypeftype
unlet! ftypeMap
let ftypeMap = get(ftypeftype, a:filetype, '')
else
let mapft = ''
for mapdef in ftypeMap[key]
if strpart(text, m - 1) =~ '^'. mapdef.match
let mapft = mapdef.filetype
break
endif
endfor
unlet! ftypeMap
if empty(mapft)
let ftypeMap = ''
else
let ftypeMap = mapft
endif
endif
endif
if !empty(ftypeMap) if !empty(ftypeMap)
" TLogVAR ftypeMap " TLogVAR ftypeMap
return s:GetCustomCommentString(ftypeMap, a:commentMode, cdef.commentstring) return s:GetCustomCommentString(ftypeMap, a:commentMode, cdef.commentstring)
@ -934,6 +1213,7 @@ function! s:GuessFileType(beg, end, commentMode, filetype, ...)
endwh endwh
let n += 1 let n += 1
endwh endwh
" TLogVAR cdef
return cdef return cdef
endf endf
@ -957,7 +1237,8 @@ function! s:CommentMode(commentMode, newmode) "{{{3
endf endf
function! s:GuessCurrentCommentString(commentMode) function! s:GuessCurrentCommentString(commentMode)
let valid_cms = (stridx(&commentstring, '%s') != -1) " TLogVAR a:commentMode
let valid_cms = (match(&commentstring, '%\@<!%s') != -1)
if &commentstring != s:defaultCommentString && valid_cms if &commentstring != s:defaultCommentString && valid_cms
" The &commentstring appears to have been set and to be valid " The &commentstring appears to have been set and to be valid
return &commentstring return &commentstring
@ -1012,24 +1293,32 @@ endf
" s:GetCustomCommentString(ft, commentMode, ?default="") " s:GetCustomCommentString(ft, commentMode, ?default="")
function! s:GetCustomCommentString(ft, commentMode, ...) function! s:GetCustomCommentString(ft, commentMode, ...)
" TLogVAR a:ft, a:commentMode, a:000
let commentMode = a:commentMode let commentMode = a:commentMode
let customComment = tcomment#TypeExists(a:ft) let customComment = tcomment#TypeExists(a:ft)
if commentMode =~# 'B' && tcomment#TypeExists(a:ft .'_block') if commentMode =~# 'B' && tcomment#TypeExists(a:ft .'_block')
let def = s:definitions[a:ft .'_block'] let def = s:definitions[a:ft .'_block']
" TLogVAR 1, def
elseif commentMode =~? 'I' && tcomment#TypeExists(a:ft .'_inline') elseif commentMode =~? 'I' && tcomment#TypeExists(a:ft .'_inline')
let def = s:definitions[a:ft .'_inline'] let def = s:definitions[a:ft .'_inline']
" TLogVAR 2, def
elseif customComment elseif customComment
let def = s:definitions[a:ft] let def = s:definitions[a:ft]
let commentMode = s:CommentMode(commentMode, 'G') let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 3, def
elseif a:0 >= 1 elseif a:0 >= 1
let def = {'commentstring': a:1} let def = {'commentstring': a:1}
let commentMode = s:CommentMode(commentMode, 'G') let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 4, def
else else
let def = {} let def = {}
let commentMode = s:CommentMode(commentMode, 'G') let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 5, def
endif endif
let cdef = copy(def) let cdef = copy(def)
let cdef.mode = commentMode let cdef.mode = commentMode
let cdef.filetype = a:ft
" TLogVAR cdef
return cdef return cdef
endf endf
@ -1071,3 +1360,4 @@ endf
redraw redraw
" vi: ft=vim:tw=72:ts=4:fo=w2croql

View File

@ -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> Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first) (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 || || 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 || || | | C cycle through separator patterns. Patterns are ||
|| | | |regexp| and are active sequentially. || || | | |regexp| and are active sequentially. ||
|| | | || || | | ||
|| | < | < left justify separator Separators are justified, || || | < | < left justify separator Separators are justified, ||
|| | | > right justify separator too. Separator styles || || | | > 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 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: 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) 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 This command doesn't do the alignment operation itself; instead, it
controls subsequent alignment operation(s). controls subsequent alignment operation(s).
@ -756,7 +756,7 @@ ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{
and :AlignCtrl will then be defined. 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 Once the alignment control has been determined, the user specifies a
range of lines for the Align command/function to do its thing. 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| \adcom: useful for aligning comments in declarations |alignmap-adcom|
\anum : useful for aligning numbers |alignmap-anum| \anum : useful for aligning numbers |alignmap-anum|
NOTE: For the visual-mode use of \anum, <vis.vim> is needed! 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| \aenum: align a European-style number |alignmap-anum|
\aunum: align a USA-style number |alignmap-anum| \aunum: align a USA-style number |alignmap-anum|
\adec : useful for aligning declarations |alignmap-adec| \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 an AlignMap with the vis.vim plugin, available at either
stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195 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 > Use it with commands such as >
@ -1400,194 +1400,202 @@ ALIGNMENT *align-align* {{{2
4. Alignment Tools' History *align-history* {{{1 4. Alignment Tools' History *align-history* {{{1
ALIGN HISTORY {{{2 ALIGN HISTORY {{{2
36 : May 20, 2009 * Previously, the "W" AlignCtrl setting, intended v37 Nov 29, 2012 * (Kim Jang-hwan) reported that with g:Align_xstrlen
to retain initial white space, did so by convert- set to 3 that the cursor was moved (linewise)
ing any leading tabs into an equivalent quantity after invocation. Fixed.
of blanks (using the current tabstop setting). Jan 07, 2013 * now has visual mode mappings to accompany all
Align will now retain leading tabs. normal mode mappings (use |V| to invoke)
Nov 24, 2009 * QArgSplitter() used split(), intending to split v36 May 20, 2009 * Previously, the "W" AlignCtrl setting, intended
on white space only. However, the \tab map to retain initial white space, did so by convert-
uses ctrl-o as a separator instead of tabs; the ing any leading tabs into an equivalent quantity
split() function treated the ctrl-o as a whitespace of blanks (using the current tabstop setting).
character, too. Solution: give split() an explicit Align will now retain leading tabs.
pattern matching blanks and tabs, only. \tab now Nov 24, 2009 * QArgSplitter() used split(), intending to split
works again! on white space only. However, the \tab map
Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support uses ctrl-o as a separator instead of tabs; the
May 10, 2011 * if the range is only one line, then Align will split() function treated the ctrl-o as a whitespace
automatically grow the range to accommodate all character, too. Solution: give split() an explicit
lines containing the first separator pattern pattern matching blanks and tabs, only. \tab now
surrounding the current line. works again!
Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support
specify a function by name which computes string May 10, 2011 * if the range is only one line, then Align will
length. automatically grow the range to accommodate all
Oct 27, 2011 * (reported by Fco Javier) reported a problem with lines containing the first separator pattern
the default s:Strlen() result; there was a missing surrounding the current line.
"let". Fixed. Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to
Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when specify a function by name which computes string
it should've been doing "setlocal noet". length.
Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when Oct 27, 2011 * (reported by Fco Javier) reported a problem with
g:Align_xstrlen is zero. the default s:Strlen() result; there was a missing
35 : Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading "let". Fixed.
installed Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when
Nov 19, 2008 * new sanity check for an AlignStyle of just ":" it should've been doing "setlocal noet".
Jan 08, 2009 * save&restore of |'mod'| now done with local Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when
variant g:Align_xstrlen is zero.
34 : Jul 08, 2008 * using :AlignCtrl before entering any alignment v35 Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading
control commands was causing an error. installed
33 : Sep 20, 2007 * s:Strlen() introduced to support various ways Nov 19, 2008 * new sanity check for an AlignStyle of just ":"
used to represent characters and their effects Jan 08, 2009 * save&restore of |'mod'| now done with local
on string lengths. See |align-strlen|. variant
* Align now accepts "..." -- so it can accept v34 Jul 08, 2008 * using :AlignCtrl before entering any alignment
whitespace as separators. control commands was causing an error.
32 : Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a v33 Sep 20, 2007 * s:Strlen() introduced to support various ways
custom argument splitter to allow patterns with used to represent characters and their effects
backslashes to slide in unaltered. on string lengths. See |align-strlen|.
31 : Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s) * Align now accepts "..." -- so it can accept
implemented. whitespace as separators.
30 : Feb 12, 2007 * now uses |setline()| v32 Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a
29 : Jan 18, 2006 * cecutil updated to use keepjumps custom argument splitter to allow patterns with
Feb 23, 2006 * Align now converted to vim 7.0 style using backslashes to slide in unaltered.
auto-loading functions. v31 Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s)
28 : Aug 17, 2005 * report option workaround implemented.
Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed v30 Feb 12, 2007 * now uses |setline()|
27 : Apr 15, 2005 : cpo workaround v29 Jan 18, 2006 * cecutil updated to use keepjumps
ignorecase workaround Feb 23, 2006 * Align now converted to vim 7.0 style using
26 : Aug 20, 2004 : loaded_align now also indicates version number auto-loading functions.
GetLatestVimScripts :AutoInstall: now supported v28 Aug 17, 2005 * report option workaround
25 : Jul 27, 2004 : For debugging, uses Dfunc(), Dret(), and Decho() Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed
24 : Mar 03, 2004 : (should've done this earlier!) visualmode(1) v27 Apr 15, 2005 * cpo workaround
not supported until v6.2, now Align will avoid ignorecase workaround
calling it for earlier versions. Visualmode v26 Aug 20, 2004 * loaded_align now also indicates version number
clearing won't take place then, of course. GetLatestVimScripts :AutoInstall: now supported
23 : Oct 07, 2003 : Included Leif Wickland's ReplaceQuotedSpaces() v25 Jul 27, 2004 * For debugging, uses Dfunc(), Dret(), and Decho()
function which supports \tsq v24 Mar 03, 2004 * (should've done this earlier!) visualmode(1)
22 : Jan 29, 2003 : Now requires 6.1.308 or later to clear visualmode() not supported until v6.2, now Align will avoid
21 : Jan 10, 2003 : BugFix: similar problem to #19; new code calling it for earlier versions. Visualmode
bypasses "norm! v\<Esc>" until initialization clearing won't take place then, of course.
is over. v23 Oct 07, 2003 * Included Leif Wickland's ReplaceQuotedSpaces()
20 : Dec 30, 2002 : BugFix: more on "unable to highlight" fixed function which supports \tsq
19 : Nov 21, 2002 : BugFix: some terminals gave an "unable to highlight" v22 Jan 29, 2003 * Now requires 6.1.308 or later to clear visualmode()
message at startup; Hari Krishna Dara tracked it v21 Jan 10, 2003 * BugFix: similar problem to #19; new code
down; a silent! now included to prevent noise. bypasses "norm! v\<Esc>" until initialization
18 : Nov 04, 2002 : BugFix: re-enabled anti-repeated-loading is over.
17 : Nov 04, 2002 : BugFix: forgot to have AlignPush() push s:AlignSep v20 Dec 30, 2002 * BugFix: more on "unable to highlight" fixed
AlignCtrl now clears visual-block mode when used so v19 Nov 21, 2002 * BugFix: some terminals gave an "unable to highlight"
that Align won't try to use old visual-block message at startup; Hari Krishna Dara tracked it
selection marks '< '> down; a silent! now included to prevent noise.
16 : Sep 18, 2002 : AlignCtrl <>| options implemented (separator v18 Nov 04, 2002 * BugFix: re-enabled anti-repeated-loading
justification) v17 Nov 04, 2002 * BugFix: forgot to have AlignPush() push s:AlignSep
15 : Aug 22, 2002 : bug fix: AlignCtrl's ":" now acts as a modifier of AlignCtrl now clears visual-block mode when used so
the preceding alignment operator (lrc) that Align won't try to use old visual-block
14 : Aug 20, 2002 : bug fix: AlignCtrl default now keeps &ic unchanged selection marks '< '>
bug fix: Align, on end-field, wasn't using correct v16 Sep 18, 2002 * AlignCtrl <>| options implemented (separator
alignop bug fix: Align, on end-field, was appending justification)
padding v15 Aug 22, 2002 * bug fix: AlignCtrl's ":" now acts as a modifier of
13 : Aug 19, 2002 : bug fix: zero-length g/v patterns are accepted the preceding alignment operator (lrc)
bug fix: always skip blank lines v14 Aug 20, 2002 * bug fix: AlignCtrl default now keeps &ic unchanged
bug fix: AlignCtrl default now also clears g and v bug fix: Align, on end-field, wasn't using correct
patterns alignop bug fix: Align, on end-field, was appending
12 : Aug 16, 2002 : moved keep_ic above zero-length pattern checks padding
added "AlignCtrl default" v13 Aug 19, 2002 * bug fix: zero-length g/v patterns are accepted
fixed bug with last field getting separator spaces bug fix: always skip blank lines
at end line bug fix: AlignCtrl default now also clears g and v
11 : Jul 08, 2002 : prevent separator patterns which match zero length patterns
-+: included as additional alignment/justification v12 Aug 16, 2002 * moved keep_ic above zero-length pattern checks
styles added "AlignCtrl default"
10 : Jun 26, 2002 : =~# used instead of =~ (for matching case) fixed bug with last field getting separator spaces
ignorecase option handled at end line
9 : Jun 25, 2002 : implemented cyclic padding 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 ALIGNMENT MAP HISTORY *alignmap-history* {{{2
v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum v43 Nov 28, 2012 * changed a lot of maps to use nnoremap (instead
Feb 16, 2010 * map for \t=, \T= now handles x++ = something; of map)
for c, c++ correctly. Jan 07, 2013 *
Oct 29, 2010 * added a note on having one's own default v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum
AlignCtrl (see |alignctrl-init|) Feb 16, 2010 * map for \t=, \T= now handles x++ = something;
Feb 22, 2011 * for menus, &go =~# used to insure correct case for c, c++ correctly.
Jun 10, 2011 * |:AlignMapsClean| command provided to make it Oct 29, 2010 * added a note on having one's own default
easy for those who would prefer not to have AlignCtrl (see |alignctrl-init|)
AlignMaps' maps not to have them. Feb 22, 2011 * for menus, &go =~# used to insure correct case
v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent Jun 10, 2011 * |:AlignMapsClean| command provided to make it
re-loading installed easy for those who would prefer not to have
* AlignMaps now use 0x0f (ctrl-p) for special AlignMaps' maps not to have them.
character substitutions (instead of 0xff). v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent
Seems to avoid some problems with having to re-loading installed
use Strlen(). * AlignMaps now use 0x0f (ctrl-p) for special
* bug fixed with \ts, character substitutions (instead of 0xff).
* new maps: \ts; \ts, \ts: \ts< \ts= \a( Seems to avoid some problems with having to
v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s use Strlen().
and <script>s. \t@ and related maps have been * bug fixed with \ts,
changed to call StdAlign() instead. The * new maps: \ts; \ts, \ts: \ts< \ts= \a(
WrapperStart function now takes an argument and v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s
handles being called via visual mode. The and <script>s. \t@ and related maps have been
former nmaps and vmaps have thus been replaced changed to call StdAlign() instead. The
with a simple map. WrapperStart function now takes an argument and
Oct 24, 2008 * broke AlignMaps into a plugin and autoload handles being called via visual mode. The
pair of scripts. former nmaps and vmaps have thus been replaced
v39 Mar 06, 2008 : * \t= only does /* ... */ aligning when in *.c with a simple map.
*.cpp files. Oct 24, 2008 * broke AlignMaps into a plugin and autoload
v38 Aug 18, 2007 : * \tt altered so that it works with the new pair of scripts.
use of |<q-args>| plus a custom argument v39 Mar 06, 2008 * \t= only does /* ... */ aligning when in *.c
splitter *.cpp files.
v36 Sep 27, 2006 : * AlignWrapperStart() now has tests that marks v38 Aug 18, 2007 * \tt altered so that it works with the new
y and z are not set use of |<q-args>| plus a custom argument
May 15, 2007 * \anum and variants improved splitter
v35 Sep 01, 2006 : * \t= and cousins used "`"s. They now use \xff v36 Sep 27, 2006 * AlignWrapperStart() now has tests that marks
characters. y and z are not set
* \acom now works with doxygen style /// comments May 15, 2007 * \anum and variants improved
* <char-0xff> used in \t= \T= \w= and \m= instead v35 Sep 01, 2006 * \t= and cousins used "`"s. They now use \xff
of backquotes. characters.
v34 Feb 23, 2006 : * AlignMaps now converted to vim 7.0 style using * \acom now works with doxygen style /// comments
auto-loading functions. * <char-0xff> used in \t= \T= \w= and \m= instead
v33 Oct 12, 2005 : * \ts, now uses P1 in its AlignCtrl call of backquotes.
v32 Jun 28, 2005 : * s:WrapperStart() changed to AlignWrapperStart() v34 Feb 23, 2006 * AlignMaps now converted to vim 7.0 style using
s:WrapperEnd() changed to AlignWrapperEnd() auto-loading functions.
These changes let the AlignWrapper...()s to be v33 Oct 12, 2005 * \ts, now uses P1 in its AlignCtrl call
used outside of AlignMaps.vim v32 Jun 28, 2005 * s:WrapperStart() changed to AlignWrapperStart()
v31 Feb 01, 2005 : * \adcom included, with help s:WrapperEnd() changed to AlignWrapperEnd()
* \a, now works across multiple lines with These changes let the AlignWrapper...()s to be
different types used outside of AlignMaps.vim
* AlignMaps now uses <cecutil.vim> for its mark and v31 Feb 01, 2005 * \adcom included, with help
window-position saving and restoration * \a, now works across multiple lines with
Mar 04, 2005 * improved \a, different types
Apr 06, 2005 * included \aenum, \aunum, and provided * AlignMaps now uses <cecutil.vim> for its mark and
g:alignmaps_{usa|euro]number} options window-position saving and restoration
v30 Aug 20, 2004 : * \a, : handles embedded assignments and does \adec Mar 04, 2005 * improved \a,
* \acom now can handle Doxygen-style comments Apr 06, 2005 * included \aenum, \aunum, and provided
* g:loaded_alignmaps now also indicates version g:alignmaps_{usa|euro]number} options
* internal maps \WE and \WS are now re-entrant v30 Aug 20, 2004 * * \a, : handles embedded assignments and does \adec
v29 Jul 27, 2004 : * \tml aligns trailing multi-line single * \acom now can handle Doxygen-style comments
backslashes (thanks to Raul Benavente!) * g:loaded_alignmaps now also indicates version
v28 May 13, 2004 : * \a, had problems with leading blanks; fixed! * internal maps \WE and \WS are now re-entrant
v27 Mar 31, 2004 : * \T= was having problems with == and != v29 Jul 27, 2004 * \tml aligns trailing multi-line single
* Fixed more problems with \adec backslashes (thanks to Raul Benavente!)
v26 Dec 09, 2003 : * \ascom now also ignores lines without comments v28 May 13, 2004 * \a, had problems with leading blanks; fixed!
* \tt \& now not matched v27 Mar 31, 2004 * \T= was having problems with == and !=
* \a< handles both << and >> * Fixed more problems with \adec
v25 Nov 14, 2003 : * included \anum (aligns numbers with periods and v26 Dec 09, 2003 * \ascom now also ignores lines without comments
commas). \anum also supported with ctrl-v mode. * \tt \& now not matched
* \ts, \Ts, : (aligns on commas, then swaps leading * \a< handles both << and >>
spaces with commas) v25 Nov 14, 2003 * included \anum (aligns numbers with periods and
* \adec ignores preprocessor lines and lines with commas). \anum also supported with ctrl-v mode.
with comments-only * \ts, \Ts, : (aligns on commas, then swaps leading
v23 Sep 10, 2003 : * Bugfix for \afnc - no longer overwrites marks y,z spaces with commas)
* fixed bug in \tsp, \tab, \Tsp, and \Tab - lines * \adec ignores preprocessor lines and lines with
containing backslashes were having their with comments-only
backslashes removed. Included Leif Wickland's v23 Sep 10, 2003 * Bugfix for \afnc - no longer overwrites marks y,z
patch for \tsq. * fixed bug in \tsp, \tab, \Tsp, and \Tab - lines
* \adef now ignores lines holding comments only containing backslashes were having their
v18 Aug 22, 2003 : \a< lines up C++'s << operators backslashes removed. Included Leif Wickland's
saves/restores gdefault option (sets to nogd) patch for \tsq.
all b:..varname.. are now b:alignmaps_..varname.. * \adef now ignores lines holding comments only
v17 Nov 04, 2002 : \afnc now handles // comments correctly and v18 Aug 22, 2003 * \a< lines up C++'s << operators
commas within comments saves/restores gdefault option (sets to nogd)
v16 Sep 10, 2002 : changed : to :silent! for \adec all b:..varname.. are now b:alignmaps_..varname..
v15 Aug 27, 2002 : removed some <c-v>s v17 Nov 04, 2002 * \afnc now handles // comments correctly and
v14 Aug 20, 2002 : \WS, \WE mostly moved to functions, marks y and z commas within comments
now restored v16 Sep 10, 2002 * changed : to :silent! for \adec
v11 Jul 08, 2002 : \abox bug fix v15 Aug 27, 2002 * removed some <c-v>s
v9 Jun 25, 2002 : \abox now handles leading initial whitespace v14 Aug 20, 2002 * \WS, \WE mostly moved to functions, marks y and z
: various bugfixes to \afnc, \T=, etc 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 Modelines: {{{1

View File

@ -1,102 +1,117 @@
*logipat.txt* Logical Patterns Aug 09, 2005 *logipat.txt* Logical Patterns Mar 13, 2013
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright* Copyright: (c) 2004-2013 by Charles E. Campbell *logipat-copyright*
The VIM LICENSE applies to LogiPat.vim and LogiPat.txt The VIM LICENSE applies to LogiPat.vim and LogiPat.txt
(see |copyright|) except use "LogiPat" instead of "Vim" (see |copyright|) except use "LogiPat" instead of "Vim"
No warranty, express or implied. Use At-Your-Own-Risk. No warranty, express or implied. Use At-Your-Own-Risk.
============================================================================== ==============================================================================
1. Contents *logipat* 1. Contents *logipat* *logipat-contents*
1. Contents.................: |logipat-contents| 1. Contents.................: |logipat-contents|
2. LogiPat Manual...........: |logipat-manual| 2. LogiPat Manual...........: |logipat-manual|
3. LogiPat Examples.........: |logipat-examples| 3. LogiPat Examples.........: |logipat-examples|
4. Caveat...................: |logipat-caveat| 4. Caveat...................: |logipat-caveat|
5. LogiPat History..........: |logipat-history| 5. LogiPat History..........: |logipat-history|
============================================================================== ==============================================================================
2. LogiPat Manual *logipat-manual* *logipat-man* 2. LogiPat Manual *logipat-manual* *logipat-man*
*logipat-arg* *logipat-input* *logipat-pattern* *logipat-operators* *logipat-arg* *logipat-input* *logipat-pattern* *logipat-operators*
Boolean logic patterns are composed of Boolean logic patterns are composed of
operators ! = not operators ! = not
| = logical-or | = logical-or
& = logical-and & = logical-and
grouping ( ... ) grouping ( ... )
patterns "pattern" patterns "pattern"
:LogiPat {boolean-logic pattern} *:LogiPat* :LogiPat {boolean-logic pattern} *:LogiPat*
:LogiPat is a command which takes a boolean-logic :LogiPat is a command which takes a boolean-logic
argument (|logipat-arg|). argument (|logipat-arg|).
:LP {boolean-logic pattern} *:LP* :LP {boolean-logic pattern} *:LP*
:LP is a shorthand command version of :LogiPat :LP is a shorthand command version of :LogiPat
(|logipat-cmd|). (|logipat-cmd|).
:LogiPatFlags {search flags} *LogiPat-flags* :ELP {boolean-logic pattern} *:ELP*
:LogiPatFlags {search flags} No search is done, but the conversion from the
LogiPat uses the |search()| command. The flags boolean logic pattern to the regular expression
passed to that call to search() may be specified is performed and echoed onto the display.
by the :LogiPatFlags command.
:LogiPatFlags {search flags} *LogiPat-flags*
:LPF {search flags} *:LPF* :LogiPatFlags {search flags}
:LPF is a shorthand version of :LogiPatFlags. LogiPat uses the |search()| command. The flags
passed to that call to search() may be specified
:let pat=LogiPat({boolean-logic pattern}) *LogiPat()* by the :LogiPatFlags command.
If one calls LogiPat() directly, no search
is done, but the transformation from the boolean :LPF {search flags} *:LPF*
logic pattern into a regular expression pattern :LPF is a shorthand version of :LogiPatFlags.
is performed and returned.
:let pat=LogiPat({boolean-logic pattern}) *LogiPat()*
============================================================================== If one calls LogiPat() directly, no search
3. LogiPat Examples *logipat-examples* is done, but the transformation from the boolean
logic pattern into a regular expression pattern
LogiPat takes Boolean logic arguments and produces a regular is performed and returned.
expression which implements the choices. A series of examples
follow: To get a " inside a pattern, as opposed to having it delimit
> the pattern, double it.
:LogiPat "abc"
< will search for lines containing the string "abc" ==============================================================================
> 3. LogiPat Examples *logipat-examples*
:LogiPat !"abc"
< will search for lines which don't contain the string "abc" LogiPat takes Boolean logic arguments and produces a regular
> expression which implements the choices. A series of examples
:LogiPat "abc"|"def" follows:
< will search for lines which contain either the string >
"abc" or the string "def" :LogiPat "abc"
> < will search for lines containing the string :abc:
:LogiPat !("abc"|"def") >
< will search for lines which don't contain either :LogiPat "ab""cd"
of the strings "abc" or "def" < will search for lines containing the string :ab"c:
> >
:LogiPat "abc"&"def" :LogiPat !"abc"
< will search for lines which contain both of the strings < will search for lines which don't contain the string :abc:
"abc" and "def" >
> :LogiPat "abc"|"def"
:let pat= LogiPat('!"abc"') < will search for lines which contain either the string
< will return the regular expression which will match :abc: or the string :def:
all lines not containing "abc". The double quotes >
are needed to pass normal patterns to LogiPat, and :LogiPat !("abc"|"def")
differentiate such patterns from boolean logic < will search for lines which don't contain either
operators. of the strings :abc: or :def:
>
:LogiPat "abc"&"def"
============================================================================== < will search for lines which contain both of the strings
4. Caveat *logipat-caveat* :abc: and :def:
>
The "not" operator may be fragile; ie. it may not always play well :let pat= LogiPat('!"abc"')
with the & (logical-and) and | (logical-or) operators. Please try out < will return the regular expression which will match
your patterns, possibly with :set hls, to insure that what is matching all lines not containing :abc: . The double quotes
is what you want. are needed to pass normal patterns to LogiPat, and
differentiate such patterns from boolean logic
============================================================================== operators.
3. LogiPat History *logipat-history*
v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working ==============================================================================
v1 May 23, 2005 * initial release 4. Caveat *logipat-caveat*
============================================================================== The "not" operator may be fragile; ie. it may not always play well
vim:tw=78:ts=8:ft=help with the & (logical-and) and | (logical-or) operators. Please try out
your patterns, possibly with :set hls, to insure that what is matching
is what you want.
==============================================================================
3. LogiPat History *logipat-history*
v3 Sep 25, 2006 * LP_Or() fixed; it now encapsulates its output
in \%(...\) parentheses
Dec 12, 2011 * |:ELP| added
* "" is mapped to a single " and left inside patterns
v2 May 31, 2005 * LPF and LogiPatFlags commands weren't working
v1 May 23, 2005 * initial release
==============================================================================
vim:tw=78:ts=8:ft=help

View File

@ -3,8 +3,11 @@
" <alexander.fleck@gmx.net> " <alexander.fleck@gmx.net>
" License: This File is placed in the Public Domain. " License: This File is placed in the Public Domain.
" Revision | Date [DD.MM.YY] | Changes " Revision | Date [DD.MM.YY] | Changes
" 00.01.00 | 05.07.09 | 01. Revision " 00.01.00 | 05.07.09 | 01.
" 00.01.10 | | -
" 00.02.00 | 29.03.10 | Description added " 00.02.00 | 29.03.10 | Description added
" 00.02.10 | | -
" 00.02.20 | | Description added (ms)
*editsrec.txt* Global Plugin for Editing .srec Files *editsrec.txt* Global Plugin for Editing .srec Files
@ -35,7 +38,8 @@ lc | build a line from CheckSum |
pc | build only the CheckSum | pc | build only the CheckSum |
---------|-----------------------------------| ---------|-----------------------------------|
m5 | make an S5 record on a blank line | m5 | make an S5 record on a blank line |
| | ---------|-----------------------------------|
ms | make a set of records |
see *editsrec_test.txt* for examples see *editsrec_test.txt* for examples

View File

@ -20,6 +20,7 @@ CONTENTS *Gundo-contents*
3.9 gundo_preview_statusline .. |gundo_preview_statusline| 3.9 gundo_preview_statusline .. |gundo_preview_statusline|
gundo_tree_statusline ..... |gundo_tree_statusline| gundo_tree_statusline ..... |gundo_tree_statusline|
3.10 gundo_auto_preview ........ |gundo_auto_preview| 3.10 gundo_auto_preview ........ |gundo_auto_preview|
3.11 gundo_playback_delay ...... |gundo_playback_delay|
4. License ......................... |GundoLicense| 4. License ......................... |GundoLicense|
5. Bugs ............................ |GundoBugs| 5. Bugs ............................ |GundoBugs|
6. Contributing .................... |GundoContributing| 6. Contributing .................... |GundoContributing|
@ -216,6 +217,15 @@ be useful on large files and undo trees to speed up Gundo.
Default: 1 (automatically preview diffs) Default: 1 (automatically preview diffs)
------------------------------------------------------------------------------
3.11 g:gundo_playback_delay *gundo_playback_delay*
This is the delay in milliseconds between each change when running 'play to'
mode. Set this to a higher number for a slower playback or to a lower number
for a faster playback.
Default: 60
============================================================================== ==============================================================================
4. License *GundoLicense* 4. License *GundoLicense*
@ -238,6 +248,10 @@ GitHub: http://github.com/sjl/gundo.vim/
============================================================================== ==============================================================================
7. Changelog *GundoChangelog* 7. Changelog *GundoChangelog*
v2.5.0
* Fix the help window to take custom mappings into account.
* Add g:gundo_playback_delay option.
v2.4.0 v2.4.0
* Add auto preview option. * Add auto preview option.
* Add 'r' mapping to preview current state. * Add 'r' mapping to preview current state.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
:Align Align.txt /*:Align*
:AlignCtrl Align.txt /*:AlignCtrl*
:AlignMapsClean Align.txt /*:AlignMapsClean* :AlignMapsClean Align.txt /*:AlignMapsClean*
:CVSEdit vcscommand.txt /*:CVSEdit* :CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors* :CVSEditors vcscommand.txt /*:CVSEditors*
@ -8,6 +10,7 @@
:CVSWatchOn vcscommand.txt /*:CVSWatchOn* :CVSWatchOn vcscommand.txt /*:CVSWatchOn*
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove* :CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
:CVSWatchers vcscommand.txt /*:CVSWatchers* :CVSWatchers vcscommand.txt /*:CVSWatchers*
:ELP LogiPat.txt /*:ELP*
:Explore pi_netrw.txt /*:Explore* :Explore pi_netrw.txt /*:Explore*
:GLVS pi_getscript.txt /*:GLVS* :GLVS pi_getscript.txt /*:GLVS*
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat* :GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
@ -1508,6 +1511,7 @@ g:MultipleSearchColorSequence MultipleSearch.txt /*g:MultipleSearchColorSequence
g:MultipleSearchMaxColors MultipleSearch.txt /*g:MultipleSearchMaxColors* g:MultipleSearchMaxColors MultipleSearch.txt /*g:MultipleSearchMaxColors*
g:MultipleSearchTextColorSequence MultipleSearch.txt /*g:MultipleSearchTextColorSequence* g:MultipleSearchTextColorSequence MultipleSearch.txt /*g:MultipleSearchTextColorSequence*
g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu* g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu*
g:Netrw_corehandler pi_netrw.txt /*g:Netrw_corehandler*
g:Netrw_funcref pi_netrw.txt /*g:Netrw_funcref* g:Netrw_funcref pi_netrw.txt /*g:Netrw_funcref*
g:alignmaps_euronumber Align.txt /*g:alignmaps_euronumber* g:alignmaps_euronumber Align.txt /*g:alignmaps_euronumber*
g:alignmaps_usanumber Align.txt /*g:alignmaps_usanumber* g:alignmaps_usanumber Align.txt /*g:alignmaps_usanumber*
@ -1526,6 +1530,8 @@ g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin*
g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd* g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd*
g:netrw_decompress pi_netrw.txt /*g:netrw_decompress* g:netrw_decompress pi_netrw.txt /*g:netrw_decompress*
g:netrw_dirhistmax pi_netrw.txt /*g:netrw_dirhistmax* g:netrw_dirhistmax pi_netrw.txt /*g:netrw_dirhistmax*
g:netrw_dynamic_maxfilenamelen pi_netrw.txt /*g:netrw_dynamic_maxfilenamelen*
g:netrw_errorlvl pi_netrw.txt /*g:netrw_errorlvl*
g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse* g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse*
g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd* g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd*
g:netrw_fname_escape pi_netrw.txt /*g:netrw_fname_escape* g:netrw_fname_escape pi_netrw.txt /*g:netrw_fname_escape*
@ -1533,6 +1539,7 @@ g:netrw_ftp pi_netrw.txt /*g:netrw_ftp*
g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject*
g:netrw_ftp_cmd pi_netrw.txt /*g:netrw_ftp_cmd* g:netrw_ftp_cmd pi_netrw.txt /*g:netrw_ftp_cmd*
g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd* g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd*
g:netrw_ftp_options pi_netrw.txt /*g:netrw_ftp_options*
g:netrw_ftp_sizelist_cmd pi_netrw.txt /*g:netrw_ftp_sizelist_cmd* g:netrw_ftp_sizelist_cmd pi_netrw.txt /*g:netrw_ftp_sizelist_cmd*
g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd*
g:netrw_ftpextracmd pi_netrw.txt /*g:netrw_ftpextracmd* g:netrw_ftpextracmd pi_netrw.txt /*g:netrw_ftpextracmd*
@ -1547,17 +1554,19 @@ g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir*
g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd*
g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide*
g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle*
g:netrw_local_mkdir pi_netrw.txt /*g:netrw_local_mkdir*
g:netrw_local_rmdir pi_netrw.txt /*g:netrw_local_rmdir*
g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd* g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd*
g:netrw_localmkdir pi_netrw.txt /*g:netrw_localmkdir*
g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd* g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd*
g:netrw_localrmdir pi_netrw.txt /*g:netrw_localrmdir*
g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen* g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen*
g:netrw_menu pi_netrw.txt /*g:netrw_menu* g:netrw_menu pi_netrw.txt /*g:netrw_menu*
g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd* g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd*
g:netrw_mousemaps pi_netrw.txt /*g:netrw_mousemaps* g:netrw_mousemaps pi_netrw.txt /*g:netrw_mousemaps*
g:netrw_nobeval pi_netrw.txt /*g:netrw_nobeval*
g:netrw_nogx pi_netrw.txt /*g:netrw_nogx* g:netrw_nogx pi_netrw.txt /*g:netrw_nogx*
g:netrw_preview pi_netrw.txt /*g:netrw_preview* g:netrw_preview pi_netrw.txt /*g:netrw_preview*
g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd* g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd*
g:netrw_remote_mkdir pi_netrw.txt /*g:netrw_remote_mkdir*
g:netrw_retmap pi_netrw.txt /*g:netrw_retmap* g:netrw_retmap pi_netrw.txt /*g:netrw_retmap*
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd* g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd* g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd*
@ -1586,6 +1595,7 @@ g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp*
g:netrw_winsize pi_netrw.txt /*g:netrw_winsize* g:netrw_winsize pi_netrw.txt /*g:netrw_winsize*
g:netrw_xstrlen pi_netrw.txt /*g:netrw_xstrlen* g:netrw_xstrlen pi_netrw.txt /*g:netrw_xstrlen*
g:tcomment#ignore_char_type tcomment.txt /*g:tcomment#ignore_char_type* g:tcomment#ignore_char_type tcomment.txt /*g:tcomment#ignore_char_type*
g:tcomment#replacements_c tcomment.txt /*g:tcomment#replacements_c*
g:tcomment#syntax_substitute tcomment.txt /*g:tcomment#syntax_substitute* g:tcomment#syntax_substitute tcomment.txt /*g:tcomment#syntax_substitute*
g:tcommentBlankLines tcomment.txt /*g:tcommentBlankLines* g:tcommentBlankLines tcomment.txt /*g:tcommentBlankLines*
g:tcommentBlockC tcomment.txt /*g:tcommentBlockC* g:tcommentBlockC tcomment.txt /*g:tcommentBlockC*
@ -1594,18 +1604,24 @@ g:tcommentBlockXML tcomment.txt /*g:tcommentBlockXML*
g:tcommentGuessFileType tcomment.txt /*g:tcommentGuessFileType* g:tcommentGuessFileType tcomment.txt /*g:tcommentGuessFileType*
g:tcommentGuessFileType_django tcomment.txt /*g:tcommentGuessFileType_django* g:tcommentGuessFileType_django tcomment.txt /*g:tcommentGuessFileType_django*
g:tcommentGuessFileType_dsl tcomment.txt /*g:tcommentGuessFileType_dsl* g:tcommentGuessFileType_dsl tcomment.txt /*g:tcommentGuessFileType_dsl*
g:tcommentGuessFileType_eruby tcomment.txt /*g:tcommentGuessFileType_eruby*
g:tcommentGuessFileType_html tcomment.txt /*g:tcommentGuessFileType_html* g:tcommentGuessFileType_html tcomment.txt /*g:tcommentGuessFileType_html*
g:tcommentGuessFileType_php tcomment.txt /*g:tcommentGuessFileType_php* g:tcommentGuessFileType_php tcomment.txt /*g:tcommentGuessFileType_php*
g:tcommentGuessFileType_smarty tcomment.txt /*g:tcommentGuessFileType_smarty*
g:tcommentGuessFileType_tskeleton tcomment.txt /*g:tcommentGuessFileType_tskeleton* g:tcommentGuessFileType_tskeleton tcomment.txt /*g:tcommentGuessFileType_tskeleton*
g:tcommentGuessFileType_vim tcomment.txt /*g:tcommentGuessFileType_vim* g:tcommentGuessFileType_vim tcomment.txt /*g:tcommentGuessFileType_vim*
g:tcommentIgnoreTypes_php tcomment.txt /*g:tcommentIgnoreTypes_php* g:tcommentIgnoreTypes_php tcomment.txt /*g:tcommentIgnoreTypes_php*
g:tcommentInlineC tcomment.txt /*g:tcommentInlineC* g:tcommentInlineC tcomment.txt /*g:tcommentInlineC*
g:tcommentInlineXML tcomment.txt /*g:tcommentInlineXML* g:tcommentInlineXML tcomment.txt /*g:tcommentInlineXML*
g:tcommentMapLeader1 tcomment.txt /*g:tcommentMapLeader1*
g:tcommentMapLeader2 tcomment.txt /*g:tcommentMapLeader2*
g:tcommentMapLeaderOp1 tcomment.txt /*g:tcommentMapLeaderOp1* g:tcommentMapLeaderOp1 tcomment.txt /*g:tcommentMapLeaderOp1*
g:tcommentMapLeaderOp2 tcomment.txt /*g:tcommentMapLeaderOp2* g:tcommentMapLeaderOp2 tcomment.txt /*g:tcommentMapLeaderOp2*
g:tcommentModeExtra tcomment.txt /*g:tcommentModeExtra*
g:tcommentOpModeExtra tcomment.txt /*g:tcommentOpModeExtra* g:tcommentOpModeExtra tcomment.txt /*g:tcommentOpModeExtra*
g:tcommentOptions tcomment.txt /*g:tcommentOptions* g:tcommentOptions tcomment.txt /*g:tcommentOptions*
g:tcommentSyntaxMap tcomment.txt /*g:tcommentSyntaxMap* g:tcommentSyntaxMap tcomment.txt /*g:tcommentSyntaxMap*
g:tcomment_types tcomment.txt /*g:tcomment_types*
g:vimball_home pi_vimball.txt /*g:vimball_home* g:vimball_home pi_vimball.txt /*g:vimball_home*
g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir* g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir*
g:visincr_datedivset visincr.txt /*g:visincr_datedivset* g:visincr_datedivset visincr.txt /*g:visincr_datedivset*
@ -1638,6 +1654,7 @@ gundo_disable gundo.txt /*gundo_disable*
gundo_help gundo.txt /*gundo_help* gundo_help gundo.txt /*gundo_help*
gundo_map_move_newer gundo.txt /*gundo_map_move_newer* gundo_map_move_newer gundo.txt /*gundo_map_move_newer*
gundo_map_move_older gundo.txt /*gundo_map_move_older* gundo_map_move_older gundo.txt /*gundo_map_move_older*
gundo_playback_delay gundo.txt /*gundo_playback_delay*
gundo_preview_bottom gundo.txt /*gundo_preview_bottom* gundo_preview_bottom gundo.txt /*gundo_preview_bottom*
gundo_preview_height gundo.txt /*gundo_preview_height* gundo_preview_height gundo.txt /*gundo_preview_height*
gundo_preview_statusline gundo.txt /*gundo_preview_statusline* gundo_preview_statusline gundo.txt /*gundo_preview_statusline*
@ -1656,6 +1673,7 @@ local_markfilelist pi_netrw.txt /*local_markfilelist*
logipat LogiPat.txt /*logipat* logipat LogiPat.txt /*logipat*
logipat-arg LogiPat.txt /*logipat-arg* logipat-arg LogiPat.txt /*logipat-arg*
logipat-caveat LogiPat.txt /*logipat-caveat* logipat-caveat LogiPat.txt /*logipat-caveat*
logipat-contents LogiPat.txt /*logipat-contents*
logipat-copyright LogiPat.txt /*logipat-copyright* logipat-copyright LogiPat.txt /*logipat-copyright*
logipat-examples LogiPat.txt /*logipat-examples* logipat-examples LogiPat.txt /*logipat-examples*
logipat-history LogiPat.txt /*logipat-history* logipat-history LogiPat.txt /*logipat-history*
@ -1701,8 +1719,8 @@ netrw-O pi_netrw.txt /*netrw-O*
netrw-P pi_netrw.txt /*netrw-P* netrw-P pi_netrw.txt /*netrw-P*
netrw-R pi_netrw.txt /*netrw-R* netrw-R pi_netrw.txt /*netrw-R*
netrw-S pi_netrw.txt /*netrw-S* netrw-S pi_netrw.txt /*netrw-S*
netrw-T pi_netrw.txt /*netrw-T*
netrw-U pi_netrw.txt /*netrw-U* netrw-U pi_netrw.txt /*netrw-U*
netrw-X pi_netrw.txt /*netrw-X*
netrw-a pi_netrw.txt /*netrw-a* netrw-a pi_netrw.txt /*netrw-a*
netrw-activate pi_netrw.txt /*netrw-activate* netrw-activate pi_netrw.txt /*netrw-activate*
netrw-bookmark pi_netrw.txt /*netrw-bookmark* netrw-bookmark pi_netrw.txt /*netrw-bookmark*
@ -1712,6 +1730,7 @@ netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds*
netrw-browse-maps pi_netrw.txt /*netrw-browse-maps* netrw-browse-maps pi_netrw.txt /*netrw-browse-maps*
netrw-browser pi_netrw.txt /*netrw-browser* netrw-browser pi_netrw.txt /*netrw-browser*
netrw-browser-options pi_netrw.txt /*netrw-browser-options* netrw-browser-options pi_netrw.txt /*netrw-browser-options*
netrw-browser-settings pi_netrw.txt /*netrw-browser-settings*
netrw-browser-var pi_netrw.txt /*netrw-browser-var* netrw-browser-var pi_netrw.txt /*netrw-browser-var*
netrw-browsing pi_netrw.txt /*netrw-browsing* netrw-browsing pi_netrw.txt /*netrw-browsing*
netrw-c pi_netrw.txt /*netrw-c* netrw-c pi_netrw.txt /*netrw-c*
@ -1760,6 +1779,7 @@ netrw-history pi_netrw.txt /*netrw-history*
netrw-horiz pi_netrw.txt /*netrw-horiz* netrw-horiz pi_netrw.txt /*netrw-horiz*
netrw-i pi_netrw.txt /*netrw-i* netrw-i pi_netrw.txt /*netrw-i*
netrw-incompatible pi_netrw.txt /*netrw-incompatible* netrw-incompatible pi_netrw.txt /*netrw-incompatible*
netrw-internal-variables pi_netrw.txt /*netrw-internal-variables*
netrw-intro-browse pi_netrw.txt /*netrw-intro-browse* netrw-intro-browse pi_netrw.txt /*netrw-intro-browse*
netrw-leftmouse pi_netrw.txt /*netrw-leftmouse* netrw-leftmouse pi_netrw.txt /*netrw-leftmouse*
netrw-list pi_netrw.txt /*netrw-list* netrw-list pi_netrw.txt /*netrw-list*
@ -1767,6 +1787,7 @@ netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
netrw-listhack pi_netrw.txt /*netrw-listhack* netrw-listhack pi_netrw.txt /*netrw-listhack*
netrw-login pi_netrw.txt /*netrw-login* netrw-login pi_netrw.txt /*netrw-login*
netrw-mB pi_netrw.txt /*netrw-mB* netrw-mB pi_netrw.txt /*netrw-mB*
netrw-mF pi_netrw.txt /*netrw-mF*
netrw-mT pi_netrw.txt /*netrw-mT* netrw-mT pi_netrw.txt /*netrw-mT*
netrw-mb pi_netrw.txt /*netrw-mb* netrw-mb pi_netrw.txt /*netrw-mb*
netrw-mc pi_netrw.txt /*netrw-mc* netrw-mc pi_netrw.txt /*netrw-mc*
@ -1821,6 +1842,7 @@ netrw-prvwin pi_netrw.txt /*netrw-prvwin*
netrw-pscp pi_netrw.txt /*netrw-pscp* netrw-pscp pi_netrw.txt /*netrw-pscp*
netrw-psftp pi_netrw.txt /*netrw-psftp* netrw-psftp pi_netrw.txt /*netrw-psftp*
netrw-putty pi_netrw.txt /*netrw-putty* netrw-putty pi_netrw.txt /*netrw-putty*
netrw-qF pi_netrw.txt /*netrw-qF*
netrw-qb pi_netrw.txt /*netrw-qb* netrw-qb pi_netrw.txt /*netrw-qb*
netrw-qf pi_netrw.txt /*netrw-qf* netrw-qf pi_netrw.txt /*netrw-qf*
netrw-quickcom pi_netrw.txt /*netrw-quickcom* netrw-quickcom pi_netrw.txt /*netrw-quickcom*
@ -1837,8 +1859,10 @@ netrw-rexplore pi_netrw.txt /*netrw-rexplore*
netrw-rightmouse pi_netrw.txt /*netrw-rightmouse* netrw-rightmouse pi_netrw.txt /*netrw-rightmouse*
netrw-s pi_netrw.txt /*netrw-s* netrw-s pi_netrw.txt /*netrw-s*
netrw-settings pi_netrw.txt /*netrw-settings* netrw-settings pi_netrw.txt /*netrw-settings*
netrw-settings-window pi_netrw.txt /*netrw-settings-window*
netrw-sexplore pi_netrw.txt /*netrw-sexplore* netrw-sexplore pi_netrw.txt /*netrw-sexplore*
netrw-sort pi_netrw.txt /*netrw-sort* netrw-sort pi_netrw.txt /*netrw-sort*
netrw-sort-sequence pi_netrw.txt /*netrw-sort-sequence*
netrw-sortsequence pi_netrw.txt /*netrw-sortsequence* netrw-sortsequence pi_netrw.txt /*netrw-sortsequence*
netrw-source pi_netrw.txt /*netrw-source* netrw-source pi_netrw.txt /*netrw-source*
netrw-ssh-hack pi_netrw.txt /*netrw-ssh-hack* netrw-ssh-hack pi_netrw.txt /*netrw-ssh-hack*
@ -1860,6 +1884,8 @@ netrw-v pi_netrw.txt /*netrw-v*
netrw-var pi_netrw.txt /*netrw-var* netrw-var pi_netrw.txt /*netrw-var*
netrw-variables pi_netrw.txt /*netrw-variables* netrw-variables pi_netrw.txt /*netrw-variables*
netrw-vexplore pi_netrw.txt /*netrw-vexplore* netrw-vexplore pi_netrw.txt /*netrw-vexplore*
netrw-windows-netrc pi_netrw.txt /*netrw-windows-netrc*
netrw-windows-s pi_netrw.txt /*netrw-windows-s*
netrw-write pi_netrw.txt /*netrw-write* netrw-write pi_netrw.txt /*netrw-write*
netrw-x pi_netrw.txt /*netrw-x* netrw-x pi_netrw.txt /*netrw-x*
netrw-xfer pi_netrw.txt /*netrw-xfer* netrw-xfer pi_netrw.txt /*netrw-xfer*
@ -1888,11 +1914,14 @@ srchrplchigrp-examples SrchRplcHiGrp.txt /*srchrplchigrp-examples*
tcomment#Comment() tcomment.txt /*tcomment#Comment()* tcomment#Comment() tcomment.txt /*tcomment#Comment()*
tcomment#CommentAs() tcomment.txt /*tcomment#CommentAs()* tcomment#CommentAs() tcomment.txt /*tcomment#CommentAs()*
tcomment#DefineType() tcomment.txt /*tcomment#DefineType()* tcomment#DefineType() tcomment.txt /*tcomment#DefineType()*
tcomment#GuessCommentType() tcomment.txt /*tcomment#GuessCommentType()*
tcomment#Operator() tcomment.txt /*tcomment#Operator()* tcomment#Operator() tcomment.txt /*tcomment#Operator()*
tcomment#OperatorAnyway() tcomment.txt /*tcomment#OperatorAnyway()* tcomment#OperatorAnyway() tcomment.txt /*tcomment#OperatorAnyway()*
tcomment#OperatorLine() tcomment.txt /*tcomment#OperatorLine()* tcomment#OperatorLine() tcomment.txt /*tcomment#OperatorLine()*
tcomment#OperatorLineAnyway() tcomment.txt /*tcomment#OperatorLineAnyway()* tcomment#OperatorLineAnyway() tcomment.txt /*tcomment#OperatorLineAnyway()*
tcomment#SetOption() tcomment.txt /*tcomment#SetOption()*
tcomment-maps tcomment.txt /*tcomment-maps* tcomment-maps tcomment.txt /*tcomment-maps*
tcomment-operator tcomment.txt /*tcomment-operator*
tcomment.txt tcomment.txt /*tcomment.txt* tcomment.txt tcomment.txt /*tcomment.txt*
v_[% matchit.txt /*v_[%* v_[% matchit.txt /*v_[%*
v_]% matchit.txt /*v_]%* v_]% matchit.txt /*v_]%*

View File

@ -15,6 +15,11 @@ override the default choice.
TComment can properly handle an embedded syntax, e.g., ruby/python/perl TComment can properly handle an embedded syntax, e.g., ruby/python/perl
regions in vim scripts, HTML or JavaScript in php code etc. regions in vim scripts, HTML or JavaScript in php code etc.
tcomment favours the use of line-wise comment styles. This implies that usually
whole line will be commented out. tcomment also knows block-style and inline
comments that can be used via special maps (see below) or the |:TCommentAs|
command.
Demo: Demo:
http://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html http://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html
@ -25,23 +30,35 @@ Key bindings~
Most of the time the default toggle keys will do what you want (or to be Most of the time the default toggle keys will do what you want (or to be
more precise: what I think you want it to do ;-). more precise: what I think you want it to do ;-).
*g:tcommentMapLeaderOp1* *tcomment-operator*
*g:tcommentMapLeaderOp2* As operator (the prefix can be customized via |g:tcommentMapLeaderOp1|
As operator (the prefix can be customized via g:tcommentMapLeaderOp1 and |g:tcommentMapLeaderOp2|):
and g:tcommentMapLeaderOp2):
gc{motion} :: Toggle comments (for small comments within one line gc{motion} :: Toggle comments (for small comments within one line
the &filetype_inline style will be used, if the &filetype_inline style will be used, if
defined) defined)
gc<Count>c{motion} :: Toggle comment text with count argument
(see |tcomment#Comment()|)
gcc :: Toggle comment for the current line gcc :: Toggle comment for the current line
gC{motion} :: Comment region gC{motion} :: Comment region
gCc :: Comment the current line gCc :: Comment the current line
In visual mode:
gc :: Toggle comments
gC :: Comment selected text
CAVEAT: If you visually select text within a line, the visual mode map will
comment out the selected text. If you selected text across several lines, the
visual mode map will assume though that you wanted to comment out lines --
since this is how many vim maps work. In order to make tcomment use e.g. inline
comments anyway, use the <c-_>i map -- see below.
By default the cursor stays put. If you want the cursor to the end of By default the cursor stays put. If you want the cursor to the end of
the commented text, set |g:tcommentOpModeExtra| to '>' (but this may not the commented text, set |g:tcommentOpModeExtra| to '>' (but this may not
work properly with exclusive motions). work properly with exclusive motions).
Primary key maps: Primary key maps for normal and insert mode:
<c-_><c-_> :: :TComment <c-_><c-_> :: :TComment
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END> <c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
@ -49,11 +66,22 @@ Primary key maps:
<c-_>a :: :TCommentAs <QUERY COMMENT TYPE> <c-_>a :: :TCommentAs <QUERY COMMENT TYPE>
<c-_>n :: :TCommentAs &filetype <QUERY COUNT> <c-_>n :: :TCommentAs &filetype <QUERY COUNT>
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE> <c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
<c-_>i :: :TCommentInline <c-_>i :: :TCommentInline (in normal and insert mode, this map will
create an empty inline comment, which isn't suitable for
all filetypes though)
<c-_>r :: :TCommentRight <c-_>r :: :TCommentRight
<c-_>p :: Comment the current inner paragraph <c-_>p :: Comment the current inner paragraph
<c-_><Count> :: :TComment with count argument (a number from 1 to 9)
(see |tcomment#Comment()|)
A secondary set of key maps is defined for normal mode. Primary key maps for visual mode:
<c-_><c-_> :: :TComment
<c-_>i :: :TCommentInline
<c-_><Count> :: :TComment with count argument (a number from 1 to 9)
(see |tcomment#Comment()|)
A secondary set of key maps is defined for normal and insert mode:
<Leader>__ :: :TComment <Leader>__ :: :TComment
<Leader>_p :: Comment the current inner paragraph <Leader>_p :: Comment the current inner paragraph
@ -65,6 +93,11 @@ A secondary set of key maps is defined for normal mode.
<Leader>_n :: :TCommentAs &filetype <QUERY COUNT> <Leader>_n :: :TCommentAs &filetype <QUERY COUNT>
<Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE> <Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
... and for select mode:
<Leader>__ :: :TComment
<Leader>_i :: :TCommentInline
----------------------------------------------------------------------- -----------------------------------------------------------------------
Install~ Install~
@ -81,6 +114,10 @@ please make sure, you have the current version of vimball (vimscript
======================================================================== ========================================================================
Contents~ Contents~
g:tcommentMapLeader1 ................ |g:tcommentMapLeader1|
g:tcommentMapLeader2 ................ |g:tcommentMapLeader2|
g:tcommentMapLeaderOp1 .............. |g:tcommentMapLeaderOp1|
g:tcommentMapLeaderOp2 .............. |g:tcommentMapLeaderOp2|
:TComment ........................... |:TComment| :TComment ........................... |:TComment|
:TCommentAs ......................... |:TCommentAs| :TCommentAs ......................... |:TCommentAs|
:TCommentRight ...................... |:TCommentRight| :TCommentRight ...................... |:TCommentRight|
@ -88,6 +125,7 @@ Contents~
:TCommentInline ..................... |:TCommentInline| :TCommentInline ..................... |:TCommentInline|
:TCommentMaybeInline ................ |:TCommentMaybeInline| :TCommentMaybeInline ................ |:TCommentMaybeInline|
g:tcommentBlankLines ................ |g:tcommentBlankLines| g:tcommentBlankLines ................ |g:tcommentBlankLines|
g:tcommentModeExtra ................. |g:tcommentModeExtra|
g:tcommentOpModeExtra ............... |g:tcommentOpModeExtra| g:tcommentOpModeExtra ............... |g:tcommentOpModeExtra|
g:tcommentOptions ................... |g:tcommentOptions| g:tcommentOptions ................... |g:tcommentOptions|
g:tcomment#ignore_char_type ......... |g:tcomment#ignore_char_type| g:tcomment#ignore_char_type ......... |g:tcomment#ignore_char_type|
@ -98,33 +136,57 @@ Contents~
g:tcommentGuessFileType_tskeleton ... |g:tcommentGuessFileType_tskeleton| g:tcommentGuessFileType_tskeleton ... |g:tcommentGuessFileType_tskeleton|
g:tcommentGuessFileType_vim ......... |g:tcommentGuessFileType_vim| g:tcommentGuessFileType_vim ......... |g:tcommentGuessFileType_vim|
g:tcommentGuessFileType_django ...... |g:tcommentGuessFileType_django| g:tcommentGuessFileType_django ...... |g:tcommentGuessFileType_django|
g:tcommentGuessFileType_eruby ....... |g:tcommentGuessFileType_eruby|
g:tcommentGuessFileType_smarty ...... |g:tcommentGuessFileType_smarty|
g:tcommentIgnoreTypes_php ........... |g:tcommentIgnoreTypes_php| g:tcommentIgnoreTypes_php ........... |g:tcommentIgnoreTypes_php|
g:tcomment#syntax_substitute ........ |g:tcomment#syntax_substitute| g:tcomment#syntax_substitute ........ |g:tcomment#syntax_substitute|
g:tcommentSyntaxMap ................. |g:tcommentSyntaxMap| g:tcommentSyntaxMap ................. |g:tcommentSyntaxMap|
g:tcomment#replacements_c ........... |g:tcomment#replacements_c|
g:tcommentBlockC .................... |g:tcommentBlockC| g:tcommentBlockC .................... |g:tcommentBlockC|
g:tcommentBlockC2 ................... |g:tcommentBlockC2| g:tcommentBlockC2 ................... |g:tcommentBlockC2|
g:tcommentInlineC ................... |g:tcommentInlineC| g:tcommentInlineC ................... |g:tcommentInlineC|
g:tcommentBlockXML .................. |g:tcommentBlockXML| g:tcommentBlockXML .................. |g:tcommentBlockXML|
g:tcommentInlineXML ................. |g:tcommentInlineXML| g:tcommentInlineXML ................. |g:tcommentInlineXML|
tcomment#DefineType ................. |tcomment#DefineType()| tcomment#DefineType ................. |tcomment#DefineType()|
g:tcomment_types .................... |g:tcomment_types|
tcomment#Comment .................... |tcomment#Comment()| tcomment#Comment .................... |tcomment#Comment()|
tcomment#SetOption .................. |tcomment#SetOption()|
tcomment#Operator ................... |tcomment#Operator()| tcomment#Operator ................... |tcomment#Operator()|
tcomment#OperatorLine ............... |tcomment#OperatorLine()| tcomment#OperatorLine ............... |tcomment#OperatorLine()|
tcomment#OperatorAnyway ............. |tcomment#OperatorAnyway()| tcomment#OperatorAnyway ............. |tcomment#OperatorAnyway()|
tcomment#OperatorLineAnyway ......... |tcomment#OperatorLineAnyway()| tcomment#OperatorLineAnyway ......... |tcomment#OperatorLineAnyway()|
tcomment#CommentAs .................. |tcomment#CommentAs()| tcomment#CommentAs .................. |tcomment#CommentAs()|
tcomment#GuessCommentType ........... |tcomment#GuessCommentType()|
======================================================================== ========================================================================
plugin/tcomment.vim~ plugin/tcomment.vim~
*g:tcommentMapLeader1*
g:tcommentMapLeader1 (default: '<c-_>')
g:tcommentMapLeader1 should be a shortcut that can be used with
map, imap, vmap.
*g:tcommentMapLeader2*
g:tcommentMapLeader2 (default: '<Leader>_')
g:tcommentMapLeader2 should be a shortcut that can be used with
map, xmap.
*g:tcommentMapLeaderOp1*
g:tcommentMapLeaderOp1 (default: 'gc')
See |tcomment-operator|.
*g:tcommentMapLeaderOp2*
g:tcommentMapLeaderOp2 (default: 'gC')
See |tcomment-operator|.
*:TComment* *:TComment*
:[range]TComment[!] ?ARGS... :[range]TComment[!] ?ARGS...
If there is a visual selection that begins and ends in the same line, If there is a visual selection that begins and ends in the same line,
then |:TCommentInline| is used instead. then |:TCommentInline| is used instead.
The optional range defaults to the current line. With a bang '!', The optional range defaults to the current line. With a bang '!',
always comment the line. always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -133,7 +195,7 @@ plugin/tcomment.vim~
:[range]TCommentAs[!] commenttype ?ARGS... :[range]TCommentAs[!] commenttype ?ARGS...
TCommentAs requires g:tcomment_{filetype} to be defined. TCommentAs requires g:tcomment_{filetype} to be defined.
With a bang '!', always comment the line. With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -144,7 +206,7 @@ plugin/tcomment.vim~
made (be it block-wise or not), all lines are commented out at from made (be it block-wise or not), all lines are commented out at from
the current cursor position downwards. the current cursor position downwards.
With a bang '!', always comment the line. With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -154,7 +216,7 @@ plugin/tcomment.vim~
Comment as "block", e.g. use the {&ft}_block comment style. The Comment as "block", e.g. use the {&ft}_block comment style. The
commented text isn't indented or reformated. commented text isn't indented or reformated.
With a bang '!', always comment the line. With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -163,7 +225,7 @@ plugin/tcomment.vim~
:[range]TCommentInline[!] ?ARGS... :[range]TCommentInline[!] ?ARGS...
Use the {&ft}_inline comment style. Use the {&ft}_inline comment style.
With a bang '!', always comment the line. With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -171,7 +233,7 @@ plugin/tcomment.vim~
*:TCommentMaybeInline* *:TCommentMaybeInline*
:[range]TCommentMaybeInline[!] ?ARGS... :[range]TCommentMaybeInline[!] ?ARGS...
With a bang '!', always comment the line. With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|): ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs 1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd 2. 1-2 values for: ?commentBegin, ?commentEnd
@ -184,15 +246,25 @@ autoload/tcomment.vim~
g:tcommentBlankLines (default: 1) g:tcommentBlankLines (default: 1)
If true, comment blank lines too If true, comment blank lines too
*g:tcommentModeExtra*
g:tcommentModeExtra (default: '')
Modifies how commenting works.
> ... Move the cursor to the end of the comment
>> ... Like above but move the cursor to the next line
# ... Move the cursor to the position of the commented text
(NOTE: this only works when creating empty comments using
|:TCommentInline| from normal or insert mode and should
not be set here as a global option.)
*g:tcommentOpModeExtra* *g:tcommentOpModeExtra*
g:tcommentOpModeExtra (default: '') g:tcommentOpModeExtra (default: '')
Modifies how the operator works. Modifies how the operator works.
> ... Move the cursor to the end of the comment See |g:tcommentModeExtra| for a list of possible values.
*g:tcommentOptions* *g:tcommentOptions*
g:tcommentOptions (default: {}) g:tcommentOptions (default: {})
Other key-value options used by |tcomment#Comment()|. Other key-value options used by |tcomment#Comment()|.
Example: If you want to put the opening comment marker always in Example: If you want to put the opening comment marker always in
the first column regardless of the block's indentation, put this the first column regardless of the block's indentation, put this
into your |vimrc| file: > into your |vimrc| file: >
@ -215,7 +287,7 @@ g:tcommentGuessFileType (default: 0)
If non-zero, try to guess filetypes. If non-zero, try to guess filetypes.
tcomment also checks g:tcommentGuessFileType_{&filetype} for tcomment also checks g:tcommentGuessFileType_{&filetype} for
filetype specific values. filetype specific values.
Values: Values:
0 ... don't guess 0 ... don't guess
1 ... guess 1 ... guess
@ -223,7 +295,7 @@ g:tcommentGuessFileType (default: 0)
*g:tcommentGuessFileType_dsl* *g:tcommentGuessFileType_dsl*
g:tcommentGuessFileType_dsl (default: 'xml') g:tcommentGuessFileType_dsl (default: 'xml')
For dsl documents, assumet filetype = xml. For dsl documents, assume filetype = xml.
*g:tcommentGuessFileType_php* *g:tcommentGuessFileType_php*
g:tcommentGuessFileType_php (default: 'html') g:tcommentGuessFileType_php (default: 'html')
@ -243,9 +315,15 @@ g:tcommentGuessFileType_vim (default: 1)
*g:tcommentGuessFileType_django* *g:tcommentGuessFileType_django*
g:tcommentGuessFileType_django (default: 1) g:tcommentGuessFileType_django (default: 1)
*g:tcommentGuessFileType_eruby*
g:tcommentGuessFileType_eruby (default: 1)
*g:tcommentGuessFileType_smarty*
g:tcommentGuessFileType_smarty (default: 1)
*g:tcommentIgnoreTypes_php* *g:tcommentIgnoreTypes_php*
g:tcommentIgnoreTypes_php (default: 'sql') g:tcommentIgnoreTypes_php (default: 'sql')
In php files, some syntax regions are wongly highlighted as sql In php files, some syntax regions are wrongly highlighted as sql
markup. We thus ignore sql syntax when guessing the filetype in markup. We thus ignore sql syntax when guessing the filetype in
php files. php files.
@ -259,6 +337,10 @@ g:tcommentSyntaxMap (default: {...})
/filetypeSomeName/. Other syntax names have to be explicitly /filetypeSomeName/. Other syntax names have to be explicitly
mapped onto the corresponding filetype. mapped onto the corresponding filetype.
*g:tcomment#replacements_c*
g:tcomment#replacements_c (default: {...})
Replacements for c filetype.
*g:tcommentBlockC* *g:tcommentBlockC*
g:tcommentBlockC (default: {...}) g:tcommentBlockC (default: {...})
Generic c-like block comments. Generic c-like block comments.
@ -268,7 +350,7 @@ g:tcommentBlockC2 (default: {...})
Generic c-like block comments (alternative markup). Generic c-like block comments (alternative markup).
*g:tcommentInlineC* *g:tcommentInlineC*
g:tcommentInlineC (default: "/* %s */") g:tcommentInlineC (default: g:tcommentLineC)
Generic c-like comments. Generic c-like comments.
*g:tcommentBlockXML* *g:tcommentBlockXML*
@ -285,17 +367,37 @@ tcomment#DefineType(name, commentdef)
'commentstring' instead. We override the default values here in order 'commentstring' instead. We override the default values here in order
to have a blank after the comment marker. Block comments work only if to have a blank after the comment marker. Block comments work only if
we explicitly define the markup. we explicitly define the markup.
NAME usually is a 'filetype'. You can use special suffixes to define
special comment types. E.g. the name "FILETYPE_block" is used for
block comments for 'filetype'. The name "FILETYPE_inline" is used for
inline comments. If no specialized comment definition exists, the
normal one with name "FILETYPE" is used.
The comment definition can be either a string or a dictionary. The comment definition can be either a string or a dictionary.
If it is a string: If it is a string:
The format for block comments is similar to 'commentstrings' with the The format for block comments is similar to 'commentstrings' with the
exception that the format strings for blocks can contain a second line exception that the format strings for blocks can contain a second line
that defines how "middle lines" (see :h format-comments) should be that defines how "middle lines" (see :h format-comments) should be
displayed. displayed.
Example: If the string is "--%s--\n-- ", lines will be commented as
"--%s--" but the middle lines in block comments will be commented as
"--%s".
If it is a dictionary: If it is a dictionary:
See the help on the args argument of |tcomment#Comment|. See the help on the args argument of |tcomment#Comment| (see item 1,
args is a list of key=value pairs) to find out which fields can be
used.
*g:tcomment_types*
g:tcomment_types (default: {})
A dictionary of NAME => COMMENT DEFINITION (see |tcomment#DefineType|)
that can be set in vimrc to override tcomment's default comment
styles.
*tcomment#Comment()* *tcomment#Comment()*
tcomment#Comment(beg, end, ...) tcomment#Comment(beg, end, ...)
@ -304,6 +406,7 @@ tcomment#Comment(beg, end, ...)
1. a list of key=value pairs where known keys are (see also 1. a list of key=value pairs where known keys are (see also
|g:tcommentOptions|): |g:tcommentOptions|):
as=STRING ... Use a specific comment definition as=STRING ... Use a specific comment definition
count=N ... Repeat the comment string N times
col=N ... Start the comment at column N (in block col=N ... Start the comment at column N (in block
mode; must be smaller than |indent()|) mode; must be smaller than |indent()|)
mode=STRING ... See the notes below on the "commentMode" argument mode=STRING ... See the notes below on the "commentMode" argument
@ -311,7 +414,7 @@ tcomment#Comment(beg, end, ...)
end=STRING ... Comment postfix end=STRING ... Comment postfix
middle=STRING ... Middle line comments in block mode middle=STRING ... Middle line comments in block mode
rxbeg=N ... Regexp to find the substring of "begin" rxbeg=N ... Regexp to find the substring of "begin"
that should be multipied by "count" that should be multiplied by "count"
rxend=N ... The above for "end" rxend=N ... The above for "end"
rxmid=N ... The above for "middle" rxmid=N ... The above for "middle"
commentstring_rx ... A regexp format string that matches commentstring_rx ... A regexp format string that matches
@ -322,7 +425,7 @@ tcomment#Comment(beg, end, ...)
deducible. deducible.
2. 1-2 values for: ?commentPrefix, ?commentPostfix 2. 1-2 values for: ?commentPrefix, ?commentPostfix
3. a dictionary (internal use only) 3. a dictionary (internal use only)
commentMode: commentMode:
G ... guess the value of commentMode G ... guess the value of commentMode
B ... block (use extra lines for the comment markers) B ... block (use extra lines for the comment markers)
@ -334,6 +437,9 @@ tcomment#Comment(beg, end, ...)
By default, each line in range will be commented by adding the comment By default, each line in range will be commented by adding the comment
prefix and postfix. prefix and postfix.
*tcomment#SetOption()*
tcomment#SetOption(name, arg)
*tcomment#Operator()* *tcomment#Operator()*
tcomment#Operator(type, ...) tcomment#Operator(type, ...)
@ -354,6 +460,24 @@ tcomment#CommentAs(beg, end, commentAnyway, filetype, ?args...)
|tcomment#Comment()|) |tcomment#Comment()|)
comment text as if it were of a specific filetype comment text as if it were of a specific filetype
*tcomment#GuessCommentType()*
tcomment#GuessFileType(?options={})
A function that makes the s:GuessFileType() function usable for other
library developers.
The argument is a dictionary with the following keys:
beg ................ (default = line("."))
end ................ (default = line("."))
commentMode ........ (default = "G")
filetype ........... (default = &filetype)
fallbackFiletype ... (default = "")
This function return a dictionary that contains information about how
to make comments. The information about the filetype of the text
between lines "beg" and "end" is in the "filetype" key of the return
value. It returns the first discernible filetype it encounters.
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl: vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:

View File

@ -1,9 +1,9 @@
" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim> " AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> " Maintainer: Dr. Charles E. Campbell. <NdrOchipS@PcampbellAfamily.Mbiz>
" Date: Jun 18, 2012 " Date: Jan 07, 2013
" "
" NOTE: the code herein needs vim 7.0 or later " NOTE: the code herein needs vim 7.0 or later
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -37,7 +37,7 @@ if &cp || exists("g:loaded_AlignMapsPlugin")
finish finish
endif endif
let s:keepcpo = &cpo let s:keepcpo = &cpo
let g:loaded_AlignMapsPlugin = "v42" let g:loaded_AlignMapsPlugin = "v43"
set cpo&vim set cpo&vim
" ===================================================================== " =====================================================================
@ -53,8 +53,8 @@ com! AlignMapsClean :call AlignMaps#AlignMapsClean()
if !hasmapto('<Plug>WrapperStart') if !hasmapto('<Plug>WrapperStart')
map <unique> <SID>WS <Plug>AlignMapsWrapperStart map <unique> <SID>WS <Plug>AlignMapsWrapperStart
endif endif
nmap <silent> <script> <Plug>AlignMapsWrapperStart :set lz<CR>:call AlignMaps#WrapperStart(0)<CR> nnoremap <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> vnoremap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMaps#WrapperStart(1)<CR>
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" WE: wrapper end (internal) {{{2 " WE: wrapper end (internal) {{{2
@ -62,50 +62,52 @@ vmap <silent> <script> <Plug>AlignMapsWrapperStart :<c-u>set lz<CR>:call AlignMa
if !hasmapto('<Plug>WrapperEnd') if !hasmapto('<Plug>WrapperEnd')
nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd nmap <unique> <SID>WE <Plug>AlignMapsWrapperEnd
endif 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 " Complex C-code alignment maps: {{{2
if !hasmapto('<Plug>AM_a?') |map <unique> <Leader>a? <Plug>AM_a?|endif if !hasmapto('<Plug>AM_a?') |call AlignMaps#MakeMap("a?")|endif
if !hasmapto('<Plug>AM_a,') |map <unique> <Leader>a, <Plug>AM_a,|endif if !hasmapto('<Plug>AM_a,') |call AlignMaps#MakeMap("a,")|endif
if !hasmapto('<Plug>AM_a<') |map <unique> <Leader>a< <Plug>AM_a<|endif if !hasmapto('<Plug>AM_a<') |call AlignMaps#MakeMap("a<")|endif
if !hasmapto('<Plug>AM_a=') |map <unique> <Leader>a= <Plug>AM_a=|endif if !hasmapto('<Plug>AM_a=') |call AlignMaps#MakeMap("a=")|endif
if !hasmapto('<Plug>AM_a(') |map <unique> <Leader>a( <Plug>AM_a(|endif if !hasmapto('<Plug>AM_a(') |call AlignMaps#MakeMap("a(")|endif
if !hasmapto('<Plug>AM_abox') |map <unique> <Leader>abox <Plug>AM_abox|endif if !hasmapto('<Plug>AM_abox') |call AlignMaps#MakeMap("abox")|endif
if !hasmapto('<Plug>AM_acom') |map <unique> <Leader>acom <Plug>AM_acom|endif if !hasmapto('<Plug>AM_acom') |call AlignMaps#MakeMap("acom")|endif
if !hasmapto('<Plug>AM_adcom')|map <unique> <Leader>adcom <Plug>AM_adcom|endif if !hasmapto('<Plug>AM_adcom')|call AlignMaps#MakeMap("adcom")|endif
if !hasmapto('<Plug>AM_aocom')|map <unique> <Leader>aocom <Plug>AM_aocom|endif if !hasmapto('<Plug>AM_aocom')|call AlignMaps#MakeMap("aocom")|endif
if !hasmapto('<Plug>AM_ascom')|map <unique> <Leader>ascom <Plug>AM_ascom|endif if !hasmapto('<Plug>AM_ascom')|call AlignMaps#MakeMap("ascom")|endif
if !hasmapto('<Plug>AM_adec') |map <unique> <Leader>adec <Plug>AM_adec|endif if !hasmapto('<Plug>AM_adec') |call AlignMaps#MakeMap("adec")|endif
if !hasmapto('<Plug>AM_adef') |map <unique> <Leader>adef <Plug>AM_adef|endif if !hasmapto('<Plug>AM_adef') |call AlignMaps#MakeMap("adef")|endif
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif if !hasmapto('<Plug>AM_afnc') |call AlignMaps#MakeMap("afnc")|endif
" ---------------------------------------------------------------------
" Number alignment maps: {{{2 " Number alignment maps: {{{2
if !hasmapto('<Plug>AM_aunum')|map <unique> <Leader>aunum <Plug>AM_aunum|endif if !hasmapto('<Plug>AM_aunum')|call AlignMaps#MakeMap("aunum")|endif
if !hasmapto('<Plug>AM_aenum')|map <unique> <Leader>aenum <Plug>AM_aenum|endif if !hasmapto('<Plug>AM_aenum')|call AlignMaps#MakeMap("aenum")|endif
if exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber") 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 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 endif
" ---------------------------------------------------------------------
" Plug maps: (the real thing) {{{2 " Plug maps: (the real thing) {{{2
map <silent> <script> <Plug>AM_a? <SID>WS:AlignCtrl mIp1P1lC ? : : : : <CR>:'a,.Align<CR>:'a,'z-1s/\(\s\+\)? /?\1/e<CR><SID>WE nnoremap <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 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
map <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 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 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
map <silent> <script> <Plug>AM_a= <SID>WS:AlignCtrl mIp1P1=l<CR>:AlignCtrl g :=<CR>:'a,'zAlign :\==<CR><SID>WE nnoremap <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 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
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 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
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 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
map <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_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 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
map <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%([a-zA-Z_][a-zA-Z_0-9<>:]*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()<>:]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<CR>:call AlignMaps#StdAlign(1)<cr>:'y,'zv/^\s*[*/]/s/@ //ge<CR>:'y,'zv/^\s*[*/]/s/\(\s*\);/;\1/e<CR>:'y,'zv/^#/s/# //e<CR>:'y,'zv/^\s\+[*/#]/s/\([^/*]\)\(\*\+\)\( \+\)/\1\3\2/e<CR>:'y,'zv/^\s\+[*/#]/s/\((\+\)\( \+\)\*/\2\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/^\(\s\+\) \*/\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/[ \t@]*$//e<CR>:'y,'zs/^[*]/ */e<CR><SID>WE nnoremap <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%([a-zA-Z_][a-zA-Z_0-9<>:]*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()<>:]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<CR>:call AlignMaps#StdAlign(1)<cr>:'y,'zv/^\s*[*/]/s/@ //ge<CR>:'y,'zv/^\s*[*/]/s/\(\s*\);/;\1/e<CR>:'y,'zv/^#/s/# //e<CR>:'y,'zv/^\s\+[*/#]/s/\([^/*]\)\(\*\+\)\( \+\)/\1\3\2/e<CR>:'y,'zv/^\s\+[*/#]/s/\((\+\)\( \+\)\*/\2\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/^\(\s\+\) \*/\1*/e<CR>:'y,'zv/^\s\+[*/#]/s/[ \t@]*$//e<CR>:'y,'zs/^[*]/ */e<CR><SID>WE
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 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
map <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR> nnoremap <silent> <script> <Plug>AM_afnc :<c-u>set lz<CR>:silent call AlignMaps#Afnc()<CR>:set nolz<CR>
map <silent> <script> <Plug>AM_aunum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([.eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#\././ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([.#]\d*\)\=\<bar>[.#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#.]<CR>:'a,'zs/\([.#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE 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
map <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\([-+]\=\d\+\)\([eE][-+]\d\+\)\=/\1#\2/ge<CR>:'a,'zs/\([,eE][-+]\=\d\+\)#/\1/ge<CR>:'a,'zs/#,/,/ge<CR>:'a,'zs/[-+]\=\%(\d\+\%([,#]\d*\)\=\<bar>[,#]\d\+\)\%([eE][-+]\=\d\+\)\=/@&@/ge<CR>:AlignCtrl Imp0P0r<CR>:'a,'zAlign [@#,]<CR>:'a,'zs/\([,#]\)\(\s\+\)\(\d*\%([eE][-+]\=\d\+\)\=\)@/\1\3\2@/ge<CR>:'a,'zs/@//<CR>:'a,'zs/[#@]/ /ge<CR><SID>WE nnoremap <silent> <script> <Plug>AM_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 " html table alignment {{{2
if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
@ -113,86 +115,88 @@ map <silent> <script> <Plug>AM_Htd <SID>WS:'y,'zs%<[tT][rR]><[tT][dD][^>]\{-}>\<
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" character-based right-justified alignment maps {{{2 " 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|')|call AlignMaps#MakeMap("T|")|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,') |map <unique> <Leader>T, <Plug>AM_T,o|endif if !hasmapto('<Plug>AM_T,') |call AlignMaps#MakeMap("T,")|endif
if !hasmapto('<Plug>AM_Ts,') |map <unique> <Leader>Ts, <Plug>AM_Ts,|endif if !hasmapto('<Plug>AM_Ts,') |call AlignMaps#MakeMap("Ts,")|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;') |map <unique> <Leader>T; <Plug>AM_T;|endif if !hasmapto('<Plug>AM_T;') |call AlignMaps#MakeMap("T;")|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=') |map <unique> <Leader>T= <Plug>AM_T=|endif if !hasmapto('<Plug>AM_T=') |call AlignMaps#MakeMap("T=")|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@') |map <unique> <Leader>T@ <Plug>AM_T@|endif if !hasmapto('<Plug>AM_T@') |call AlignMaps#MakeMap("T@")|endif
if !hasmapto('<Plug>AM_TW@') |map <unique> <Leader>TW@ <Plug>AM_TW@|endif if !hasmapto('<Plug>AM_TW@') |call AlignMaps#MakeMap("TW@")|endif
if !hasmapto('<Plug>AM_Tab') |map <unique> <Leader>Tab <Plug>AM_Tab|endif if !hasmapto('<Plug>AM_Tab') |call AlignMaps#MakeMap("Tab")|endif
if !hasmapto('<Plug>AM_Tsp') |map <unique> <Leader>Tsp <Plug>AM_Tsp|endif if !hasmapto('<Plug>AM_Tsp') |call AlignMaps#MakeMap("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
map <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 <Bar><CR>:'a,.Align<CR><SID>WE
map <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
map <silent> <script> <Plug>AM_T, <SID>WS:AlignCtrl mIp0P1=r ,<CR>:'a,.Align<CR><SID>WE nnoremap <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 nnoremap <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 nnoremap <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 nnoremap <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 nnoremap <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" 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"
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 ?<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 nnoremap <silent> <script> <Plug>AM_T@ <SID>WS:AlignCtrl mIp0P0=r @<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_TW@ <SID>WS:AlignCtrl mWp0P0=r @<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_Tab <SID>WS:'a,.s/^\(\t*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\t','@','g'),'\')/<CR>:AlignCtrl mI=r @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE 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
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 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
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 ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" character-based left-justified alignment maps {{{2 " 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|','n') |call AlignMaps#MakeMap("t|")|endif
if !hasmapto('<Plug>AM_t#') |map <unique> <Leader>t# <Plug>AM_t#|endif if !hasmapto('<Plug>AM_t#','n') |call AlignMaps#MakeMap("t#")|endif
if !hasmapto('<Plug>AM_t,') |map <unique> <Leader>t, <Plug>AM_t,|endif if !hasmapto('<Plug>AM_t,','n') |call AlignMaps#MakeMap("t,")|endif
if !hasmapto('<Plug>AM_t:') |map <unique> <Leader>t: <Plug>AM_t:|endif if !hasmapto('<Plug>AM_t:','n') |call AlignMaps#MakeMap("t:")|endif
if !hasmapto('<Plug>AM_t;') |map <unique> <Leader>t; <Plug>AM_t;|endif if !hasmapto('<Plug>AM_t;','n') |call AlignMaps#MakeMap("t;")|endif
if !hasmapto('<Plug>AM_t<') |map <unique> <Leader>t< <Plug>AM_t<|endif if !hasmapto('<Plug>AM_t<','n') |call AlignMaps#MakeMap("t<")|endif
if !hasmapto('<Plug>AM_t=') |map <unique> <Leader>t= <Plug>AM_t=|endif if !hasmapto('<Plug>AM_t=','n') |call AlignMaps#MakeMap("t=")|endif
if !hasmapto('<Plug>AM_ts,') |map <unique> <Leader>ts, <Plug>AM_ts,|endif if !hasmapto('<Plug>AM_ts,','n') |call AlignMaps#MakeMap("ts,")|endif
if !hasmapto('<Plug>AM_ts:') |map <unique> <Leader>ts: <Plug>AM_ts:|endif if !hasmapto('<Plug>AM_ts:','n') |call AlignMaps#MakeMap("ts:")|endif
if !hasmapto('<Plug>AM_ts;') |map <unique> <Leader>ts; <Plug>AM_ts;|endif if !hasmapto('<Plug>AM_ts;','n') |call AlignMaps#MakeMap("ts;")|endif
if !hasmapto('<Plug>AM_ts<') |map <unique> <Leader>ts< <Plug>AM_ts<|endif if !hasmapto('<Plug>AM_ts<','n') |call AlignMaps#MakeMap("ts<")|endif
if !hasmapto('<Plug>AM_ts=') |map <unique> <Leader>ts= <Plug>AM_ts=|endif if !hasmapto('<Plug>AM_ts=','n') |call AlignMaps#MakeMap("ts=")|endif
if !hasmapto('<Plug>AM_w=') |map <unique> <Leader>w= <Plug>AM_w=|endif if !hasmapto('<Plug>AM_w=','n') |call AlignMaps#MakeMap("w=")|endif
if !hasmapto('<Plug>AM_t?') |map <unique> <Leader>t? <Plug>AM_t?|endif if !hasmapto('<Plug>AM_t?','n') |call AlignMaps#MakeMap("t?")|endif
if !hasmapto('<Plug>AM_t~') |map <unique> <Leader>t~ <Plug>AM_t~|endif if !hasmapto('<Plug>AM_t~','n') |call AlignMaps#MakeMap("t~")|endif
if !hasmapto('<Plug>AM_t@') |map <unique> <Leader>t@ <Plug>AM_t@|endif if !hasmapto('<Plug>AM_t@','n') |call AlignMaps#MakeMap("t@")|endif
if !hasmapto('<Plug>AM_tW@') |map <unique> <Leader>tW@ <Plug>AM_tW@|endif if !hasmapto('<Plug>AM_tW@','n') |call AlignMaps#MakeMap("tW@")|endif
if !hasmapto('<Plug>AM_m=') |map <unique> <Leader>m= <Plug>AM_m=|endif if !hasmapto('<Plug>AM_m=','n') |call AlignMaps#MakeMap("m=")|endif
if !hasmapto('<Plug>AM_tab') |map <unique> <Leader>tab <Plug>AM_tab|endif if !hasmapto('<Plug>AM_tab','n') |call AlignMaps#MakeMap("tab")|endif
if !hasmapto('<Plug>AM_tml') |map <unique> <Leader>tml <Plug>AM_tml|endif if !hasmapto('<Plug>AM_tml','n') |call AlignMaps#MakeMap("tml")|endif
if !hasmapto('<Plug>AM_tsp') |map <unique> <Leader>tsp <Plug>AM_tsp|endif if !hasmapto('<Plug>AM_tsp','n') |call AlignMaps#MakeMap("tsp")|endif
if !hasmapto('<Plug>AM_tsq') |map <unique> <Leader>tsq <Plug>AM_tsq|endif if !hasmapto('<Plug>AM_tsq','n') |call AlignMaps#MakeMap("tsq")|endif
if !hasmapto('<Plug>AM_tt') |map <unique> <Leader>tt <Plug>AM_tt|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 " <Plug> normal mode mappings
map <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 mIp0P0=l <Bar><CR>:'a,.Align<CR><SID>WE
map <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 mIp0P0=l #<CR>:'a,.Align<CR><SID>WE
map <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><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 nnoremap <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 mIp0P0=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
map <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE nnoremap <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #\zs<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,\zs<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :\zs<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;\zs<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <\zs<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_w= <SID>WS:'a,'zg/=/s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zg/=/s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zg/=/s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zg/=/s/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mWp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1g/=/Align<CR>:'a,'z-1g/=/s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1g/=/s/\( \+\);/;\1/ge<CR>:'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e<CR>:'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1g/=/s/\xff/=/ge<CR>:'y,'zg/=/s/ @//eg<CR><SID>WE nnoremap <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =\zs<CR>:'a,.Align<CR><SID>WE
map <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_w= <SID>WS:'a,'zg/=/s/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zg/=/s@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zg/=/s/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zg/=/s/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mWp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1g/=/Align<CR>:'a,'z-1g/=/s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1g/=/s/\( \+\);/;\1/ge<CR>:'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e<CR>:'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1g/=/s/\xff/=/ge<CR>:'y,'zg/=/s/ @//eg<CR><SID>WE
map <silent> <script> <Plug>AM_t~ <SID>WS:AlignCtrl mIp0P0=l ~<CR>:'a,.Align<CR>:'y,'zs/ \( *\);/;\1/ge<CR><SID>WE nnoremap <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:call AlignMaps#StdAlign(1)<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
map <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE nnoremap <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 nnoremap <silent> <script> <Plug>AM_tW@ <SID>WS:call AlignMaps#StdAlign(2)<cr><SID>WE
map <silent> <script> <Plug>AM_tab <SID>WS:'a,.s/^\(\t*\)\(.*\)$/\=submatch(1).escape(substitute(submatch(2),'\t',"\<Char-0x0f>",'g'),'\')/<CR>:if &ts == 1<bar>exe "AlignCtrl mI=lp0P0 \<Char-0x0f>"<bar>else<bar>exe "AlignCtrl mI=l"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE nnoremap <silent> <script> <Plug>AM_m= <SID>WS:'a,'zs/\s\+\([*/+\-%<Bar>&\~^]\==\)/ \1/e<CR>:'a,'zs@ \+\([*/+\-%<Bar>&\~^]\)=@\1=@ge<CR>:'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge<CR>:'a,'zs/!=/\="!\<Char-0x0f>"/ge<CR>'zk:AlignCtrl mIp1P1=l =<CR>:AlignCtrl g =<CR>:'a,'z-1Align<CR>:'a,'z-1s@\([*/+\-%<Bar>&\~^!=]\)\( \+\)=@\2\1=@ge<CR>:'a,'z-1s/\( \+\);/;\1/ge<CR>:'a,'z-s/%\ze[^=]/ @%@ /e<CR>'zk:call AlignMaps#StdAlign(1)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'a,'z-1s/\xff/=/ge<CR>:'y,'zs/ @//eg<CR><SID>WE
map <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE nnoremap <silent> <script> <Plug>AM_tab <SID>WS:'a,.s/^\(\t*\)\(.*\)$/\=submatch(1).escape(substitute(submatch(2),'\t',"\<Char-0x0f>",'g'),'\')/<CR>:if &ts == 1<bar>exe "AlignCtrl mI=lp0P0 \<Char-0x0f>"<bar>else<bar>exe "AlignCtrl mI=l"<bar>endif<CR>:'a,.Align <Char-0x0f><CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
map <silent> <script> <Plug>AM_tsp <SID>WS:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/@/ /g<CR><SID>WE nnoremap <silent> <script> <Plug>AM_tml <SID>WS:AlignCtrl mWp1P0=l \\\@<!\\\s*$<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:keepj 'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:keepj 'y+1,'z-1s/[%@]/ /g<CR><SID>WE 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
map <silent> <script> <Plug>AM_tt <SID>WS:AlignCtrl mIp1P1=l \\\@<!& \\\\<CR>:'a,.Align<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 " Menu Support: {{{1

View File

@ -1,9 +1,9 @@
" AlignPlugin: tool to align multiple fields based on one or more separators " 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 " Date: Nov 02, 2008
" GetLatestVimScripts: 294 1 :AutoInstall: Align.vim " GetLatestVimScripts: 294 1 :AutoInstall: Align.vim
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.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, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -22,7 +22,7 @@
if &cp || exists("g:loaded_AlignPlugin") if &cp || exists("g:loaded_AlignPlugin")
finish finish
endif endif
let g:loaded_AlignPlugin = "v36" let g:loaded_AlignPlugin = "v37"
let s:keepcpo = &cpo let s:keepcpo = &cpo
set cpo&vim set cpo&vim

View File

@ -1,12 +1,12 @@
" LogiPat: " LogiPat:
" Author: Charles E. Campbell, Jr. " Author: Charles E. Campbell
" Date: Sep 01, 2005 " Date: Mar 13, 2013
" Version: 2 " Version: 3
" Purpose: to do Boolean-logic based regular expression pattern matching " Purpose: to do Boolean-logic based regular expression pattern matching
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 " Copyright: Copyright (C) 1999-2011 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like most anything else that's free,
" LogiPat.vim is provided *as is* and comes with no warranty " LogiPat.vim is provided *as is* and comes with no warranty
" of any kind, either expressed or implied. By using this " of any kind, either expressed or implied. By using this
" plugin, you agree that in no event will the copyright " plugin, you agree that in no event will the copyright
@ -39,16 +39,18 @@
if &cp || exists("loaded_logipat") if &cp || exists("loaded_logipat")
finish finish
endif endif
let g:loaded_LogiPat = "v2" let g:loaded_LogiPat = "v3"
let s:keepcpo = &cpo let s:keepcpo = &cpo
set cpo&vim set cpo&vim
"DechoRemOn
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Public Interface: {{{1 " Public Interface: {{{1
com! -nargs=* LogiPat call LogiPat(<q-args>,1) com! -nargs=* LogiPat call LogiPat(<q-args>,1)
silent! com -nargs=* LP call LogiPat(<q-args>,1) silent! com -nargs=* LP call LogiPat(<q-args>,1)
com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>" com! -nargs=+ ELP echomsg LogiPat(<q-args>)
silent! com -nargs=+ LPF let s:LogiPatFlags="<args>" com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>"
silent! com -nargs=+ LPF let s:LogiPatFlags="<args>"
" ===================================================================== " =====================================================================
" Functions: {{{1 " Functions: {{{1
@ -75,32 +77,33 @@ fun! LogiPat(pat,...)
" call Decho("expr<".expr.">") " call Decho("expr<".expr.">")
if expr =~ '^"' if expr =~ '^"'
" push a Pattern " push a Pattern; accept "" as a single " in the pattern
let pat = substitute(strpart(expr,1),'^\([^"]*\)".*$','\1','') let expr = substitute(expr,'^\s*"','','')
let patlen = strlen(pat) - 1 let pat = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\1','')
" call Decho("pat<".pat."> patlen-1=".patlen) let pat = substitute(pat,'""','"','g')
if patlen > 1 && strpart(pat,patlen,1) == '\\' let expr = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\2','')
echoerr "LogiPat doesn't accept escaped backquotes in patterns (yet)" let expr = substitute(expr,'^\s*','','')
" call Dret("LogiPat --error--") " call Decho("pat<".pat."> expr<".expr.">")
return '--error--'
endif call s:LP_PatPush('.*'.pat.'.*')
call s:LP_PatPush('.*'.pat.'.*')
let patlen = patlen+3
let expr = strpart(expr,patlen)
elseif expr =~ '^[!()|&]' elseif expr =~ '^[!()|&]'
" push an operator " push an operator
let op = strpart(expr,0,1) let op = strpart(expr,0,1)
let expr = strpart(expr,strlen(op)) let expr = strpart(expr,strlen(op))
call s:LP_OpPush(op) " allow for those who can't resist doubling their and/or operators
if op =~ '[|&]' && expr[0] == op
let expr = strpart(expr,strlen(op))
endif
call s:LP_OpPush(op)
elseif expr =~ '^\s' elseif expr =~ '^\s'
" skip whitespace " skip whitespace
let expr= strpart(expr,1) let expr= strpart(expr,1)
else else
echoerr "operator<".strpart(expr,0,1)."> not supported (yet)" echoerr "operator<".strpart(expr,0,1)."> not supported (yet)"
let expr= strpart(expr,1) let expr= strpart(expr,1)
endif endif
endwhile endwhile
@ -137,6 +140,12 @@ fun! LogiPat(pat,...)
return result return result
endfun endfun
" ---------------------------------------------------------------------
" s:String: Vim6.4 doesn't have string() {{{2
func! s:String(str)
return "'".escape(a:str, '"')."'"
endfunc
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" LP_PatPush: {{{2 " LP_PatPush: {{{2
fun! s:LP_PatPush(pat) fun! s:LP_PatPush(pat)
@ -191,29 +200,30 @@ fun! s:LP_OpPush(op)
echoerr "expr<".expr."> not supported (yet)" echoerr "expr<".expr."> not supported (yet)"
let preclvl= s:preclvl let preclvl= s:preclvl
endif endif
" call Decho("new operator<".a:op."> preclvl=".preclvl)
" execute higher-precdence operators " execute higher-precdence operators
" call Decho("execute higher-precedence operators")
call s:LP_Execute(preclvl) call s:LP_Execute(preclvl)
" push new operator onto operator-stack " push new operator onto operator-stack
" call Decho("push new operator<".a:op."> onto stack with preclvl=".preclvl." at nopstack=".(s:nopstack+1))
if a:op =~ '!' if a:op =~ '!'
let s:nopstack = s:nopstack + 1 let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op let s:opstack_{s:nopstack} = a:op
elseif a:op =~ '|' elseif a:op =~ '|'
let preclvl= s:preclvl + 1
let s:nopstack = s:nopstack + 1 let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op let s:opstack_{s:nopstack} = a:op
elseif a:op == '&' elseif a:op == '&'
let preclvl= s:preclvl + 2
let s:nopstack = s:nopstack + 1 let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op let s:opstack_{s:nopstack} = a:op
endif endif
" call s:StackLook("oppush") "Decho " call s:StackLook("oppush") "Decho
" call Dret("LP_OpPush") " call Dret("LP_OpPush : s:preclvl=".s:preclvl)
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
@ -267,7 +277,7 @@ endfun
" LP_Or: writes a logical-or branch using two patterns {{{2 " LP_Or: writes a logical-or branch using two patterns {{{2
fun! s:LP_Or(pat1,pat2) fun! s:LP_Or(pat1,pat2)
" call Dfunc("LP_Or(pat1<".a:pat1."> pat2<".a:pat2.">)") " call Dfunc("LP_Or(pat1<".a:pat1."> pat2<".a:pat2.">)")
let ret= a:pat1.'\|'.a:pat2 let ret= '\%('.a:pat1.'\|'.a:pat2.'\)'
" call Dret("LP_Or ".ret) " call Dret("LP_Or ".ret)
return ret return ret
endfun endfun
@ -318,3 +328,8 @@ fun! s:StackLook(description)
" call Dret("StackLook") " call Dret("StackLook")
endfun endfun
" ---------------------------------------------------------------------
" Cleanup And Modeline: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" vim: ts=4 fdm=marker

View File

@ -1,9 +1,9 @@
" cecutil.vim : save/restore window position " cecutil.vim : save/restore window position
" save/restore mark position " save/restore mark position
" save/restore selected user maps " save/restore selected user maps
" Author: Charles E. Campbell, Jr. " Author: Charles E. Campbell
" Version: 18h ASTRO-ONLY " Version: 18h ASTRO-ONLY
" Date: Apr 05, 2010 " Date: Oct 16, 2012
" "
" Saving Restoring Destroying Marks: {{{1 " Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname) " call SaveMark(markname) let savemark= SaveMark(markname)
@ -459,13 +459,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap let amap= "\<c-v>".amap
endif endif
let amap = a:maplead.amap 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) != "" if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
endif endif
if dounmap if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap exe "sil! ".mapmode."unmap ".dobuffer.amap
endif endif
" save single map <something> " save single map <something>
@ -476,13 +476,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap let amap= "\<c-v>".amap
" call Decho("amap[[".amap."]]") " call Decho("amap[[".amap."]]")
endif 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) != "" if maparg(a:mapchx,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif endif
if dounmap if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap exe "sil! ".mapmode."unmap ".dobuffer.amap
endif endif
" save multiple maps " save multiple maps
@ -494,13 +494,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
if amap == "|" || amap == "\<c-v>" if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap let amap= "\<c-v>".amap
endif 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) != "" if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge') let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif endif
if dounmap if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap exe "sil! ".mapmode."unmap ".dobuffer.amap
endif endif
let i= i + 1 let i= i + 1
endwhile endwhile
@ -517,7 +517,7 @@ fun! RestoreUserMaps(suffix)
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e') let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
if s:restoremap_{a:suffix} != "" if s:restoremap_{a:suffix} != ""
" call Decho("exe ".s:restoremap_{a:suffix}) " call Decho("exe ".s:restoremap_{a:suffix})
exe "silent! ".s:restoremap_{a:suffix} exe "sil! ".s:restoremap_{a:suffix}
endif endif
unlet s:restoremap_{a:suffix} unlet s:restoremap_{a:suffix}
endif endif

View File

@ -4,7 +4,10 @@
" License: This File is placed in the Public Domain. " License: This File is placed in the Public Domain.
" Revision | Date [DD.MM.YY] | Changes " Revision | Date [DD.MM.YY] | Changes
" 00.01.00 | 05.07.09 | 01. Revision " 00.01.00 | 05.07.09 | 01. Revision
" 00.01.10 | | -
" 00.02.00 | 29.03.10 | Fun added, MakeSrecS5() " 00.02.00 | 29.03.10 | Fun added, MakeSrecS5()
" 00.02.10 | | -
" 00.02.20 | 15.11.12 | Fun added, MakeSrecSet()
if exists("loaded_editsrec") if exists("loaded_editsrec")
finish finish
@ -62,23 +65,30 @@ endif
noremap <unique> <script> <Plug>EditSrecPartCS <SID>AutoPartCS noremap <unique> <script> <Plug>EditSrecPartCS <SID>AutoPartCS
noremap <SID>AutoPartCS <Esc>:call <SID>AutoPartCS()<CR> noremap <SID>AutoPartCS <Esc>:call <SID>AutoPartCS()<CR>
" M0
" M1
" M2
" M3
" M4
" M5 = MakeS5 " M5 = MakeS5
if !hasmapto('<Plug>MakeSrecLineS5') if !hasmapto('<Plug>MakeSrecLineS5')
map <unique> <Leader>m5 <Plug>MakeSrecLineS5 map <unique> <Leader>m5 <Plug>MakeSrecLineS5
endif endif
noremap <unique> <script> <Plug>MakeSrecLineS5 <SID>MakeSrecS5 noremap <unique> <script> <Plug>MakeSrecLineS5 <SID>MakeSrecS5
noremap <SID>MakeSrecS5 <Esc>:call <SID>MakeSrecS5()<CR> noremap <SID>MakeSrecS5 <Esc>:call <SID>MakeSrecS5()<CR>
" M6
" M7
" M8
" M9
" obsolete Mappings " MS = MakeSet
"imap <F5> <Esc>:call <SID>AutoLineBC()<CR>a if !hasmapto('<Plug>MakeSet')
"imap <F6> <Esc>:call <SID>AutoLineAD()<CR>a map <unique> <Leader>ms <Plug>MakeSet
"imap <F7> <Esc>:call <SID>AutoLineDA()<CR>a endif
"imap <F8> <Esc>:call <SID>AutoLineCS()<CR>a noremap <unique> <script> <Plug>MakeSet <SID>MakeSrecSet
"imap <C-F5> <Esc>:call <SID>AutoPartBC()<CR>a noremap <SID>MakeSrecSet <Esc>:call <SID>MakeSrecSet()<CR>
"imap <C-F6> <Esc>:call <SID>AutoPartAD()<CR>a
"imap <C-F7> <Esc>:call <SID>AutoPartDA()<CR>a
"imap <C-F8> <Esc>:call <SID>AutoPartCS()<CR>a
" Functions
" create Line from ByteCount " create Line from ByteCount
fun s:AutoLineBC() fun s:AutoLineBC()
let s:ln = getline(".") let s:ln = getline(".")
@ -184,5 +194,123 @@ fun s:MakeSrecS5()
unlet s:ln unlet s:ln
endfun endfun
" make srec set
fun s:MakeSrecSet()
" Dict for Type of Record
let s:dict = { 2: "S1",
\ 3: "S2",
\ 4: "S3" }
let s:ln = getline(".")
call inputsave()
let s:nodl = input('Num of Data-Lines: ')
call inputrestore()
call inputsave()
let s:nodb = input('Num of Data-Bytes: ')
call inputrestore()
call inputsave()
let s:noab = input('Num of Addr-Bytes: ')
call inputrestore()
call inputsave()
let s:atad = input('at Addr: ')
call inputrestore()
" check for valid Range, Type of Record
if ((s:noab > 1) && (s:noab < 5))
let s:tosr = s:dict[s:noab]
else
let s:tosr = ""
" bypass the Loop below
let s:nodl = 0
endif
" Cntr of Data Lines
let s:dlct = s:nodl
while s:dlct > 0
" get Cursor Line
let s:cl = line(".")
" append Line with Type
call append(".", s:tosr)
call cursor(s:cl + 1, 1)
let s:ln = getline(".")
" create ByteCount
"-----------------------------------
" calc Input for ByteCount
let s:hxin = s:nodb + s:noab + 1
" convert to Hex Value,
" Hex String without "0x"
let s:hxva = "0123456789ABCDEF"
let s:srbc = ""
while s:hxin
let s:srbc = s:hxva[s:hxin % 16] . s:srbc
let s:hxin = s:hxin / 16
endwhile
" add missing Zeros
while strlen(s:srbc) < 2
let s:srbc = "0" . s:srbc
endwhile
" Exception Handling
if strlen(s:srbc) > 2
" check Number of ByteCount Bytes
let s:srbc = "__cNBB__"
endif
let s:ln = s:ln . s:srbc
"-----------------------------------
" create Addr, but with running Vals
"-----------------------------------
" calc Input for Addr
let s:hxin = s:atad + ((s:nodl - s:dlct) * s:nodb)
" convert to Hex Value,
" Hex String without "0x"
let s:hxva = "0123456789ABCDEF"
let s:srad = ""
while s:hxin
let s:srad = s:hxva[s:hxin % 16] . s:srad
let s:hxin = s:hxin / 16
endwhile
" add missing Zeros
while strlen(s:srad) < (2 * s:noab)
let s:srad = "0" . s:srad
endwhile
" Exception Handling
if strlen(s:srad) > (2 * s:noab)
" check Number of Address Bytes
let s:srad = "__cNAB__"
endif
let s:ln = s:ln . s:srad
"-----------------------------------
let s:ln = s:ln . libsrec#CrDA(s:ln)
let s:ln = s:ln . libsrec#CrCS(s:ln)
call setline(".", s:ln)
let s:dlct = s:dlct - 1
unlet s:srad
unlet s:srbc
unlet s:hxva
unlet s:hxin
unlet s:cl
endwhile
unlet s:dlct
unlet s:tosr
unlet s:atad
unlet s:noab
unlet s:nodb
unlet s:nodl
unlet s:ln
unlet s:dict
endfun
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@ -6,7 +6,9 @@
" 00.01.00 | 05.07.09 | 01. Revision " 00.01.00 | 05.07.09 | 01. Revision
" 00.01.10 | 29.03.10 | BugFix, in libsrec#CrCS() " 00.01.10 | 29.03.10 | BugFix, in libsrec#CrCS()
" | | leading Zeros in Result " | | leading Zeros in Result
" 00.02.00 | 29.03.10 | Fun added " 00.02.00 | 29.03.10 | Fun added, MakeSrecS5()
" 00.02.10 | | -
" 00.02.20 | 16.11.12 | Fun added, MakeSrecSet()
" This File contains Test Cases for the Plugin 'editsrec.vim' " This File contains Test Cases for the Plugin 'editsrec.vim'
" and its Library 'libsrec.vim'. " and its Library 'libsrec.vim'.
@ -338,12 +340,14 @@ type "<Esc><Leader>pc"
the following Line will be created the following Line will be created
S9030000FC S9030000FC
TestCase for leading Zeros ------- TestCase for leading Zeros -------
insert a new Line and type "S30F00000000000000000000000000EE" insert a new Line and type "S30F00000000000000000000000000EE"
type "<Esc><Leader>lc" type "<Esc><Leader>lc"
the following Line will be created the following Line will be created
S30F00000000000000000000000000EE02 S30F00000000000000000000000000EE02
TestCase for Making S5 Record ---- TestCase for Making S5 Record ----
insert insert
S30F00000000000000000000000000EE02 S30F00000000000000000000000000EE02
@ -354,3 +358,57 @@ type "<Esc><Leader>m5"
the following Line will be created the following Line will be created
S5030003FC S5030003FC
TestCase for Making Set ----------
type "<Esc><Leader>ms"
answer the Questions
Num of Data-Lines: 5
Num of Data-Bytes: 4
Num of Addr-Bytes: 2
at Addr: 0x00
the following Lines will be created
S1070000FFFFFFFFFC
S1070004FFFFFFFFF8
S1070008FFFFFFFFF4
S107000CFFFFFFFFF0
S1070010FFFFFFFFEC
type "<Esc><Leader>ms"
answer the Questions
Num of Data-Lines: 5
Num of Data-Bytes: 4
Num of Addr-Bytes: 3
at Addr: 0x00
the following Lines will be created
S208000000FFFFFFFFFB
S208000004FFFFFFFFF7
S208000008FFFFFFFFF3
S20800000CFFFFFFFFEF
S208000010FFFFFFFFEB
type "<Esc><Leader>ms"
answer the Questions
Num of Data-Lines: 5
Num of Data-Bytes: 8
Num of Addr-Bytes: 4
at Addr: 0x00
the following Lines will be created
S30D00000000FFFFFFFFFFFFFFFFFA
S30D00000008FFFFFFFFFFFFFFFFF2
S30D00000010FFFFFFFFFFFFFFFFEA
S30D00000018FFFFFFFFFFFFFFFFE2
S30D00000020FFFFFFFFFFFFFFFFDA
type "<Esc><Leader>ms"
answer the Questions
Num of Data-Lines: 5
Num of Data-Bytes: 4
Num of Addr-Bytes: 3
at Addr: 0x4000
the following Lines will be created
S208004000FFFFFFFFBB
S208004004FFFFFFFFB7
S208004008FFFFFFFFB3
S20800400CFFFFFFFFAF
S208004010FFFFFFFFAB

View File

@ -1,9 +1,9 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network " netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION " PLUGIN SECTION
" Date: Feb 10, 2011 " Date: Dec 06, 2012
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 " Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free, " notice is copied with it. Like anything else that's free,
@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin") if &cp || exists("g:loaded_netrwPlugin")
finish finish
endif endif
let g:loaded_netrwPlugin = "v142" let g:loaded_netrwPlugin = "v147"
if v:version < 702 if v:version < 702
echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None
finish finish
@ -47,20 +47,15 @@ augroup END
" Network Browsing Reading Writing: {{{2 " Network Browsing Reading Writing: {{{2
augroup Network augroup Network
au! au!
if has("win32") || has("win95") || has("win64") || has("win16") au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>")) au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>"))
else au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>"))
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>")) au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>"))
au BufReadCmd file://localhost/* call netrw#FileUrlRead(substitute(expand("<amatch>")),'file://localhost/','file:///','') au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>"))
endif
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>"))
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "silent doau FileReadPost ".fnameescape(expand("<amatch>"))
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau BufWritePost ".fnameescape(expand("<amatch>"))
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau FileWritePost ".fnameescape(expand("<amatch>"))
try try
au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
catch /^Vim\%((\a\+)\)\=:E216/ catch /^Vim\%((\a\+)\)\=:E216/
au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) au SourcePre ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>"))
endtry endtry
augroup END augroup END

View File

@ -2,30 +2,32 @@
" @Author: Tom Link (micathom AT gmail com) " @Author: Tom Link (micathom AT gmail com)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 27-Dez-2004. " @Created: 27-Dez-2004.
" @Last Change: 2011-05-26. " @Last Change: 2012-11-26.
" @Revision: 720 " @Revision: 762
" GetLatestVimScripts: 1173 1 tcomment.vim " GetLatestVimScripts: 1173 1 tcomment.vim
if &cp || exists('loaded_tcomment') if &cp || exists('loaded_tcomment')
finish finish
endif endif
let loaded_tcomment = 205 let loaded_tcomment = 208
if !exists("g:tcommentMapLeader1") if !exists("g:tcommentMapLeader1")
" g:tcommentMapLeader1 should be a shortcut that can be used with " g:tcommentMapLeader1 should be a shortcut that can be used with
" map, imap, vmap. " map, imap, vmap.
let g:tcommentMapLeader1 = '<c-_>' let g:tcommentMapLeader1 = '<c-_>' "{{{2
endif endif
if !exists("g:tcommentMapLeader2") if !exists("g:tcommentMapLeader2")
" g:tcommentMapLeader2 should be a shortcut that can be used with " g:tcommentMapLeader2 should be a shortcut that can be used with
" map, xmap. " map, xmap.
let g:tcommentMapLeader2 = '<Leader>_' let g:tcommentMapLeader2 = '<Leader>_' "{{{2
endif endif
if !exists("g:tcommentMapLeaderOp1") if !exists("g:tcommentMapLeaderOp1")
let g:tcommentMapLeaderOp1 = 'gc' " See |tcomment-operator|.
let g:tcommentMapLeaderOp1 = 'gc' "{{{2
endif endif
if !exists("g:tcommentMapLeaderOp2") if !exists("g:tcommentMapLeaderOp2")
let g:tcommentMapLeaderOp2 = 'gC' " See |tcomment-operator|.
let g:tcommentMapLeaderOp2 = 'gC' "{{{2
endif endif
@ -106,7 +108,8 @@ if (g:tcommentMapLeader1 != '')
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>' exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>' exec 'noremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'i :TCommentInline<cr>' exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'i :TCommentInline<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>' exec 'noremap <silent> '. g:tcommentMapLeader1 .'i v:TCommentInline mode=I#<cr>'
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'i <c-\><c-o>v:TCommentInline mode=#<cr>'
exec 'noremap '. g:tcommentMapLeader1 .'b :TCommentBlock<cr>' exec 'noremap '. g:tcommentMapLeader1 .'b :TCommentBlock<cr>'
exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>' exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs ' exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs '
@ -115,6 +118,14 @@ if (g:tcommentMapLeader1 != '')
exec 'inoremap '. g:tcommentMapLeader1 .'n <c-o>:TCommentAs <c-r>=&ft<cr> ' exec 'inoremap '. g:tcommentMapLeader1 .'n <c-o>:TCommentAs <c-r>=&ft<cr> '
exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_' exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_'
exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_' exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_'
exec 'noremap <silent> '. g:tcommentMapLeader1 .'cc :<c-u>call tcomment#SetOption("count", v:count1)<cr>'
exec 'noremap '. g:tcommentMapLeader1 .'ca :<c-u>call tcomment#SetOption("as", input("Comment as: ", &filetype, "customlist,tcomment#Complete"))<cr>'
for s:i in range(1, 9)
exec 'noremap <silent> '. g:tcommentMapLeader1 . s:i .' :TComment count='. s:i .'<cr>'
exec 'inoremap <silent> '. g:tcommentMapLeader1 . s:i .' <c-\><c-o>:TComment count='. s:i .'<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 . s:i .' :TCommentMaybeInline count='. s:i .'<cr>'
endfor
unlet s:i
endif endif
if (g:tcommentMapLeader2 != '') if (g:tcommentMapLeader2 != '')
exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>' exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>'
@ -123,20 +134,24 @@ if (g:tcommentMapLeader2 != '')
exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment ' exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment '
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<cr>' exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>' exec 'noremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
exec 'noremap '. g:tcommentMapLeader2 .'b :TCommentBlock<cr>' exec 'noremap '. g:tcommentMapLeader2 .'b :TCommentBlock<cr>'
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs ' exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
exec 'noremap '. g:tcommentMapLeader2 .'n :TCommentAs <c-r>=&ft<cr> ' exec 'noremap '. g:tcommentMapLeader2 .'n :TCommentAs <c-r>=&ft<cr> '
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_' exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
endif endif
if (g:tcommentMapLeaderOp1 != '') if (g:tcommentMapLeaderOp1 != '')
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#Operator<cr>g@' exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .' :<c-u>if v:count > 0 \| call tcomment#SetOption("count", v:count) \| endif \| let w:tcommentPos = getpos(".") \| set opfunc=tcomment#Operator<cr>g@'
for s:i in range(1, 9)
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 . s:i .'c :let w:tcommentPos = getpos(".") \| call tcomment#SetOption("count", '. s:i .') \| set opfunc=tcomment#Operator<cr>g@'
endfor
unlet s:i
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLine<cr>g@$' exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLine<cr>g@$'
exec 'xnoremap <silent> '. g:tcommentMapLeaderOp1 .' :TCommentMaybeInline<cr>' exec 'xnoremap <silent> '. g:tcommentMapLeaderOp1 .' :TCommentMaybeInline<cr>'
endif endif
if (g:tcommentMapLeaderOp2 != '') if (g:tcommentMapLeaderOp2 != '')
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorAnyway<cr>g@' exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorAnyway<cr>g@'
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLineAnyway<cr>g@$' exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLineAnyway<cr>g@$'
exec 'xnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline<cr>' exec 'xnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline!<cr>'
endif endif
" vi: ft=vim:tw=72:ts=4:fo=w2croql

View File

@ -65,7 +65,7 @@ let s:bzrFunctions = {}
" Returns the executable used to invoke bzr suitable for use in a shell " Returns the executable used to invoke bzr suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandBZRExec', 'bzr') return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText) {{{2

View File

@ -378,31 +378,21 @@ endfunction
" command line on Windows systems. " command line on Windows systems.
function! s:VCSCommandUtility.system(...) function! s:VCSCommandUtility.system(...)
if (has("win32") || has("win64")) && &sxq !~ '"' let output = call('system', a:000)
let save_sxq = &sxq if exists('*iconv') && has('multi_byte')
set sxq=\" if(strlen(&tenc) && &tenc != &enc)
endif let output = iconv(output, &tenc, &enc)
try else
let output = call('system', a:000) let originalBuffer = VCSCommandGetOriginalBuffer(VCSCommandGetOption('VCSCommandEncodeAsFile', 0))
if exists('*iconv') && has('multi_byte') if originalBuffer
if(strlen(&tenc) && &tenc != &enc) let fenc = getbufvar(originalBuffer, '&fenc')
let output = iconv(output, &tenc, &enc) if fenc != &enc
else let output = iconv(output, fenc, &enc)
let originalBuffer = VCSCommandGetOriginalBuffer(VCSCommandGetOption('VCSCommandEncodeAsFile', 0))
if originalBuffer
let fenc = getbufvar(originalBuffer, '&fenc')
if fenc != &enc
let output = iconv(output, fenc, &enc)
endif
endif endif
endif endif
endif
endif endif
finally
if exists("save_sxq")
let &sxq = save_sxq
endif
endtry
return output return output
endfunction endfunction
@ -1033,8 +1023,7 @@ function! s:VCSVimDiff(...)
let b:VCSCommandCommand = 'vimdiff' let b:VCSCommandCommand = 'vimdiff'
diffthis diffthis
let t:vcsCommandVimDiffScratchList = [resultBuffer] let t:vcsCommandVimDiffScratchList = [resultBuffer]
" If no split method is defined, cheat, and set it to vertical. call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation})
call s:VCSCommandUtility.pushContext({'VCSCommandSplit': orientation})
try try
let resultBuffer = s:VCSReview(a:2) let resultBuffer = s:VCSReview(a:2)
finally finally
@ -1048,7 +1037,6 @@ function! s:VCSVimDiff(...)
diffthis diffthis
let t:vcsCommandVimDiffScratchList += [resultBuffer] let t:vcsCommandVimDiffScratchList += [resultBuffer]
else else
" Add new buffer. Force splitting behavior, otherwise why use vimdiff?
call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation}) call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation})
try try
if(a:0 == 0) if(a:0 == 0)

View File

@ -111,7 +111,7 @@ let s:cvsFunctions = {}
" Returns the executable used to invoke cvs suitable for use in a shell " Returns the executable used to invoke cvs suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandCVSExec', 'cvs') return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2

View File

@ -70,7 +70,7 @@ let s:gitFunctions = {}
" Returns the executable used to invoke git suitable for use in a shell " Returns the executable used to invoke git suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandGitExec', 'git') return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2

View File

@ -72,7 +72,7 @@ let s:hgFunctions = {}
" Returns the executable used to invoke hg suitable for use in a shell " Returns the executable used to invoke hg suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandHGExec', 'hg') return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2

View File

@ -65,7 +65,7 @@ let s:svkFunctions = {}
" Returns the executable used to invoke SVK suitable for use in a shell " Returns the executable used to invoke SVK suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandSVKExec', 'svk') return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2

View File

@ -72,7 +72,7 @@ let s:svnFunctions = {}
" Returns the executable used to invoke git suitable for use in a shell " Returns the executable used to invoke git suitable for use in a shell
" command. " command.
function! s:Executable() function! s:Executable()
return VCSCommandGetOption('VCSCommandSVNExec', 'svn') return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
endfunction endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2 " Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -193,6 +193,10 @@ function! s:svnFunctions.GetBufferInfo()
if statusText =~ '^?' if statusText =~ '^?'
return ['Unknown'] return ['Unknown']
endif endif
" File explicitly ignored by SVN.
if statusText =~ '^I'
return ['Ignored']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3] let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
if revision == '' if revision == ''

View File

@ -1,7 +1,7 @@
" Language : Netrw Remote-Directory Listing Syntax " Language : Netrw Remote-Directory Listing Syntax
" Maintainer : Charles E. Campbell, Jr. " Maintainer : Charles E. Campbell, Jr.
" Last change: Jan 14, 2009 " Last change: Dec 18, 2012
" Version : 16 " Version : 17
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Syntax Clearing: {{{1 " Syntax Clearing: {{{1
@ -22,7 +22,7 @@ syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell
syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell
syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime
syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwExe "\%(\S\+ \)*\S*[^~]\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell
syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup syn match netrwTreeBar "^\%([-+|] \)\+" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup
syn match netrwTreeBarSpace " " contained syn match netrwTreeBarSpace " " contained
@ -56,14 +56,17 @@ if exists("g:netrw_special_syntax") && netrw_special_syntax
if has("unix") if has("unix")
syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell
endif endif
syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell
syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell
syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell
syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar,@NoSpell syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\)" contains=netrwTreeBar,@NoSpell
syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell
syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell
syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell
syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell
syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell
syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell
syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar,@NoSpell syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell
syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell
syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell
endif endif
@ -95,12 +98,15 @@ if !exists("did_drchip_netrwlist_syntax")
hi default link netrwCompress Folded hi default link netrwCompress Folded
hi default link netrwCoreDump WarningMsg hi default link netrwCoreDump WarningMsg
hi default link netrwData DiffChange hi default link netrwData DiffChange
hi default link netrwHdr netrwPlain
hi default link netrwLex netrwPlain
hi default link netrwLib DiffChange hi default link netrwLib DiffChange
hi default link netrwMakefile DiffChange hi default link netrwMakefile DiffChange
hi default link netrwObj Folded hi default link netrwObj Folded
hi default link netrwTilde Folded hi default link netrwTilde Folded
hi default link netrwTmp Folded hi default link netrwTmp Folded
hi default link netrwTags Folded hi default link netrwTags Folded
hi default link netrwYacc netrwPlain
endif endif
" Current Syntax: {{{1 " Current Syntax: {{{1