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

View File

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

View File

@ -1,8 +1,8 @@
" AlignMaps.vim : support functions for AlignMaps
" Author: Charles E. Campbell, Jr.
" Date: Jun 18, 2012
" Version: 42
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
" Author: Charles E. Campbell
" Date: Mar 12, 2013
" Version: 43
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@ -16,7 +16,7 @@
if &cp || exists("g:loaded_AlignMaps")
finish
endif
let g:loaded_AlignMaps= "v42"
let g:loaded_AlignMaps= "v43"
let s:keepcpo = &cpo
set cpo&vim
"DechoTabOn
@ -111,6 +111,20 @@ fun! AlignMaps#WrapperEnd() range
" call Dret("AlignMaps#WrapperEnd : alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z"))
endfun
" ---------------------------------------------------------------------
" AlignMaps#MakeMap: make both a normal-mode and a visual mode map for mapname {{{2
fun! AlignMaps#MakeMap(mapname)
if exists("g:maplocalleader")
let maplead= g:maplocalleader
elseif exists("g:mapleader")
let maplead= g:mapleader
else
let maplead= '\'
endif
exe "nmap <unique> ".maplead.a:mapname." <Plug>AM_".a:mapname
exe "vmap <silent> ".maplead.a:mapname.' :call AlignMaps#Vis("'.a:mapname.'")'."<cr>"
endfun
" ---------------------------------------------------------------------
" AlignMaps#StdAlign: some semi-standard align calls {{{2
fun! AlignMaps#StdAlign(mode) range
@ -169,15 +183,15 @@ endfun
" AlignMaps#Equals: supports \t= and \T= {{{2
fun! AlignMaps#Equals() range
" call Dfunc("AlignMaps#Equals()")
keepj 'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e
keepj 'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge
keepj 'a,'zs/\s\+\([.*/+\-%|&\~^]\==\)/ \1/e
keepj 'a,'zs@ \+\([.*/+\-%|&\~^]\)=@\1=@ge
keepj 'a,'zs/==/\="\<Char-0x0f>\<Char-0x0f>"/ge
keepj 'a,'zs/\([!<>:]\)=/\=submatch(1)."\<Char-0x0f>"/ge
keepj norm g'zk
AlignCtrl mIp1P1=l =
AlignCtrl g =
keepj 'a,'z-1Align
keepj 'a,'z-1s@\([*/%|&\~^!=]\)\( \+\)=@\2\1=@ge
keepj 'a,'z-1s@\([.*/%|&\~^!=]\)\( \+\)=@\2\1=@ge
keepj 'a,'z-1s@[^+\-]\zs\([+\-]\)\( \+\)=@\2\1=@ge
keepj 'a,'z-1s/\( \+\);/;\1/ge
if &ft == "c" || &ft == "cpp"
@ -323,37 +337,6 @@ fun! AlignMaps#FixMultiDec()
let curline = getline(".")
" call Decho("curline<".curline.">")
" " Attempt to ignore function calls (ie. double x=pow(2.,3.),...
" let leader= substitute(curline,'^\s*\([a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+.*$','\1','')
" let i = strlen(leader)
" let paren = 0
" let fmd = strpart(curline,i)
" let ifmd = i
" call Decho("fmd<".fmd."> ifmd=".ifmd)
" while i < strlen(curline)
" if strpart(curline,i,1) == '('
" let paren= paren+1
" elseif strpart(curline,i,1) == ')' && paren > 0
" let paren= paren-1
" elseif strpart(curline,i,1) == '='
" let eq= 1
" elseif strpart(curline,i,1) == ';'
" let paren = 0
" let eq = 0
" let fmd = fmd.strpart(fmd,ifmd,i-ifmd).";\<cr>"
" let ifmd = i + 2
" let i = i + 1
" let leader= substitute(curline,'^\s*\([a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+.*$','\1','')
" elseif strpart(curline,i,1) == ','
" if paren == 0
" let fmd = fmd.strpart(fmd,ifmd,i-ifmd).";\<cr>"
" let ifmd = i + 2
" let i = i + 1
" endif
" endif
" let i= i + 1
" endwhile
" Get the type. I'm assuming one type per line (ie. int x; double y; on one line will not be handled properly)
let @x=substitute(curline,'^\(\s*[a-zA-Z_ \t][a-zA-Z0-9<>_ \t]*\)\s\+[(*]*\h.*$','\1','')
" call Decho("@x<".@x.">")
@ -386,6 +369,31 @@ fun! AlignMaps#AlignMapsClean()
" call Dret("AlignMaps#AlignMapsClean")
endfun
" ---------------------------------------------------------------------
" AlignMaps#Vis: interfaces with visual maps {{{2
fun! AlignMaps#Vis(plugmap) range
" call Dfunc("AlignMaps#VisCall(plugmap<".a:plugmap.">) ".a:firstline.",".a:lastline)
let amark= SaveMark("a")
exe a:firstline
ka
exe a:lastline
if exists("g:maplocalleader")
let maplead= g:maplocalleader
elseif exists("g:mapleader")
let maplead= g:mapleader
else
let maplead= '\'
endif
" call Decho("exe norm ".maplead.a:plugmap)
exe " norm ".maplead.a:plugmap
call RestoreMark(amark)
" call Dret("AlignMaps#VisCall")
endfun
" ---------------------------------------------------------------------
" Restore: {{{1
let &cpo= s:keepcpo

View File

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

View File

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

View File

@ -9,6 +9,7 @@
" 00.02.00 | 29.03.10 | Fun added, MkS5()
" 00.02.10 | 15.06.10 | BugFix, in libsrec#CrCS()
" | | wrong Source for CS
" 00.02.20 | | -
" create ByteCount
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
" netrw's browsers' x command ("eXecute launcher")
" Author: Charles E. Campbell, Jr.
" Date: Sep 30, 2008
" Version: 10
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
" Author: Charles E. Campbell
" Date: Mar 14, 2012
" Version: 11a
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@ -20,7 +20,7 @@
if exists("g:loaded_netrwFileHandlers") || &cp
finish
endif
let g:loaded_netrwFileHandlers= "v10"
let g:loaded_netrwFileHandlers= "v11a"
if v:version < 702
echohl WarningMsg
echo "***warning*** this version of netrwFileHandlers needs vim 7.2"
@ -356,6 +356,7 @@ fun! s:NFH_obj(obj)
endfun
let &cpo= s:keepcpo
unlet s:keepcpo
" ---------------------------------------------------------------------
" Modelines: {{{1
" vim: fdm=marker

View File

@ -1,8 +1,8 @@
" netrwSettings.vim: makes netrw settings simpler
" 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
" 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,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@ -63,7 +63,7 @@ fun! netrwSettings#NetrwSettings()
endif
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 ='+ ---------------------------------------------'
let s:netrw_settings_stop= line(".")
@ -106,7 +106,7 @@ fun! netrwSettings#NetrwSettings()
put = 'let g:netrw_browsex_viewer = (not defined)'
endif
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("$")
put ='let g:netrw_decompress...'
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_liststyle = '.g:netrw_liststyle
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_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_menu = '.g:netrw_menu
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
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-09-17.
" @Last Change: 2011-04-12.
" @Revision: 0.0.407
" @Last Change: 2012-12-10.
" @Revision: 0.0.614
" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile
@ -13,9 +13,20 @@ if !exists("g:tcommentBlankLines")
let g:tcommentBlankLines = 1 "{{{2
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")
" 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
endif
@ -53,7 +64,7 @@ if !exists("g:tcommentGuessFileType")
let g:tcommentGuessFileType = 0 "{{{2
endif
if !exists("g:tcommentGuessFileType_dsl")
" For dsl documents, assumet filetype = xml.
" For dsl documents, assume filetype = xml.
let g:tcommentGuessFileType_dsl = 'xml' "{{{2
endif
if !exists("g:tcommentGuessFileType_php")
@ -74,9 +85,15 @@ endif
if !exists("g:tcommentGuessFileType_django")
let g:tcommentGuessFileType_django = 1 "{{{2
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")
" 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
" php files.
let g:tcommentIgnoreTypes_php = 'sql' "{{{2
@ -102,18 +119,49 @@ if !exists('g:tcommentSyntaxMap')
\ 'vimPythonRegion': 'python',
\ 'vimRubyRegion': 'ruby',
\ 'vimTclRegion': 'tcl',
\ 'Delimiter': {
\ 'filetype': {
\ 'php': 'php',
\ },
\ },
\ 'phpRegionDelimiter': {
\ 'prevnonblank': [
\ {'match': '<?php', 'filetype': 'php'},
\ {'match': '?>', 'filetype': 'html'},
\ ],
\ 'nextnonblank': [
\ {'match': '?>', 'filetype': 'php'},
\ {'match': '<?php', 'filetype': 'html'},
\ ],
\ },
\ }
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.
" :read: let g:tcommentBlockC = {...} "{{{2
let g:tcommentLineC = {
\ 'commentstring': '/* %s */',
\ 'replacements': g:tcomment#replacements_c
\ }
endif
if !exists("g:tcommentBlockC")
let g:tcommentBlockC = {
\ 'commentstring': '/*%s */',
\ 'middle': ' * ',
\ 'rxbeg': '\*\+',
\ 'rxend': '\*\+',
\ 'rxmid': '\*\+',
\ 'replacements': g:tcomment#replacements_c
\ }
endif
if !exists("g:tcommentBlockC2")
@ -125,11 +173,12 @@ if !exists("g:tcommentBlockC2")
\ 'rxbeg': '\*\+',
\ 'rxend': '\*\+',
\ 'rxmid': '\*\+',
\ 'replacements': g:tcomment#replacements_c
\ }
endif
if !exists("g:tcommentInlineC")
" Generic c-like comments.
let g:tcommentInlineC = "/* %s */" "{{{2
let g:tcommentInlineC = g:tcommentLineC "{{{2
endif
if !exists("g:tcommentBlockXML")
@ -150,6 +199,12 @@ let s:definitions = {}
" to have a blank after the comment marker. Block comments work only if
" 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.
"
" If it is a string:
@ -158,8 +213,14 @@ let s:definitions = {}
" that defines how "middle lines" (see :h format-comments) should be
" 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:
" 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)
if !has_key(s:definitions, a:name)
if type(a:commentdef) == 4
@ -173,12 +234,30 @@ function! tcomment#DefineType(name, commentdef)
let s:typesDirty = 1
endf
" :nodoc:
" Return comment definition
function! tcomment#GetCommentDef(name)
return get(s:definitions, a:name, "")
endf
" :nodoc:
" Return 1 if a comment type is defined.
function! tcomment#TypeExists(name)
return has_key(s:definitions, a:name)
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('ada', '-- %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_inline', g:tcommentInlineC )
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_block', g:tcommentBlockC )
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('conkyrc', '# %s' )
call tcomment#DefineType('crontab', '# %s' )
call tcomment#DefineType('cs', '// %s' )
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('debcontrol', '# %s' )
call tcomment#DefineType('desktop', '# %s' )
call tcomment#DefineType('django', '{# %s #}' )
call tcomment#DefineType('django_block', "{%% comment %%}%s{%% endcomment %%}\n ")
call tcomment#DefineType('dnsmasq', '# %s' )
call tcomment#DefineType('docbk', '<!-- %s -->' )
call tcomment#DefineType('docbk_inline', g:tcommentInlineXML)
call tcomment#DefineType('docbk_block', g:tcommentBlockXML )
@ -219,6 +303,7 @@ call tcomment#DefineType('erlang', '%%%% %s' )
call tcomment#DefineType('eruby', '<%%# %s' )
call tcomment#DefineType('fstab', '# %s' )
call tcomment#DefineType('gitcommit', '# %s' )
call tcomment#DefineType('gitignore', '# %s' )
call tcomment#DefineType('gtkrc', '# %s' )
call tcomment#DefineType('go', '// %s' )
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_block', g:tcommentBlockC )
call tcomment#DefineType('groovy_doc_block', g:tcommentBlockC2 )
call tcomment#DefineType('haml', '-# %s' )
call tcomment#DefineType('haskell', '-- %s' )
call tcomment#DefineType('haskell_block', "{-%s-}\n " )
call tcomment#DefineType('haskell_inline', '{- %s -}' )
call tcomment#DefineType('html', '<!-- %s -->' )
call tcomment#DefineType('html_inline', g:tcommentInlineXML)
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('jasmine', '# %s' )
call tcomment#DefineType('javaScript', '// %s' )
call tcomment#DefineType('javaScript_inline', g:tcommentInlineC )
call tcomment#DefineType('javaScript_block', g:tcommentBlockC )
@ -250,6 +340,7 @@ call tcomment#DefineType('lynx', '# %s' )
call tcomment#DefineType('matlab', '%% %s' )
call tcomment#DefineType('m4', 'dnl %s' )
call tcomment#DefineType('mail', '> %s' )
call tcomment#DefineType('monkey', ''' %s' )
call tcomment#DefineType('msidl', '// %s' )
call tcomment#DefineType('msidl_block', g:tcommentBlockC )
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_inline', '(* %s *)' )
call tcomment#DefineType('ocaml_block', "(*%s*)\n " )
call tcomment#DefineType('pac', '// %s' )
call tcomment#DefineType('pascal', '(* %s *)' )
call tcomment#DefineType('pascal_inline', '(* %s *)' )
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('po', '# %s' )
call tcomment#DefineType('prolog', '%% %s' )
call tcomment#DefineType('puppet', '# %s' )
call tcomment#DefineType('python', '# %s' )
call tcomment#DefineType('rc', '// %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_3', '### %s' )
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_block', g:tcommentBlockXML )
call tcomment#DefineType('sh', '# %s' )
call tcomment#DefineType('sql', '-- %s' )
call tcomment#DefineType('smarty', '{* %s *}' )
call tcomment#DefineType('spec', '# %s' )
call tcomment#DefineType('sps', '* %s.' )
call tcomment#DefineType('sps_block', "* %s." )
call tcomment#DefineType('spss', '* %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('tex', '%% %s' )
call tcomment#DefineType('tpl', '<!-- %s -->' )
call tcomment#DefineType('typoscript', '# %s' )
call tcomment#DefineType('vhdl', '-- %s' )
call tcomment#DefineType('viki', '%% %s' )
call tcomment#DefineType('viki_3', '%%%%%% %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
" |g:tcommentOptions|):
" 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
" mode; must be smaller than |indent()|)
" mode=STRING ... See the notes below on the "commentMode" argument
@ -343,7 +443,7 @@ let s:nullCommentString = '%s'
" end=STRING ... Comment postfix
" middle=STRING ... Middle line comments in block mode
" 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"
" rxmid=N ... The above for "middle"
" 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
" prefix and postfix.
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
" TLogVAR a:beg, a:end, a:1, commentMode, commentAnyway
" TLogVAR a:beg, a:end, commentMode, commentAnyway
" save the cursor position
let pos = getpos('.')
let s:pos_end = getpos("'>")
let s:current_pos = getpos('.')
let cursor_pos = getpos("'>")
let s:cursor_pos = []
if commentMode =~# 'i'
let commentMode = substitute(commentMode, '\Ci', line("'<") == line("'>") ? 'I' : 'G', 'g')
endif
@ -379,10 +480,17 @@ function! tcomment#Comment(beg, end, ...)
" TLogVAR commentMode, lbeg, cbeg, lend, cend
" get the correct commentstring
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
call extend(cdef, a:3)
" TLogVAR 3, cdef
else
call extend(cdef, s:GetCommentDefinition(lbeg, lend, commentMode))
" TLogVAR 4, cdef
let ax = 3
if a:0 >= 3 && a:3 != '' && stridx(a:3, '=') == -1
let ax = 4
@ -392,8 +500,10 @@ function! tcomment#Comment(beg, end, ...)
let cdef.end = a:4
endif
endif
" TLogVAR ax, a:0, a:000
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
if !empty(get(cdef, 'begin', '')) || !empty(get(cdef, 'end', ''))
let cdef.commentstring = s:EncodeCommentPart(get(cdef, 'begin', ''))
@ -402,11 +512,19 @@ function! tcomment#Comment(beg, end, ...)
endif
let commentMode = cdef.mode
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)'))
call s:RepeatCommentstring(cdef)
endif
" echom "DBG" string(cdef) string(a:000)
" echom "DBG" string(a:000)
let cms0 = s:BlockGetCommentRx(cdef)
" TLogVAR cms0
" make whitespace optional; this conflicts with comments that require some
" whitespace
let cmtCheck = substitute(cms0, '\([ ]\)', '\1\\?', 'g')
@ -421,6 +539,7 @@ function! tcomment#Comment(beg, end, ...)
let indent = len(indentStr)
if col > indent
let cms0 = repeat(' ', col - indent) . cms0
" TLogVAR cms0
else
let indentStr = repeat(' ', col)
endif
@ -439,25 +558,54 @@ function! tcomment#Comment(beg, end, ...)
let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\')
" final pattern for commenting
let cmtReplace = s:GetCommentReplace(cdef, cms0)
" echom "DBG tcomment#Comment" lbeg .','. lend .'s/\V'.
" \ s:StartPosRx(commentMode, lbeg, cbeg) . indentStr .'\zs\(\_.\{-}\)'. s:EndPosRx(commentMode, lend, cend) .'/'.
" \ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
exec lbeg .','. lend .'s/\V'.
" TLogVAR cmtReplace
let s:cdef = cdef
let cmd = lbeg .','. lend .'s/\V'.
\ s:StartPosRx(commentMode, lbeg, cbeg) . indentStr .'\zs\(\_.\{-}\)'. s:EndPosRx(commentMode, lend, cend) .'/'.
\ '\=s:ProcessedLine('. uncomment .', submatch(0), "'. cmtCheck .'", "'. cmtReplace .'")/ge'
" TLogVAR cmd
exec cmd
call histdel('search', -1)
unlet s:cdef
endif
" reposition cursor
" TLogVAR commentMode
if commentMode =~ '>'
call setpos('.', s:pos_end)
else
" TLogVAR pos
call setpos('.', pos)
if !empty(s:cursor_pos)
let cursor_pos = s:cursor_pos
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
function! s:GetStartEnd(beg, end, commentMode) "{{{3
" TLogVAR a:beg, a:end, a:commentMode
if type(a:beg) == 3
let [lbeg, cbeg] = a:beg
let [lend, cend] = a:end
@ -465,25 +613,27 @@ function! s:GetStartEnd(beg, end, commentMode) "{{{3
let lbeg = a:beg
let lend = a:end
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("'<")
if cbeg == 0
let cbeg = col('.')
endif
if commentMode =~# 'R'
let commentMode = substitute(commentMode, '\CR', 'G', 'g')
let cend = 0
else
let cend = col("'>")
if commentMode =~# 'o'
let cend += 1
endif
let cend = col("'>")
if cend < col('$') && (commentMode =~# 'o' || &selection == 'inclusive')
let cend += 1
" TLogVAR cend, col('$')
endif
else
let cbeg = 0
let cend = 0
let cend = 0
endif
endif
" TLogVAR lbeg, cbeg, lend, cend
return [lbeg, cbeg, lend, cend]
endf
@ -517,19 +667,34 @@ function! s:ParseArgs(beg, end, commentMode, arglist) "{{{3
for arg in a:arglist
let key = matchstr(arg, '^[^=]\+')
let value = matchstr(arg, '=\zs.*$')
if key == 'as'
call extend(args, s:GetCommentDefinitionForType(a:beg, a:end, a:commentMode, value))
else
if !empty(key)
let args[key] = value
endif
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
function! tcomment#Operator(type, ...) "{{{3
let commentMode = a:0 >= 1 ? a:1 : ''
let bang = a:0 >= 2 ? a:2 : ''
" TLogVAR a:type, commentMode, bang
if !exists('w:tcommentPos')
let w:tcommentPos = getpos(".")
endif
@ -537,7 +702,6 @@ function! tcomment#Operator(type, ...) "{{{3
set selection=inclusive
let reg_save = @@
" let pos = getpos('.')
" TLogVAR a:type
try
if a:type == 'line'
silent exe "normal! '[V']"
@ -559,6 +723,7 @@ function! tcomment#Operator(type, ...) "{{{3
let lend = line("']")
let cbeg = col("'[")
let cend = col("']")
" TLogVAR lbeg, lend, cbeg, cend
" echom "DBG tcomment#Operator" lbeg col("'[") col("'<") lend col("']") col("'>")
norm! 
let commentMode .= g:tcommentOpModeExtra
@ -666,7 +831,7 @@ endf
" :nodoc:
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 a:ArgLead =~ '^as='
call tcomment#CollectFileTypes()
@ -685,11 +850,12 @@ endf
function! s:GetCommentDefinitionForType(beg, end, commentMode, filetype) "{{{3
let cdef = s:GetCommentDefinition(a:beg, a:end, a:commentMode, a:filetype)
" TLogVAR cdef
let cms = cdef.commentstring
let commentMode = cdef.mode
let pre = substitute(cms, '%s.*$', '', '')
let pre = substitute(cms, '%\@<!%s.*$', '', '')
let pre = substitute(pre, '%%', '%', 'g')
let post = substitute(cms, '^.\{-}%s', '', '')
let post = substitute(cms, '^.\{-}%\@<!%s', '', '')
let post = substitute(post, '%%', '%', 'g')
let cdef.begin = pre
let cdef.end = post
@ -705,14 +871,17 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
else
let cdef = {'mode': a:commentMode}
endif
" TLogVAR cdef
let cms = get(cdef, 'commentstring', '')
if empty(cms)
let filetype = s:Filetype()
if exists('b:commentstring')
let cms = b:commentstring
" TLogVAR 1, cms
return s:GetCustomCommentString(filetype, a:commentMode, cms)
elseif exists('b:commentStart') && b:commentStart != ''
let cms = s:EncodeCommentPart(b:commentStart) .' %s'
" TLogVAR 2, cms
if exists('b:commentEnd') && b:commentEnd != ''
let cms = cms .' '. s:EncodeCommentPart(b:commentEnd)
endif
@ -724,6 +893,7 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
else
let altFiletype = g:tcommentGuessFileType_{filetype}
endif
" TLogVAR altFiletype
return s:GuessFileType(a:beg, a:end, a:commentMode, filetype, altFiletype)
else
return s:GetCustomCommentString(filetype, a:commentMode, s:GuessCurrentCommentString(a:commentMode))
@ -734,6 +904,7 @@ function! s:GetCommentDefinition(beg, end, commentMode, ...)
endf
function! s:StartPosRx(mode, line, col)
" TLogVAR a:mode, a:line, a:col
if a:mode =~# 'I'
return s:StartLineRx(a:line) . s:StartColRx(a:col)
else
@ -824,19 +995,31 @@ function! s:ProcessedLine(uncomment, match, checkRx, replace)
let ml = len(a:match)
if a:uncomment
let rv = substitute(a:match, a:checkRx, '\1\2', '')
let rv = s:UnreplaceInLine(rv)
else
let rv = printf(a:replace, a:match)
let rv = s:ReplaceInLine(a:match)
let rv = printf(a:replace, rv)
endif
" TLogVAR rv
" let md = len(rv) - ml
let s:pos_end = getpos('.')
let s:pos_end[2] += len(rv)
if s:cdef.mode =~ '>'
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 rv
if v:version > 702 || (v:version == 702 && has('patch407'))
let rv = escape(rv, ' ')
let rv = escape(rv, "\r")
else
let rv = escape(rv, '\ ')
let rv = escape(rv, "\\r")
endif
" TLogVAR rv
" let rv = substitute(rv, '\n', '\\\n', 'g')
@ -844,19 +1027,43 @@ function! s:ProcessedLine(uncomment, match, checkRx, replace)
return rv
endf
" function! s:CommentLines(beg, end, cstart, cend, uncomment, cmtCheck, cms0, indentStr) "{{{3
" " We want commented lines
" " final search pattern for uncommenting
" let cmtCheck = escape('\V\^\(\s\{-}\)'. a:cmtCheck .'\$', '"/\')
" " final pattern for commenting
" let cmtReplace = escape(a:cms0, '"/')
" silent exec a:beg .','. a:end .'s/\V'.
" \ s:StartColRx(a:cstart) . a:indentStr .'\zs\(\.\{-}\)'. s:EndColRx(a:cend) .'/'.
" \ '\=s:ProcessedLine('. a:uncomment .', submatch(0), "'. a:cmtCheck .'", "'. cmtReplace .'")/ge'
" endf
function! s:ReplaceInLine(text) "{{{3
if has_key(s:cdef, 'replacements')
let text = a:text
" TLogVAR text
for [token, substitution] in items(s:cdef.replacements)
let text = substitute(text, '\V'. escape(token, '\'), substitution, 'g')
" TLogVAR token, substitution, text
endfor
" 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)
" TLogVAR a:beg, a:end, a:uncomment, a:checkRx, a:cdef, a:indentStr
let t = @t
let sel_save = &selection
set selection=exclusive
try
silent exec 'norm! '. a:beg.'G1|v'.a:end.'G$"td'
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*$', '', '')
else
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 != ''
let ms = a:indentStr . ms
let mx = a:indentStr . mx
@ -881,6 +1088,7 @@ function! s:CommentBlock(beg, end, uncomment, checkRx, cdef, indentStr)
endif
silent norm! "tP
finally
let &selection = sel_save
let @t = t
endtry
endf
@ -893,28 +1101,99 @@ function! s:Filetype(...) "{{{3
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
" this requires that a syntax names are prefixed by the filetype name
" s:GuessFileType(beg, end, commentMode, filetype, ?fallbackFiletype)
function! s:GuessFileType(beg, end, commentMode, filetype, ...)
" TLogVAR a:beg, a:end, a:commentMode, a:filetype, a:000
if a:0 >= 1 && a:1 != ''
let cdef = s:GetCustomCommentString(a:1, a:commentMode)
if empty(get(cdef, 'commentstring', ''))
let cdef.commentstring = s:GuessCurrentCommentString(a:commentMode)
endif
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
let n = a:beg
" TLogVAR n, a:beg, a:end
while n <= a:end
let beg = a:beg
let end = nextnonblank(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 le = len(getline(n))
let text = getline(n)
let le = len(text)
" TLogVAR m, le
while m < le
while m <= le
let syntaxName = s:GetSyntaxName(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)
" TLogVAR ftypeMap
return s:GetCustomCommentString(ftypeMap, a:commentMode, cdef.commentstring)
@ -934,6 +1213,7 @@ function! s:GuessFileType(beg, end, commentMode, filetype, ...)
endwh
let n += 1
endwh
" TLogVAR cdef
return cdef
endf
@ -957,7 +1237,8 @@ function! s:CommentMode(commentMode, newmode) "{{{3
endf
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
" The &commentstring appears to have been set and to be valid
return &commentstring
@ -1012,24 +1293,32 @@ endf
" s:GetCustomCommentString(ft, commentMode, ?default="")
function! s:GetCustomCommentString(ft, commentMode, ...)
" TLogVAR a:ft, a:commentMode, a:000
let commentMode = a:commentMode
let customComment = tcomment#TypeExists(a:ft)
if commentMode =~# 'B' && tcomment#TypeExists(a:ft .'_block')
let def = s:definitions[a:ft .'_block']
" TLogVAR 1, def
elseif commentMode =~? 'I' && tcomment#TypeExists(a:ft .'_inline')
let def = s:definitions[a:ft .'_inline']
" TLogVAR 2, def
elseif customComment
let def = s:definitions[a:ft]
let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 3, def
elseif a:0 >= 1
let def = {'commentstring': a:1}
let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 4, def
else
let def = {}
let commentMode = s:CommentMode(commentMode, 'G')
" TLogVAR 5, def
endif
let cdef = copy(def)
let cdef.mode = commentMode
let cdef.filetype = a:ft
" TLogVAR cdef
return cdef
endf
@ -1071,3 +1360,4 @@ endf
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>
(remove NOSPAM from Campbell's email first)
@ -78,9 +78,9 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *Align-copyright*
|| | | ||
|| | +-------------------------------------------------------++
|| 1st arg | = | = all separator patterns are equivalent and are ||
|| | | simultaneously active. Patterns are |regexp|. ||
|| | | simultaneously active. Patterns are |regexp|. ||
|| | | C cycle through separator patterns. Patterns are ||
|| | | |regexp| and are active sequentially. ||
|| | | |regexp| and are active sequentially. ||
|| | | ||
|| | < | < left justify separator Separators are justified, ||
|| | | > right justify separator too. Separator styles ||
@ -144,7 +144,7 @@ Copyright: (c) 2004-2012 by Charles E. Campbell *Align-copyright*
3. Alignment Usage *alignusage* *align-usage* *align-userguide* {{{1
ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2
ALIGNMENT CONCEPTS *align-concept* *align-concepts* *alignctrl* {{{1
The typical text to be aligned is considered to be:
@ -315,7 +315,7 @@ ALIGNMENT OPTIONS *align-option* *align-options* *align-xstrlen* {{{2
the most accurate. (thanks to Tony Mechelynck for these)
ALIGNMENT CONTROL *alignctrl* *align-control* {{{2
ALIGNMENT CONTROL *:AlignCtrl* *align-control* {{{2
This command doesn't do the alignment operation itself; instead, it
controls subsequent alignment operation(s).
@ -756,7 +756,7 @@ ALIGNMENT CONTROL INITIALIZATION *alignctrl-init* *alignctrl-initialization* {{{
and :AlignCtrl will then be defined.
ALIGNMENT *align-align* {{{2
ALIGNMENT *:Align* *align-align* {{{2
Once the alignment control has been determined, the user specifies a
range of lines for the Align command/function to do its thing.
@ -852,7 +852,7 @@ ALIGNMENT *align-align* {{{2
\adcom: useful for aligning comments in declarations |alignmap-adcom|
\anum : useful for aligning numbers |alignmap-anum|
NOTE: For the visual-mode use of \anum, <vis.vim> is needed!
See http://mysite.verizon.net/astronaut/vim/index.html#VIS
See http://www.drchip.org/astronaut/vim/index.html#VIS
\aenum: align a European-style number |alignmap-anum|
\aunum: align a USA-style number |alignmap-anum|
\adec : useful for aligning declarations |alignmap-adec|
@ -916,7 +916,7 @@ ALIGNMENT *align-align* {{{2
an AlignMap with the vis.vim plugin, available at either
stable: http://vim.sourceforge.net/scripts/script.php?script_id=1195
devel : http://mysite.verizon.net/astronaut/vim/index.html#VIS
devel : http://www.drchip.org/astronaut/vim/index.html#VIS
Use it with commands such as >
@ -1400,194 +1400,202 @@ ALIGNMENT *align-align* {{{2
4. Alignment Tools' History *align-history* {{{1
ALIGN HISTORY {{{2
36 : May 20, 2009 * Previously, the "W" AlignCtrl setting, intended
to retain initial white space, did so by convert-
ing any leading tabs into an equivalent quantity
of blanks (using the current tabstop setting).
Align will now retain leading tabs.
Nov 24, 2009 * QArgSplitter() used split(), intending to split
on white space only. However, the \tab map
uses ctrl-o as a separator instead of tabs; the
split() function treated the ctrl-o as a whitespace
character, too. Solution: give split() an explicit
pattern matching blanks and tabs, only. \tab now
works again!
Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support
May 10, 2011 * if the range is only one line, then Align will
automatically grow the range to accommodate all
lines containing the first separator pattern
surrounding the current line.
Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to
specify a function by name which computes string
length.
Oct 27, 2011 * (reported by Fco Javier) reported a problem with
the default s:Strlen() result; there was a missing
"let". Fixed.
Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when
it should've been doing "setlocal noet".
Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when
g:Align_xstrlen is zero.
35 : Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading
installed
Nov 19, 2008 * new sanity check for an AlignStyle of just ":"
Jan 08, 2009 * save&restore of |'mod'| now done with local
variant
34 : Jul 08, 2008 * using :AlignCtrl before entering any alignment
control commands was causing an error.
33 : Sep 20, 2007 * s:Strlen() introduced to support various ways
used to represent characters and their effects
on string lengths. See |align-strlen|.
* Align now accepts "..." -- so it can accept
whitespace as separators.
32 : Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a
custom argument splitter to allow patterns with
backslashes to slide in unaltered.
31 : Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s)
implemented.
30 : Feb 12, 2007 * now uses |setline()|
29 : Jan 18, 2006 * cecutil updated to use keepjumps
Feb 23, 2006 * Align now converted to vim 7.0 style using
auto-loading functions.
28 : Aug 17, 2005 * report option workaround
Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed
27 : Apr 15, 2005 : cpo workaround
ignorecase workaround
26 : Aug 20, 2004 : loaded_align now also indicates version number
GetLatestVimScripts :AutoInstall: now supported
25 : Jul 27, 2004 : For debugging, uses Dfunc(), Dret(), and Decho()
24 : Mar 03, 2004 : (should've done this earlier!) visualmode(1)
not supported until v6.2, now Align will avoid
calling it for earlier versions. Visualmode
clearing won't take place then, of course.
23 : Oct 07, 2003 : Included Leif Wickland's ReplaceQuotedSpaces()
function which supports \tsq
22 : Jan 29, 2003 : Now requires 6.1.308 or later to clear visualmode()
21 : Jan 10, 2003 : BugFix: similar problem to #19; new code
bypasses "norm! v\<Esc>" until initialization
is over.
20 : Dec 30, 2002 : BugFix: more on "unable to highlight" fixed
19 : Nov 21, 2002 : BugFix: some terminals gave an "unable to highlight"
message at startup; Hari Krishna Dara tracked it
down; a silent! now included to prevent noise.
18 : Nov 04, 2002 : BugFix: re-enabled anti-repeated-loading
17 : Nov 04, 2002 : BugFix: forgot to have AlignPush() push s:AlignSep
AlignCtrl now clears visual-block mode when used so
that Align won't try to use old visual-block
selection marks '< '>
16 : Sep 18, 2002 : AlignCtrl <>| options implemented (separator
justification)
15 : Aug 22, 2002 : bug fix: AlignCtrl's ":" now acts as a modifier of
the preceding alignment operator (lrc)
14 : Aug 20, 2002 : bug fix: AlignCtrl default now keeps &ic unchanged
bug fix: Align, on end-field, wasn't using correct
alignop bug fix: Align, on end-field, was appending
padding
13 : Aug 19, 2002 : bug fix: zero-length g/v patterns are accepted
bug fix: always skip blank lines
bug fix: AlignCtrl default now also clears g and v
patterns
12 : Aug 16, 2002 : moved keep_ic above zero-length pattern checks
added "AlignCtrl default"
fixed bug with last field getting separator spaces
at end line
11 : Jul 08, 2002 : prevent separator patterns which match zero length
-+: included as additional alignment/justification
styles
10 : Jun 26, 2002 : =~# used instead of =~ (for matching case)
ignorecase option handled
9 : Jun 25, 2002 : implemented cyclic padding
v37 Nov 29, 2012 * (Kim Jang-hwan) reported that with g:Align_xstrlen
set to 3 that the cursor was moved (linewise)
after invocation. Fixed.
Jan 07, 2013 * now has visual mode mappings to accompany all
normal mode mappings (use |V| to invoke)
v36 May 20, 2009 * Previously, the "W" AlignCtrl setting, intended
to retain initial white space, did so by convert-
ing any leading tabs into an equivalent quantity
of blanks (using the current tabstop setting).
Align will now retain leading tabs.
Nov 24, 2009 * QArgSplitter() used split(), intending to split
on white space only. However, the \tab map
uses ctrl-o as a separator instead of tabs; the
split() function treated the ctrl-o as a whitespace
character, too. Solution: give split() an explicit
pattern matching blanks and tabs, only. \tab now
works again!
Jun 29, 2010 * included |g:AlignSkip| and |alignctrl-star| support
May 10, 2011 * if the range is only one line, then Align will
automatically grow the range to accommodate all
lines containing the first separator pattern
surrounding the current line.
Aug 05, 2011 * g:Align_xstrlen usage extended to permit users to
specify a function by name which computes string
length.
Oct 27, 2011 * (reported by Fco Javier) reported a problem with
the default s:Strlen() result; there was a missing
"let". Fixed.
Nov 10, 2011 * (Lewis Thompson) Align was doing "set noet" when
it should've been doing "setlocal noet".
Dec 22, 2011 * modifed s:Strlen() to use |strdisplaywidth()| when
g:Align_xstrlen is zero.
v35 Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading
installed
Nov 19, 2008 * new sanity check for an AlignStyle of just ":"
Jan 08, 2009 * save&restore of |'mod'| now done with local
variant
v34 Jul 08, 2008 * using :AlignCtrl before entering any alignment
control commands was causing an error.
v33 Sep 20, 2007 * s:Strlen() introduced to support various ways
used to represent characters and their effects
on string lengths. See |align-strlen|.
* Align now accepts "..." -- so it can accept
whitespace as separators.
v32 Aug 18, 2007 * uses |<q-args>| instead of |<f-args>| plus a
custom argument splitter to allow patterns with
backslashes to slide in unaltered.
v31 Aug 06, 2007 * :[range]Align! [AlignCtrl settings] pattern(s)
implemented.
v30 Feb 12, 2007 * now uses |setline()|
v29 Jan 18, 2006 * cecutil updated to use keepjumps
Feb 23, 2006 * Align now converted to vim 7.0 style using
auto-loading functions.
v28 Aug 17, 2005 * report option workaround
Oct 24, 2005 * AlignCtrl l: wasn't behaving as expected; fixed
v27 Apr 15, 2005 * cpo workaround
ignorecase workaround
v26 Aug 20, 2004 * loaded_align now also indicates version number
GetLatestVimScripts :AutoInstall: now supported
v25 Jul 27, 2004 * For debugging, uses Dfunc(), Dret(), and Decho()
v24 Mar 03, 2004 * (should've done this earlier!) visualmode(1)
not supported until v6.2, now Align will avoid
calling it for earlier versions. Visualmode
clearing won't take place then, of course.
v23 Oct 07, 2003 * Included Leif Wickland's ReplaceQuotedSpaces()
function which supports \tsq
v22 Jan 29, 2003 * Now requires 6.1.308 or later to clear visualmode()
v21 Jan 10, 2003 * BugFix: similar problem to #19; new code
bypasses "norm! v\<Esc>" until initialization
is over.
v20 Dec 30, 2002 * BugFix: more on "unable to highlight" fixed
v19 Nov 21, 2002 * BugFix: some terminals gave an "unable to highlight"
message at startup; Hari Krishna Dara tracked it
down; a silent! now included to prevent noise.
v18 Nov 04, 2002 * BugFix: re-enabled anti-repeated-loading
v17 Nov 04, 2002 * BugFix: forgot to have AlignPush() push s:AlignSep
AlignCtrl now clears visual-block mode when used so
that Align won't try to use old visual-block
selection marks '< '>
v16 Sep 18, 2002 * AlignCtrl <>| options implemented (separator
justification)
v15 Aug 22, 2002 * bug fix: AlignCtrl's ":" now acts as a modifier of
the preceding alignment operator (lrc)
v14 Aug 20, 2002 * bug fix: AlignCtrl default now keeps &ic unchanged
bug fix: Align, on end-field, wasn't using correct
alignop bug fix: Align, on end-field, was appending
padding
v13 Aug 19, 2002 * bug fix: zero-length g/v patterns are accepted
bug fix: always skip blank lines
bug fix: AlignCtrl default now also clears g and v
patterns
v12 Aug 16, 2002 * moved keep_ic above zero-length pattern checks
added "AlignCtrl default"
fixed bug with last field getting separator spaces
at end line
v11 Jul 08, 2002 * prevent separator patterns which match zero length
-+: included as additional alignment/justification
styles
v10 Jun 26, 2002 * =~# used instead of =~ (for matching case)
ignorecase option handled
v09 Jun 25, 2002 * implemented cyclic padding
ALIGNMENT MAP HISTORY *alignmap-history* {{{2
v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum
Feb 16, 2010 * map for \t=, \T= now handles x++ = something;
for c, c++ correctly.
Oct 29, 2010 * added a note on having one's own default
AlignCtrl (see |alignctrl-init|)
Feb 22, 2011 * for menus, &go =~# used to insure correct case
Jun 10, 2011 * |:AlignMapsClean| command provided to make it
easy for those who would prefer not to have
AlignMaps' maps not to have them.
v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent
re-loading installed
* AlignMaps now use 0x0f (ctrl-p) for special
character substitutions (instead of 0xff).
Seems to avoid some problems with having to
use Strlen().
* bug fixed with \ts,
* new maps: \ts; \ts, \ts: \ts< \ts= \a(
v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s
and <script>s. \t@ and related maps have been
changed to call StdAlign() instead. The
WrapperStart function now takes an argument and
handles being called via visual mode. The
former nmaps and vmaps have thus been replaced
with a simple map.
Oct 24, 2008 * broke AlignMaps into a plugin and autoload
pair of scripts.
v39 Mar 06, 2008 : * \t= only does /* ... */ aligning when in *.c
*.cpp files.
v38 Aug 18, 2007 : * \tt altered so that it works with the new
use of |<q-args>| plus a custom argument
splitter
v36 Sep 27, 2006 : * AlignWrapperStart() now has tests that marks
y and z are not set
May 15, 2007 * \anum and variants improved
v35 Sep 01, 2006 : * \t= and cousins used "`"s. They now use \xff
characters.
* \acom now works with doxygen style /// comments
* <char-0xff> used in \t= \T= \w= and \m= instead
of backquotes.
v34 Feb 23, 2006 : * AlignMaps now converted to vim 7.0 style using
auto-loading functions.
v33 Oct 12, 2005 : * \ts, now uses P1 in its AlignCtrl call
v32 Jun 28, 2005 : * s:WrapperStart() changed to AlignWrapperStart()
s:WrapperEnd() changed to AlignWrapperEnd()
These changes let the AlignWrapper...()s to be
used outside of AlignMaps.vim
v31 Feb 01, 2005 : * \adcom included, with help
* \a, now works across multiple lines with
different types
* AlignMaps now uses <cecutil.vim> for its mark and
window-position saving and restoration
Mar 04, 2005 * improved \a,
Apr 06, 2005 * included \aenum, \aunum, and provided
g:alignmaps_{usa|euro]number} options
v30 Aug 20, 2004 : * \a, : handles embedded assignments and does \adec
* \acom now can handle Doxygen-style comments
* g:loaded_alignmaps now also indicates version
* internal maps \WE and \WS are now re-entrant
v29 Jul 27, 2004 : * \tml aligns trailing multi-line single
backslashes (thanks to Raul Benavente!)
v28 May 13, 2004 : * \a, had problems with leading blanks; fixed!
v27 Mar 31, 2004 : * \T= was having problems with == and !=
* Fixed more problems with \adec
v26 Dec 09, 2003 : * \ascom now also ignores lines without comments
* \tt \& now not matched
* \a< handles both << and >>
v25 Nov 14, 2003 : * included \anum (aligns numbers with periods and
commas). \anum also supported with ctrl-v mode.
* \ts, \Ts, : (aligns on commas, then swaps leading
spaces with commas)
* \adec ignores preprocessor lines and lines with
with comments-only
v23 Sep 10, 2003 : * Bugfix for \afnc - no longer overwrites marks y,z
* fixed bug in \tsp, \tab, \Tsp, and \Tab - lines
containing backslashes were having their
backslashes removed. Included Leif Wickland's
patch for \tsq.
* \adef now ignores lines holding comments only
v18 Aug 22, 2003 : \a< lines up C++'s << operators
saves/restores gdefault option (sets to nogd)
all b:..varname.. are now b:alignmaps_..varname..
v17 Nov 04, 2002 : \afnc now handles // comments correctly and
commas within comments
v16 Sep 10, 2002 : changed : to :silent! for \adec
v15 Aug 27, 2002 : removed some <c-v>s
v14 Aug 20, 2002 : \WS, \WE mostly moved to functions, marks y and z
now restored
v11 Jul 08, 2002 : \abox bug fix
v9 Jun 25, 2002 : \abox now handles leading initial whitespace
: various bugfixes to \afnc, \T=, etc
v43 Nov 28, 2012 * changed a lot of maps to use nnoremap (instead
of map)
Jan 07, 2013 *
v42 Jan 06, 2010 * new maps for \anum, \aenum, \aunum
Feb 16, 2010 * map for \t=, \T= now handles x++ = something;
for c, c++ correctly.
Oct 29, 2010 * added a note on having one's own default
AlignCtrl (see |alignctrl-init|)
Feb 22, 2011 * for menus, &go =~# used to insure correct case
Jun 10, 2011 * |:AlignMapsClean| command provided to make it
easy for those who would prefer not to have
AlignMaps' maps not to have them.
v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent
re-loading installed
* AlignMaps now use 0x0f (ctrl-p) for special
character substitutions (instead of 0xff).
Seems to avoid some problems with having to
use Strlen().
* bug fixed with \ts,
* new maps: \ts; \ts, \ts: \ts< \ts= \a(
v40 Oct 21, 2008 * Modified AlignMaps so that its maps use <Plug>s
and <script>s. \t@ and related maps have been
changed to call StdAlign() instead. The
WrapperStart function now takes an argument and
handles being called via visual mode. The
former nmaps and vmaps have thus been replaced
with a simple map.
Oct 24, 2008 * broke AlignMaps into a plugin and autoload
pair of scripts.
v39 Mar 06, 2008 * \t= only does /* ... */ aligning when in *.c
*.cpp files.
v38 Aug 18, 2007 * \tt altered so that it works with the new
use of |<q-args>| plus a custom argument
splitter
v36 Sep 27, 2006 * AlignWrapperStart() now has tests that marks
y and z are not set
May 15, 2007 * \anum and variants improved
v35 Sep 01, 2006 * \t= and cousins used "`"s. They now use \xff
characters.
* \acom now works with doxygen style /// comments
* <char-0xff> used in \t= \T= \w= and \m= instead
of backquotes.
v34 Feb 23, 2006 * AlignMaps now converted to vim 7.0 style using
auto-loading functions.
v33 Oct 12, 2005 * \ts, now uses P1 in its AlignCtrl call
v32 Jun 28, 2005 * s:WrapperStart() changed to AlignWrapperStart()
s:WrapperEnd() changed to AlignWrapperEnd()
These changes let the AlignWrapper...()s to be
used outside of AlignMaps.vim
v31 Feb 01, 2005 * \adcom included, with help
* \a, now works across multiple lines with
different types
* AlignMaps now uses <cecutil.vim> for its mark and
window-position saving and restoration
Mar 04, 2005 * improved \a,
Apr 06, 2005 * included \aenum, \aunum, and provided
g:alignmaps_{usa|euro]number} options
v30 Aug 20, 2004 * * \a, : handles embedded assignments and does \adec
* \acom now can handle Doxygen-style comments
* g:loaded_alignmaps now also indicates version
* internal maps \WE and \WS are now re-entrant
v29 Jul 27, 2004 * \tml aligns trailing multi-line single
backslashes (thanks to Raul Benavente!)
v28 May 13, 2004 * \a, had problems with leading blanks; fixed!
v27 Mar 31, 2004 * \T= was having problems with == and !=
* Fixed more problems with \adec
v26 Dec 09, 2003 * \ascom now also ignores lines without comments
* \tt \& now not matched
* \a< handles both << and >>
v25 Nov 14, 2003 * included \anum (aligns numbers with periods and
commas). \anum also supported with ctrl-v mode.
* \ts, \Ts, : (aligns on commas, then swaps leading
spaces with commas)
* \adec ignores preprocessor lines and lines with
with comments-only
v23 Sep 10, 2003 * Bugfix for \afnc - no longer overwrites marks y,z
* fixed bug in \tsp, \tab, \Tsp, and \Tab - lines
containing backslashes were having their
backslashes removed. Included Leif Wickland's
patch for \tsq.
* \adef now ignores lines holding comments only
v18 Aug 22, 2003 * \a< lines up C++'s << operators
saves/restores gdefault option (sets to nogd)
all b:..varname.. are now b:alignmaps_..varname..
v17 Nov 04, 2002 * \afnc now handles // comments correctly and
commas within comments
v16 Sep 10, 2002 * changed : to :silent! for \adec
v15 Aug 27, 2002 * removed some <c-v>s
v14 Aug 20, 2002 * \WS, \WE mostly moved to functions, marks y and z
now restored
v11 Jul 08, 2002 * \abox bug fix
v9 Jun 25, 2002 * \abox now handles leading initial whitespace
various bugfixes to \afnc, \T=, etc
==============================================================================
Modelines: {{{1

View File

@ -1,13 +1,13 @@
*logipat.txt* Logical Patterns Aug 09, 2005
*logipat.txt* Logical Patterns Mar 13, 2013
Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
Copyright: (c) 2004-2013 by Charles E. Campbell *logipat-copyright*
The VIM LICENSE applies to LogiPat.vim and LogiPat.txt
(see |copyright|) except use "LogiPat" instead of "Vim"
No warranty, express or implied. Use At-Your-Own-Risk.
==============================================================================
1. Contents *logipat*
1. Contents *logipat* *logipat-contents*
1. Contents.................: |logipat-contents|
2. LogiPat Manual...........: |logipat-manual|
@ -22,11 +22,11 @@ Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
*logipat-arg* *logipat-input* *logipat-pattern* *logipat-operators*
Boolean logic patterns are composed of
operators ! = not
| = logical-or
& = logical-and
grouping ( ... )
patterns "pattern"
operators ! = not
| = logical-or
& = logical-and
grouping ( ... )
patterns "pattern"
:LogiPat {boolean-logic pattern} *:LogiPat*
:LogiPat is a command which takes a boolean-logic
@ -36,6 +36,11 @@ Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
:LP is a shorthand command version of :LogiPat
(|logipat-cmd|).
:ELP {boolean-logic pattern} *:ELP*
No search is done, but the conversion from the
boolean logic pattern to the regular expression
is performed and echoed onto the display.
:LogiPatFlags {search flags} *LogiPat-flags*
:LogiPatFlags {search flags}
LogiPat uses the |search()| command. The flags
@ -51,34 +56,40 @@ Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
logic pattern into a regular expression pattern
is performed and returned.
To get a " inside a pattern, as opposed to having it delimit
the pattern, double it.
==============================================================================
3. LogiPat Examples *logipat-examples*
LogiPat takes Boolean logic arguments and produces a regular
expression which implements the choices. A series of examples
follow:
follows:
>
:LogiPat "abc"
< will search for lines containing the string "abc"
< will search for lines containing the string :abc:
>
:LogiPat "ab""cd"
< will search for lines containing the string :ab"c:
>
:LogiPat !"abc"
< will search for lines which don't contain the string "abc"
< will search for lines which don't contain the string :abc:
>
:LogiPat "abc"|"def"
< will search for lines which contain either the string
"abc" or the string "def"
:abc: or the string :def:
>
:LogiPat !("abc"|"def")
< will search for lines which don't contain either
of the strings "abc" or "def"
of the strings :abc: or :def:
>
:LogiPat "abc"&"def"
< will search for lines which contain both of the strings
"abc" and "def"
:abc: and :def:
>
:let pat= LogiPat('!"abc"')
< will return the regular expression which will match
all lines not containing "abc". The double quotes
all lines not containing :abc: . The double quotes
are needed to pass normal patterns to LogiPat, and
differentiate such patterns from boolean logic
operators.
@ -95,6 +106,10 @@ Copyright: (c) 2004-2005 by Charles E. Campbell, Jr. *logipat-copyright*
==============================================================================
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

View File

@ -3,8 +3,11 @@
" <alexander.fleck@gmx.net>
" License: This File is placed in the Public Domain.
" 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.10 | | -
" 00.02.20 | | Description added (ms)
*editsrec.txt* Global Plugin for Editing .srec Files
@ -35,7 +38,8 @@ lc | build a line from CheckSum |
pc | build only the CheckSum |
---------|-----------------------------------|
m5 | make an S5 record on a blank line |
| |
---------|-----------------------------------|
ms | make a set of records |
see *editsrec_test.txt* for examples

View File

@ -20,6 +20,7 @@ CONTENTS *Gundo-contents*
3.9 gundo_preview_statusline .. |gundo_preview_statusline|
gundo_tree_statusline ..... |gundo_tree_statusline|
3.10 gundo_auto_preview ........ |gundo_auto_preview|
3.11 gundo_playback_delay ...... |gundo_playback_delay|
4. License ......................... |GundoLicense|
5. Bugs ............................ |GundoBugs|
6. Contributing .................... |GundoContributing|
@ -216,6 +217,15 @@ be useful on large files and undo trees to speed up Gundo.
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*
@ -238,6 +248,10 @@ GitHub: http://github.com/sjl/gundo.vim/
==============================================================================
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
* Add auto preview option.
* 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*
:CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors*
@ -8,6 +10,7 @@
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
:CVSWatchers vcscommand.txt /*:CVSWatchers*
:ELP LogiPat.txt /*:ELP*
:Explore pi_netrw.txt /*:Explore*
:GLVS pi_getscript.txt /*:GLVS*
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
@ -1508,6 +1511,7 @@ g:MultipleSearchColorSequence MultipleSearch.txt /*g:MultipleSearchColorSequence
g:MultipleSearchMaxColors MultipleSearch.txt /*g:MultipleSearchMaxColors*
g:MultipleSearchTextColorSequence MultipleSearch.txt /*g:MultipleSearchTextColorSequence*
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:alignmaps_euronumber Align.txt /*g:alignmaps_euronumber*
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_decompress pi_netrw.txt /*g:netrw_decompress*
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_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd*
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_cmd pi_netrw.txt /*g:netrw_ftp_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_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd*
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_hide pi_netrw.txt /*g:netrw_list_hide*
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_localmkdir pi_netrw.txt /*g:netrw_localmkdir*
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_menu pi_netrw.txt /*g:netrw_menu*
g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd*
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_preview pi_netrw.txt /*g:netrw_preview*
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_rm_cmd pi_netrw.txt /*g:netrw_rm_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_xstrlen pi_netrw.txt /*g:netrw_xstrlen*
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:tcommentBlankLines tcomment.txt /*g:tcommentBlankLines*
g:tcommentBlockC tcomment.txt /*g:tcommentBlockC*
@ -1594,18 +1604,24 @@ g:tcommentBlockXML tcomment.txt /*g:tcommentBlockXML*
g:tcommentGuessFileType tcomment.txt /*g:tcommentGuessFileType*
g:tcommentGuessFileType_django tcomment.txt /*g:tcommentGuessFileType_django*
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_php tcomment.txt /*g:tcommentGuessFileType_php*
g:tcommentGuessFileType_smarty tcomment.txt /*g:tcommentGuessFileType_smarty*
g:tcommentGuessFileType_tskeleton tcomment.txt /*g:tcommentGuessFileType_tskeleton*
g:tcommentGuessFileType_vim tcomment.txt /*g:tcommentGuessFileType_vim*
g:tcommentIgnoreTypes_php tcomment.txt /*g:tcommentIgnoreTypes_php*
g:tcommentInlineC tcomment.txt /*g:tcommentInlineC*
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:tcommentMapLeaderOp2 tcomment.txt /*g:tcommentMapLeaderOp2*
g:tcommentModeExtra tcomment.txt /*g:tcommentModeExtra*
g:tcommentOpModeExtra tcomment.txt /*g:tcommentOpModeExtra*
g:tcommentOptions tcomment.txt /*g:tcommentOptions*
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_mkdir pi_vimball.txt /*g:vimball_mkdir*
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_map_move_newer gundo.txt /*gundo_map_move_newer*
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_height gundo.txt /*gundo_preview_height*
gundo_preview_statusline gundo.txt /*gundo_preview_statusline*
@ -1656,6 +1673,7 @@ local_markfilelist pi_netrw.txt /*local_markfilelist*
logipat LogiPat.txt /*logipat*
logipat-arg LogiPat.txt /*logipat-arg*
logipat-caveat LogiPat.txt /*logipat-caveat*
logipat-contents LogiPat.txt /*logipat-contents*
logipat-copyright LogiPat.txt /*logipat-copyright*
logipat-examples LogiPat.txt /*logipat-examples*
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-R pi_netrw.txt /*netrw-R*
netrw-S pi_netrw.txt /*netrw-S*
netrw-T pi_netrw.txt /*netrw-T*
netrw-U pi_netrw.txt /*netrw-U*
netrw-X pi_netrw.txt /*netrw-X*
netrw-a pi_netrw.txt /*netrw-a*
netrw-activate pi_netrw.txt /*netrw-activate*
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-browser pi_netrw.txt /*netrw-browser*
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-browsing pi_netrw.txt /*netrw-browsing*
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-i pi_netrw.txt /*netrw-i*
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-leftmouse pi_netrw.txt /*netrw-leftmouse*
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-login pi_netrw.txt /*netrw-login*
netrw-mB pi_netrw.txt /*netrw-mB*
netrw-mF pi_netrw.txt /*netrw-mF*
netrw-mT pi_netrw.txt /*netrw-mT*
netrw-mb pi_netrw.txt /*netrw-mb*
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-psftp pi_netrw.txt /*netrw-psftp*
netrw-putty pi_netrw.txt /*netrw-putty*
netrw-qF pi_netrw.txt /*netrw-qF*
netrw-qb pi_netrw.txt /*netrw-qb*
netrw-qf pi_netrw.txt /*netrw-qf*
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-s pi_netrw.txt /*netrw-s*
netrw-settings pi_netrw.txt /*netrw-settings*
netrw-settings-window pi_netrw.txt /*netrw-settings-window*
netrw-sexplore pi_netrw.txt /*netrw-sexplore*
netrw-sort pi_netrw.txt /*netrw-sort*
netrw-sort-sequence pi_netrw.txt /*netrw-sort-sequence*
netrw-sortsequence pi_netrw.txt /*netrw-sortsequence*
netrw-source pi_netrw.txt /*netrw-source*
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-variables pi_netrw.txt /*netrw-variables*
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-x pi_netrw.txt /*netrw-x*
netrw-xfer pi_netrw.txt /*netrw-xfer*
@ -1888,11 +1914,14 @@ srchrplchigrp-examples SrchRplcHiGrp.txt /*srchrplchigrp-examples*
tcomment#Comment() tcomment.txt /*tcomment#Comment()*
tcomment#CommentAs() tcomment.txt /*tcomment#CommentAs()*
tcomment#DefineType() tcomment.txt /*tcomment#DefineType()*
tcomment#GuessCommentType() tcomment.txt /*tcomment#GuessCommentType()*
tcomment#Operator() tcomment.txt /*tcomment#Operator()*
tcomment#OperatorAnyway() tcomment.txt /*tcomment#OperatorAnyway()*
tcomment#OperatorLine() tcomment.txt /*tcomment#OperatorLine()*
tcomment#OperatorLineAnyway() tcomment.txt /*tcomment#OperatorLineAnyway()*
tcomment#SetOption() tcomment.txt /*tcomment#SetOption()*
tcomment-maps tcomment.txt /*tcomment-maps*
tcomment-operator tcomment.txt /*tcomment-operator*
tcomment.txt tcomment.txt /*tcomment.txt*
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
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:
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
more precise: what I think you want it to do ;-).
*g:tcommentMapLeaderOp1*
*g:tcommentMapLeaderOp2*
As operator (the prefix can be customized via g:tcommentMapLeaderOp1
and g:tcommentMapLeaderOp2):
*tcomment-operator*
As operator (the prefix can be customized via |g:tcommentMapLeaderOp1|
and |g:tcommentMapLeaderOp2|):
gc{motion} :: Toggle comments (for small comments within one line
the &filetype_inline style will be used, if
defined)
gc<Count>c{motion} :: Toggle comment text with count argument
(see |tcomment#Comment()|)
gcc :: Toggle comment for the current line
gC{motion} :: Comment region
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
the commented text, set |g:tcommentOpModeExtra| to '>' (but this may not
work properly with exclusive motions).
Primary key maps:
Primary key maps for normal and insert mode:
<c-_><c-_> :: :TComment
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
@ -49,11 +66,22 @@ Primary key maps:
<c-_>a :: :TCommentAs <QUERY COMMENT TYPE>
<c-_>n :: :TCommentAs &filetype <QUERY COUNT>
<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-_>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>_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>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
... and for select mode:
<Leader>__ :: :TComment
<Leader>_i :: :TCommentInline
-----------------------------------------------------------------------
Install~
@ -81,6 +114,10 @@ please make sure, you have the current version of vimball (vimscript
========================================================================
Contents~
g:tcommentMapLeader1 ................ |g:tcommentMapLeader1|
g:tcommentMapLeader2 ................ |g:tcommentMapLeader2|
g:tcommentMapLeaderOp1 .............. |g:tcommentMapLeaderOp1|
g:tcommentMapLeaderOp2 .............. |g:tcommentMapLeaderOp2|
:TComment ........................... |:TComment|
:TCommentAs ......................... |:TCommentAs|
:TCommentRight ...................... |:TCommentRight|
@ -88,6 +125,7 @@ Contents~
:TCommentInline ..................... |:TCommentInline|
:TCommentMaybeInline ................ |:TCommentMaybeInline|
g:tcommentBlankLines ................ |g:tcommentBlankLines|
g:tcommentModeExtra ................. |g:tcommentModeExtra|
g:tcommentOpModeExtra ............... |g:tcommentOpModeExtra|
g:tcommentOptions ................... |g:tcommentOptions|
g:tcomment#ignore_char_type ......... |g:tcomment#ignore_char_type|
@ -98,26 +136,50 @@ Contents~
g:tcommentGuessFileType_tskeleton ... |g:tcommentGuessFileType_tskeleton|
g:tcommentGuessFileType_vim ......... |g:tcommentGuessFileType_vim|
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:tcomment#syntax_substitute ........ |g:tcomment#syntax_substitute|
g:tcommentSyntaxMap ................. |g:tcommentSyntaxMap|
g:tcomment#replacements_c ........... |g:tcomment#replacements_c|
g:tcommentBlockC .................... |g:tcommentBlockC|
g:tcommentBlockC2 ................... |g:tcommentBlockC2|
g:tcommentInlineC ................... |g:tcommentInlineC|
g:tcommentBlockXML .................. |g:tcommentBlockXML|
g:tcommentInlineXML ................. |g:tcommentInlineXML|
tcomment#DefineType ................. |tcomment#DefineType()|
g:tcomment_types .................... |g:tcomment_types|
tcomment#Comment .................... |tcomment#Comment()|
tcomment#SetOption .................. |tcomment#SetOption()|
tcomment#Operator ................... |tcomment#Operator()|
tcomment#OperatorLine ............... |tcomment#OperatorLine()|
tcomment#OperatorAnyway ............. |tcomment#OperatorAnyway()|
tcomment#OperatorLineAnyway ......... |tcomment#OperatorLineAnyway()|
tcomment#CommentAs .................. |tcomment#CommentAs()|
tcomment#GuessCommentType ........... |tcomment#GuessCommentType()|
========================================================================
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*
:[range]TComment[!] ?ARGS...
If there is a visual selection that begins and ends in the same line,
@ -184,10 +246,20 @@ autoload/tcomment.vim~
g:tcommentBlankLines (default: 1)
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 (default: '')
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 (default: {})
@ -223,7 +295,7 @@ g:tcommentGuessFileType (default: 0)
*g:tcommentGuessFileType_dsl*
g:tcommentGuessFileType_dsl (default: 'xml')
For dsl documents, assumet filetype = xml.
For dsl documents, assume filetype = xml.
*g:tcommentGuessFileType_php*
g:tcommentGuessFileType_php (default: 'html')
@ -243,9 +315,15 @@ g:tcommentGuessFileType_vim (default: 1)
*g:tcommentGuessFileType_django*
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 (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
php files.
@ -259,6 +337,10 @@ g:tcommentSyntaxMap (default: {...})
/filetypeSomeName/. Other syntax names have to be explicitly
mapped onto the corresponding filetype.
*g:tcomment#replacements_c*
g:tcomment#replacements_c (default: {...})
Replacements for c filetype.
*g:tcommentBlockC*
g:tcommentBlockC (default: {...})
Generic c-like block comments.
@ -268,7 +350,7 @@ g:tcommentBlockC2 (default: {...})
Generic c-like block comments (alternative markup).
*g:tcommentInlineC*
g:tcommentInlineC (default: "/* %s */")
g:tcommentInlineC (default: g:tcommentLineC)
Generic c-like comments.
*g:tcommentBlockXML*
@ -286,6 +368,12 @@ tcomment#DefineType(name, commentdef)
to have a blank after the comment marker. Block comments work only if
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.
If it is a string:
@ -294,8 +382,22 @@ tcomment#DefineType(name, commentdef)
that defines how "middle lines" (see :h format-comments) should be
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:
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(beg, end, ...)
@ -304,6 +406,7 @@ tcomment#Comment(beg, end, ...)
1. a list of key=value pairs where known keys are (see also
|g:tcommentOptions|):
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
mode; must be smaller than |indent()|)
mode=STRING ... See the notes below on the "commentMode" argument
@ -311,7 +414,7 @@ tcomment#Comment(beg, end, ...)
end=STRING ... Comment postfix
middle=STRING ... Middle line comments in block mode
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"
rxmid=N ... The above for "middle"
commentstring_rx ... A regexp format string that matches
@ -334,6 +437,9 @@ tcomment#Comment(beg, end, ...)
By default, each line in range will be commented by adding the comment
prefix and postfix.
*tcomment#SetOption()*
tcomment#SetOption(name, arg)
*tcomment#Operator()*
tcomment#Operator(type, ...)
@ -354,6 +460,24 @@ tcomment#CommentAs(beg, end, commentAnyway, filetype, ?args...)
|tcomment#Comment()|)
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:

View File

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

View File

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

View File

@ -1,12 +1,12 @@
" LogiPat:
" Author: Charles E. Campbell, Jr.
" Date: Sep 01, 2005
" Version: 2
" Author: Charles E. Campbell
" Date: Mar 13, 2013
" Version: 3
" 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,
" 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
" of any kind, either expressed or implied. By using this
" plugin, you agree that in no event will the copyright
@ -39,16 +39,18 @@
if &cp || exists("loaded_logipat")
finish
endif
let g:loaded_LogiPat = "v2"
let g:loaded_LogiPat = "v3"
let s:keepcpo = &cpo
set cpo&vim
"DechoRemOn
" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -nargs=* LogiPat call LogiPat(<q-args>,1)
silent! com -nargs=* LP call LogiPat(<q-args>,1)
com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>"
silent! com -nargs=+ LPF let s:LogiPatFlags="<args>"
com! -nargs=* LogiPat call LogiPat(<q-args>,1)
silent! com -nargs=* LP call LogiPat(<q-args>,1)
com! -nargs=+ ELP echomsg LogiPat(<q-args>)
com! -nargs=+ LogiPatFlags let s:LogiPatFlags="<args>"
silent! com -nargs=+ LPF let s:LogiPatFlags="<args>"
" =====================================================================
" Functions: {{{1
@ -75,32 +77,33 @@ fun! LogiPat(pat,...)
" call Decho("expr<".expr.">")
if expr =~ '^"'
" push a Pattern
let pat = substitute(strpart(expr,1),'^\([^"]*\)".*$','\1','')
let patlen = strlen(pat) - 1
" call Decho("pat<".pat."> patlen-1=".patlen)
if patlen > 1 && strpart(pat,patlen,1) == '\\'
echoerr "LogiPat doesn't accept escaped backquotes in patterns (yet)"
" call Dret("LogiPat --error--")
return '--error--'
endif
call s:LP_PatPush('.*'.pat.'.*')
let patlen = patlen+3
let expr = strpart(expr,patlen)
" push a Pattern; accept "" as a single " in the pattern
let expr = substitute(expr,'^\s*"','','')
let pat = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\1','')
let pat = substitute(pat,'""','"','g')
let expr = substitute(expr,'^\(\%([^"]\|\"\"\)\{-}\)"\([^"].*$\|$\)','\2','')
let expr = substitute(expr,'^\s*','','')
" call Decho("pat<".pat."> expr<".expr.">")
call s:LP_PatPush('.*'.pat.'.*')
elseif expr =~ '^[!()|&]'
" push an operator
let op = strpart(expr,0,1)
let expr = strpart(expr,strlen(op))
call s:LP_OpPush(op)
" push an operator
let op = strpart(expr,0,1)
let expr = strpart(expr,strlen(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'
" skip whitespace
let expr= strpart(expr,1)
" skip whitespace
let expr= strpart(expr,1)
else
echoerr "operator<".strpart(expr,0,1)."> not supported (yet)"
let expr= strpart(expr,1)
echoerr "operator<".strpart(expr,0,1)."> not supported (yet)"
let expr= strpart(expr,1)
endif
endwhile
@ -137,6 +140,12 @@ fun! LogiPat(pat,...)
return result
endfun
" ---------------------------------------------------------------------
" s:String: Vim6.4 doesn't have string() {{{2
func! s:String(str)
return "'".escape(a:str, '"')."'"
endfunc
" ---------------------------------------------------------------------
" LP_PatPush: {{{2
fun! s:LP_PatPush(pat)
@ -191,29 +200,30 @@ fun! s:LP_OpPush(op)
echoerr "expr<".expr."> not supported (yet)"
let preclvl= s:preclvl
endif
" call Decho("new operator<".a:op."> preclvl=".preclvl)
" execute higher-precdence operators
" call Decho("execute higher-precedence operators")
call s:LP_Execute(preclvl)
" 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 =~ '!'
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
elseif a:op =~ '|'
let preclvl= s:preclvl + 1
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
elseif a:op == '&'
let preclvl= s:preclvl + 2
let s:nopstack = s:nopstack + 1
let s:opprec_{s:nopstack} = preclvl
let s:opstack_{s:nopstack} = a:op
endif
" call s:StackLook("oppush") "Decho
" call Dret("LP_OpPush")
" call Dret("LP_OpPush : s:preclvl=".s:preclvl)
endfun
" ---------------------------------------------------------------------
@ -267,7 +277,7 @@ endfun
" LP_Or: writes a logical-or branch using two patterns {{{2
fun! s:LP_Or(pat1,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)
return ret
endfun
@ -318,3 +328,8 @@ fun! s:StackLook(description)
" call Dret("StackLook")
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
" save/restore mark position
" save/restore selected user maps
" Author: Charles E. Campbell, Jr.
" Author: Charles E. Campbell
" Version: 18h ASTRO-ONLY
" Date: Apr 05, 2010
" Date: Oct 16, 2012
"
" Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname)
@ -459,13 +459,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap
endif
let amap = a:maplead.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".dobuffer.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:sil! ".mapmode."unmap ".dobuffer.amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save single map <something>
@ -476,13 +476,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
let amap= "\<c-v>".amap
" call Decho("amap[[".amap."]]")
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
if maparg(a:mapchx,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save multiple maps
@ -494,13 +494,13 @@ fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".dobuffer.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".dobuffer.amap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
let i= i + 1
endwhile
@ -517,7 +517,7 @@ fun! RestoreUserMaps(suffix)
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
if s:restoremap_{a:suffix} != ""
" call Decho("exe ".s:restoremap_{a:suffix})
exe "silent! ".s:restoremap_{a:suffix}
exe "sil! ".s:restoremap_{a:suffix}
endif
unlet s:restoremap_{a:suffix}
endif

View File

@ -4,7 +4,10 @@
" License: This File is placed in the Public Domain.
" Revision | Date [DD.MM.YY] | Changes
" 00.01.00 | 05.07.09 | 01. Revision
" 00.01.10 | | -
" 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")
finish
@ -62,23 +65,30 @@ endif
noremap <unique> <script> <Plug>EditSrecPartCS <SID>AutoPartCS
noremap <SID>AutoPartCS <Esc>:call <SID>AutoPartCS()<CR>
" M0
" M1
" M2
" M3
" M4
" M5 = MakeS5
if !hasmapto('<Plug>MakeSrecLineS5')
map <unique> <Leader>m5 <Plug>MakeSrecLineS5
endif
noremap <unique> <script> <Plug>MakeSrecLineS5 <SID>MakeSrecS5
noremap <SID>MakeSrecS5 <Esc>:call <SID>MakeSrecS5()<CR>
" M6
" M7
" M8
" M9
" obsolete Mappings
"imap <F5> <Esc>:call <SID>AutoLineBC()<CR>a
"imap <F6> <Esc>:call <SID>AutoLineAD()<CR>a
"imap <F7> <Esc>:call <SID>AutoLineDA()<CR>a
"imap <F8> <Esc>:call <SID>AutoLineCS()<CR>a
"imap <C-F5> <Esc>:call <SID>AutoPartBC()<CR>a
"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
" MS = MakeSet
if !hasmapto('<Plug>MakeSet')
map <unique> <Leader>ms <Plug>MakeSet
endif
noremap <unique> <script> <Plug>MakeSet <SID>MakeSrecSet
noremap <SID>MakeSrecSet <Esc>:call <SID>MakeSrecSet()<CR>
" Functions
" create Line from ByteCount
fun s:AutoLineBC()
let s:ln = getline(".")
@ -184,5 +194,123 @@ fun s:MakeSrecS5()
unlet s:ln
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

View File

@ -6,7 +6,9 @@
" 00.01.00 | 05.07.09 | 01. Revision
" 00.01.10 | 29.03.10 | BugFix, in libsrec#CrCS()
" | | 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'
" and its Library 'libsrec.vim'.
@ -338,12 +340,14 @@ type "<Esc><Leader>pc"
the following Line will be created
S9030000FC
TestCase for leading Zeros -------
insert a new Line and type "S30F00000000000000000000000000EE"
type "<Esc><Leader>lc"
the following Line will be created
S30F00000000000000000000000000EE02
TestCase for Making S5 Record ----
insert
S30F00000000000000000000000000EE02
@ -354,3 +358,57 @@ type "<Esc><Leader>m5"
the following Line will be created
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
" PLUGIN SECTION
" Date: Feb 10, 2011
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" Date: Dec 06, 2012
" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" 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,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@ -20,7 +20,7 @@
if &cp || exists("g:loaded_netrwPlugin")
finish
endif
let g:loaded_netrwPlugin = "v142"
let g:loaded_netrwPlugin = "v147"
if v:version < 702
echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None
finish
@ -47,20 +47,15 @@ augroup END
" Network Browsing Reading Writing: {{{2
augroup Network
au!
if has("win32") || has("win95") || has("win64") || has("win16")
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
else
au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>"))
au BufReadCmd file://localhost/* call netrw#FileUrlRead(substitute(expand("<amatch>")),'file://localhost/','file:///','')
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>"))
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>"))
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 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 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>"))
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/
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
augroup END

View File

@ -2,30 +2,32 @@
" @Author: Tom Link (micathom AT gmail com)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 27-Dez-2004.
" @Last Change: 2011-05-26.
" @Revision: 720
" @Last Change: 2012-11-26.
" @Revision: 762
" GetLatestVimScripts: 1173 1 tcomment.vim
if &cp || exists('loaded_tcomment')
finish
endif
let loaded_tcomment = 205
let loaded_tcomment = 208
if !exists("g:tcommentMapLeader1")
" g:tcommentMapLeader1 should be a shortcut that can be used with
" map, imap, vmap.
let g:tcommentMapLeader1 = '<c-_>'
let g:tcommentMapLeader1 = '<c-_>' "{{{2
endif
if !exists("g:tcommentMapLeader2")
" g:tcommentMapLeader2 should be a shortcut that can be used with
" map, xmap.
let g:tcommentMapLeader2 = '<Leader>_'
let g:tcommentMapLeader2 = '<Leader>_' "{{{2
endif
if !exists("g:tcommentMapLeaderOp1")
let g:tcommentMapLeaderOp1 = 'gc'
" See |tcomment-operator|.
let g:tcommentMapLeaderOp1 = 'gc' "{{{2
endif
if !exists("g:tcommentMapLeaderOp2")
let g:tcommentMapLeaderOp2 = 'gC'
" See |tcomment-operator|.
let g:tcommentMapLeaderOp2 = 'gC' "{{{2
endif
@ -106,7 +108,8 @@ if (g:tcommentMapLeader1 != '')
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<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 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
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 'noremap '. g:tcommentMapLeader1 .'s :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
if (g:tcommentMapLeader2 != '')
exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>'
@ -123,20 +134,24 @@ if (g:tcommentMapLeader2 != '')
exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment '
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<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 .'a :TCommentAs '
exec 'noremap '. g:tcommentMapLeader2 .'n :TCommentAs <c-r>=&ft<cr> '
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
endif
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 'xnoremap <silent> '. g:tcommentMapLeaderOp1 .' :TCommentMaybeInline<cr>'
endif
if (g:tcommentMapLeaderOp2 != '')
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 'xnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline<cr>'
exec 'xnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline!<cr>'
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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandBZRExec', 'bzr')
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2

View File

@ -378,31 +378,21 @@ endfunction
" command line on Windows systems.
function! s:VCSCommandUtility.system(...)
if (has("win32") || has("win64")) && &sxq !~ '"'
let save_sxq = &sxq
set sxq=\"
endif
try
let output = call('system', a:000)
if exists('*iconv') && has('multi_byte')
if(strlen(&tenc) && &tenc != &enc)
let output = iconv(output, &tenc, &enc)
else
let originalBuffer = VCSCommandGetOriginalBuffer(VCSCommandGetOption('VCSCommandEncodeAsFile', 0))
if originalBuffer
let fenc = getbufvar(originalBuffer, '&fenc')
if fenc != &enc
let output = iconv(output, fenc, &enc)
endif
let output = call('system', a:000)
if exists('*iconv') && has('multi_byte')
if(strlen(&tenc) && &tenc != &enc)
let output = iconv(output, &tenc, &enc)
else
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
finally
if exists("save_sxq")
let &sxq = save_sxq
endif
endtry
endif
return output
endfunction
@ -1033,8 +1023,7 @@ function! s:VCSVimDiff(...)
let b:VCSCommandCommand = 'vimdiff'
diffthis
let t:vcsCommandVimDiffScratchList = [resultBuffer]
" If no split method is defined, cheat, and set it to vertical.
call s:VCSCommandUtility.pushContext({'VCSCommandSplit': orientation})
call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation})
try
let resultBuffer = s:VCSReview(a:2)
finally
@ -1048,7 +1037,6 @@ function! s:VCSVimDiff(...)
diffthis
let t:vcsCommandVimDiffScratchList += [resultBuffer]
else
" Add new buffer. Force splitting behavior, otherwise why use vimdiff?
call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation})
try
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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandCVSExec', 'cvs')
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
endfunction
" 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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandGitExec', 'git')
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
endfunction
" 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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandHGExec', 'hg')
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
endfunction
" 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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandSVKExec', 'svk')
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
endfunction
" 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
" command.
function! s:Executable()
return VCSCommandGetOption('VCSCommandSVNExec', 'svn')
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -193,6 +193,10 @@ function! s:svnFunctions.GetBufferInfo()
if statusText =~ '^?'
return ['Unknown']
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]
if revision == ''

View File

@ -1,7 +1,7 @@
" Language : Netrw Remote-Directory Listing Syntax
" Maintainer : Charles E. Campbell, Jr.
" Last change: Jan 14, 2009
" Version : 16
" Last change: Dec 18, 2012
" Version : 17
" ---------------------------------------------------------------------
" 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 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 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 netrwTreeBarSpace " " contained
@ -56,14 +56,17 @@ if exists("g:netrw_special_syntax") && netrw_special_syntax
if has("unix")
syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell
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 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 netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" 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 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
endif
@ -95,12 +98,15 @@ if !exists("did_drchip_netrwlist_syntax")
hi default link netrwCompress Folded
hi default link netrwCoreDump WarningMsg
hi default link netrwData DiffChange
hi default link netrwHdr netrwPlain
hi default link netrwLex netrwPlain
hi default link netrwLib DiffChange
hi default link netrwMakefile DiffChange
hi default link netrwObj Folded
hi default link netrwTilde Folded
hi default link netrwTmp Folded
hi default link netrwTags Folded
hi default link netrwYacc netrwPlain
endif
" Current Syntax: {{{1