1
0
mirror of https://github.com/akelge/zsh synced 2025-07-04 13:39:07 +00:00

Added GetLatestScript update plugin and updated all plugins

This commit is contained in:
2013-01-17 12:18:17 +00:00
parent d9013ec2da
commit 4873c64f28
54 changed files with 10380 additions and 4761 deletions

View File

@ -1,11 +1,9 @@
" AlignMapsPlugin: Alignment maps based upon <Align.vim> and <AlignMaps.vim>
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
" Date: Mar 03, 2009
" Date: Jun 18, 2012
"
" NOTE: the code herein needs vim 6.0 or later
" needs <Align.vim> v6 or later
" needs <cecutil.vim> v5 or later
" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1
" NOTE: the code herein needs vim 7.0 or later
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
@ -14,7 +12,12 @@
" plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
" of this software.
"
" Romans 1:20 For the invisible things of Him since the creation of the {{{1
" world are clearly seen, being perceived through the things that are
" made, even His everlasting power and divinity; that they may be
" without excuse.
" ---------------------------------------------------------------------
" Usage: {{{1
" Use 'a to mark beginning of to-be-aligned region, Alternative: use V
" move cursor to end of region, and execute map. (linewise visual mode) to
@ -29,20 +32,18 @@
"
" Note: these maps all use <Align.vim>.
"
" Romans 1:20 For the invisible things of Him since the creation of the {{{1
" world are clearly seen, being perceived through the things that are
" made, even His everlasting power and divinity; that they may be
" without excuse.
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_AlignMapsPlugin")
finish
endif
let s:keepcpo = &cpo
let g:loaded_AlignMapsPlugin = "v41"
let g:loaded_AlignMapsPlugin = "v42"
set cpo&vim
" =====================================================================
" Public Interface: {{{1
com! AlignMapsClean :call AlignMaps#AlignMapsClean()
" =====================================================================
" Maps: {{{1
@ -79,14 +80,17 @@ if !hasmapto('<Plug>AM_adec') |map <unique> <Leader>adec <Plug>AM_adec|endif
if !hasmapto('<Plug>AM_adef') |map <unique> <Leader>adef <Plug>AM_adef|endif
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
if !hasmapto('<Plug>AM_afnc') |map <unique> <Leader>afnc <Plug>AM_afnc|endif
if !hasmapto('<Plug>AM_aunum')|map <unique> <Leader>aunum <Plug>AM_aenum|endif
if !hasmapto('<Plug>AM_aenum')|map <unique> <Leader>aenum <Plug>AM_aunum|endif
" 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 exists("g:alignmaps_euronumber") && !exists("g:alignmaps_usanumber")
if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aenum|endif
else
if !hasmapto('<Plug>AM_anum')|map <unique> <Leader>anum <Plug>AM_aunum|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
@ -97,12 +101,11 @@ map <silent> <script> <Plug>AM_acom <SID>WS:'a,.s/\/[*/]\/\=/@&@/e<CR>:'a,.s/\*
map <silent> <script> <Plug>AM_adcom <SID>WS:'a,.v/^\s*\/[/*]/s/\/[*/]\*\=/@&@/e<CR>:'a,.v/^\s*\/[/*]/s/\*\//@&/e<CR>:'y,'zv/^\s*\/[/*]/s/^\( *\) @/\1@/e<CR>'zk:call AlignMaps#StdAlign(3)<cr>:'y,'zv/^\s*\/[/*]/s/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
map <silent> <script> <Plug>AM_aocom <SID>WS:AlignPush<CR>:AlignCtrl g /[*/]<CR>:exe "norm \<Plug>AM_acom"<cr>:AlignPop<CR><SID>WE
map <silent> <script> <Plug>AM_ascom <SID>WS:'a,.s/\/[*/]/@&@/e<CR>:'a,.s/\*\//@&/e<CR>:silent! 'a,.g/^\s*@\/[*/]/s/@//ge<CR>:AlignCtrl v ^\s*\/[*/]<CR>:AlignCtrl g \/[*/]<CR>'zk:call AlignMaps#StdAlign(2)<cr>:'y,'zs/^\(\s*\) @/\1/e<CR>:'y,'zs/ @//eg<CR><SID>WE
map <silent> <script> <Plug>AM_adec <SID>WS:'a,'zs/\([^ \t/(]\)\([*&]\)/\1 \2/e<CR>:'y,'zv/^\//s/\([^ \t]\)\s\+/\1 /ge<CR>:'y,'zv/^\s*[*/]/s/\([^/][*&]\)\s\+/\1/ge<CR>:'y,'zv/^\s*[*/]/s/^\(\s*\%(\K\k*\s\+\%([a-zA-Z_*(&]\)\@=\)\+\)\([*(&]*\)\s*\([a-zA-Z0-9_()]\+\)\s*\(\(\[.\{-}]\)*\)\s*\(=\)\=\s*\(.\{-}\)\=\s*;/\1@\2#@\3\4@\6@\7;@/e<CR>:'y,'zv/^\s*[*/]/s/\*\/\s*$/@*\//e<CR>:'y,'zv/^\s*[*/]/s/^\s\+\*/@@@@@* /e<CR>:'y,'zv/^\s*[*/]/s/^@@@@@\*\(.*[^*/]\)$/&@*/e<CR>'yjma'zk:AlignCtrl v ^\s*[*/#]<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_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/\%([0-9.]\)\s\+\zs\([-+.]\=\d\)/@\1/ge<CR>:'a,'zs/\(\(^\|\s\)\d\+\)\(\s\+\)@/\1@\3@/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [.@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(\.\)\(\s\+\)\([0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
map <silent> <script> <Plug>AM_aenum <SID>WS:'a,'zs/\%([0-9.]\)\s\+\([-+]\=\d\)/\1@\2/ge<CR>:'a,'zs/\.@/\.0@/ge<CR>:AlignCtrl wmp0P0r<CR>:'a,'zAlign [,@]<CR>:'a,'zs/@/ /ge<CR>:'a,'zs/\(,\)\(\s\+\)\([-0-9.,eE+]\+\)/\1\3\2/ge<CR>:'a,'zs/\([eE]\)\(\s\+\)\([0-9+\-+]\+\)/\1\3\2/ge<CR><SID>WE
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
" ---------------------------------------------------------------------
" html table alignment {{{2
if !hasmapto('<Plug>AM_Htd')|map <unique> <Leader>Htd <Plug>AM_Htd|endif
@ -120,6 +123,7 @@ 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
@ -134,6 +138,7 @@ map <silent> <script> <Plug>AM_T< <SID>WS:AlignCtrl mIp0P0=r <<CR>:'a,.Align<C
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
@ -156,12 +161,13 @@ 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_tt') |map <unique> <Leader>tt <Plug>AM_tt|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
@ -170,28 +176,29 @@ map <silent> <script> <Plug>AM_t: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR
map <silent> <script> <Plug>AM_t; <SID>WS:AlignCtrl mIp0P1=l ;<CR>:'a,.Align<CR>:sil 'y,'zs/\( *\);/;\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_t< <SID>WS:AlignCtrl mIp0P0=l <<CR>:'a,.Align<CR><SID>WE
map <silent> <script> <Plug>AM_t= <SID>WS:call AlignMaps#Equals()<CR><SID>WE
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l #<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)#/,\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_ts, <SID>WS:AlignCtrl mIp0P1=l ,<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\),/,\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_ts: <SID>WS:AlignCtrl mIp1P1=l :<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\):/:\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_ts; <SID>WS:AlignCtrl mIp1P1=l ;<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\);/;\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_ts< <SID>WS:AlignCtrl mIp1P1=l <<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)</<\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_ts= <SID>WS:AlignCtrl mIp1P1=l =<CR>:'a,.Align<CR>:sil 'y+1,'z-1s/\(\s*\)=/=\1/ge<CR><SID>WE
map <silent> <script> <Plug>AM_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_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 \<Char-0x0f>"<bar>endif<CR>:'a,.Align<CR>:exe "'y+1,'z-1s/\<Char-0x0f>/".((&ts == 1)? '\t' : ' ')."/g"<CR><SID>WE
map <silent> <script> <Plug>AM_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:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).escape(substitute(submatch(2),'\s\+','@','g'),'\')/<CR>:AlignCtrl mI=lp0P0 @<CR>:'a,.Align<CR>:'y+1,'z-1s/@/ /g<CR><SID>WE
map <silent> <script> <Plug>AM_tsq <SID>WS:'a,.AlignReplaceQuotedSpaces<CR>:'a,.s/^\(\s*\)\(.*\)/\=submatch(1).substitute(submatch(2),'\s\+','@','g')/<CR>:AlignCtrl mIp0P0=l @<CR>:'a,.Align<CR>:'y+1,'z-1s/[%@]/ /g<CR><SID>WE
map <silent> <script> <Plug>AM_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
" =====================================================================
" Menu Support: {{{1
" ma ..move.. use menu
" v V or ctrl-v ..move.. use menu
if has("menu") && has("gui_running") && &go =~ 'm' && !exists("s:firstmenu")
if has("menu") && has("gui_running") && &go =~# 'm' && !exists("s:firstmenu")
let s:firstmenu= 1
if !exists("g:DrChipTopLvlMenu")
let g:DrChipTopLvlMenu= "DrChip."

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

482
vim/plugin/cecutil.vim Normal file
View File

@ -0,0 +1,482 @@
" cecutil.vim : save/restore window position
" save/restore mark position
" save/restore selected user maps
" Author: Charles E. Campbell, Jr.
" Version: 17
" Date: Sep 04, 2007
"
" Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname)
" call RestoreMark(markname) call RestoreMark(savemark)
" call DestroyMark(markname)
" commands: SM RM DM
"
" Saving Restoring Destroying Window Position: {{{1
" call SaveWinPosn() let winposn= SaveWinPosn()
" call RestoreWinPosn() call RestoreWinPosn(winposn)
" \swp : save current window/buffer's position
" \rwp : restore current window/buffer's previous position
" commands: SWP RWP
"
" Saving And Restoring User Maps: {{{1
" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call RestoreUserMaps(suffix)
"
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
"
" You believe that God is one. You do well. The demons also {{{1
" believe, and shudder. But do you want to know, vain man, that
" faith apart from works is dead? (James 2:19,20 WEB)
" Load Once: {{{1
if &cp || exists("g:loaded_cecutil")
finish
endif
let g:loaded_cecutil = "v17"
let s:keepcpo = &cpo
set cpo&vim
"DechoVarOn
" -----------------------
" Public Interface: {{{1
" -----------------------
" Map Interface: {{{2
if !hasmapto('<Plug>SaveWinPosn')
map <unique> <Leader>swp <Plug>SaveWinPosn
endif
if !hasmapto('<Plug>RestoreWinPosn')
map <unique> <Leader>rwp <Plug>RestoreWinPosn
endif
nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
" Command Interface: {{{2
com! -bar -nargs=0 SWP call SaveWinPosn()
com! -bar -nargs=0 RWP call RestoreWinPosn()
com! -bar -nargs=1 SM call SaveMark(<q-args>)
com! -bar -nargs=1 RM call RestoreMark(<q-args>)
com! -bar -nargs=1 DM call DestroyMark(<q-args>)
if v:version < 630
let s:modifier= "sil "
else
let s:modifier= "sil keepj "
endif
" ---------------------------------------------------------------------
" SaveWinPosn: {{{1
" let winposn= SaveWinPosn() will save window position in winposn variable
" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
fun! SaveWinPosn(...)
" call Dfunc("SaveWinPosn() a:0=".a:0)
if line(".") == 1 && getline(1) == ""
" call Dfunc("SaveWinPosn : empty buffer")
return ""
endif
let so_keep = &so
let siso_keep = &siso
let ss_keep = &ss
set so=0 siso=0 ss=0
let swline = line(".")
let swcol = col(".")
let swwline = winline() - 1
let swwcol = virtcol(".") - wincol()
let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
if swwline > 0
let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
endif
if swwcol > 0
let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
endif
let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
" save window position in
" b:cecutil_winposn_{iwinposn} (stack)
" only when SaveWinPosn() is used
if a:0 == 0
if !exists("b:cecutil_iwinposn")
let b:cecutil_iwinposn= 1
else
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
endif
" call Decho("saving posn to SWP stack")
let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
endif
let &so = so_keep
let &siso = siso_keep
let &ss = ss_keep
" if exists("b:cecutil_iwinposn") " Decho
" call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
" else " Decho
" call Decho("b:cecutil_iwinposn doesn't exist")
" endif " Decho
" call Dret("SaveWinPosn [".savedposn."]")
return savedposn
endfun
" ---------------------------------------------------------------------
" RestoreWinPosn: {{{1
fun! RestoreWinPosn(...)
" call Dfunc("RestoreWinPosn() a:0=".a:0)
" call Decho("getline(1)<".getline(1).">")
" call Decho("line(.)=".line("."))
if line(".") == 1 && getline(1) == ""
" call Dfunc("RestoreWinPosn : empty buffer")
return ""
endif
let so_keep = &so
let siso_keep = &siso
let ss_keep = &ss
set so=0 siso=0 ss=0
if a:0 == 0 || a:1 == ""
" use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
" call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
try
exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
catch /^Vim\%((\a\+)\)\=:E749/
" ignore empty buffer error messages
endtry
" normally drop top-of-stack by one
" but while new top-of-stack doesn't exist
" drop top-of-stack index by one again
if b:cecutil_iwinposn >= 1
unlet b:cecutil_winposn{b:cecutil_iwinposn}
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
endwhile
if b:cecutil_iwinposn < 1
unlet b:cecutil_iwinposn
endif
endif
else
echohl WarningMsg
echomsg "***warning*** need to SaveWinPosn first!"
echohl None
endif
else " handle input argument
" call Decho("using input a:1<".a:1.">")
" use window position passed to this function
exe "silent ".a:1
" remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
if exists("b:cecutil_iwinposn")
let jwinposn= b:cecutil_iwinposn
while jwinposn >= 1 " search for a:1 in iwinposn..1
if exists("b:cecutil_winposn{jwinposn}") " if it exists
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
unlet b:cecutil_winposn{jwinposn} " unlet it
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
endif
endif
endif
let jwinposn= jwinposn - 1
endwhile
endif
endif
" seems to be something odd: vertical motions after RWP
" cause jump to first column. Following fixes that
if wincol() > 1
silent norm! hl
elseif virtcol(".") < virtcol("$")
silent norm! lh
endif
let &so = so_keep
let &siso = siso_keep
let &ss = ss_keep
" call Dret("RestoreWinPosn")
endfun
" ---------------------------------------------------------------------
" GoWinbufnr: go to window holding given buffer (by number) {{{1
" Prefers current window; if its buffer number doesn't match,
" then will try from topleft to bottom right
fun! GoWinbufnr(bufnum)
" call Dfunc("GoWinbufnr(".a:bufnum.")")
if winbufnr(0) == a:bufnum
" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
return
endif
winc t
let first=1
while winbufnr(0) != a:bufnum && (first || winnr() != 1)
winc w
let first= 0
endwhile
" call Dret("GoWinbufnr")
endfun
" ---------------------------------------------------------------------
" SaveMark: sets up a string saving a mark position. {{{1
" For example, SaveMark("a")
" Also sets up a global variable, g:savemark_{markname}
fun! SaveMark(markname)
" call Dfunc("SaveMark(markname<".a:markname.">)")
let markname= a:markname
if strpart(markname,0,1) !~ '\a'
let markname= strpart(markname,1,1)
endif
" call Decho("markname=".markname)
let lzkeep = &lz
set lz
if 1 <= line("'".markname) && line("'".markname) <= line("$")
let winposn = SaveWinPosn(0)
exe s:modifier."norm! `".markname
let savemark = SaveWinPosn(0)
let g:savemark_{markname} = savemark
let savemark = markname.savemark
call RestoreWinPosn(winposn)
else
let g:savemark_{markname} = ""
let savemark = ""
endif
let &lz= lzkeep
" call Dret("SaveMark : savemark<".savemark.">")
return savemark
endfun
" ---------------------------------------------------------------------
" RestoreMark: {{{1
" call RestoreMark("a") -or- call RestoreMark(savemark)
fun! RestoreMark(markname)
" call Dfunc("RestoreMark(markname<".a:markname.">)")
if strlen(a:markname) <= 0
" call Dret("RestoreMark : no such mark")
return
endif
let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
let lzkeep = &lz
set lz
let winposn = SaveWinPosn(0)
if strlen(a:markname) <= 2
if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
" use global variable g:savemark_{markname}
" call Decho("use savemark list")
call RestoreWinPosn(g:savemark_{markname})
exe "norm! m".markname
endif
else
" markname is a savemark command (string)
" call Decho("use savemark command")
let markcmd= strpart(a:markname,1)
call RestoreWinPosn(markcmd)
exe "norm! m".markname
endif
call RestoreWinPosn(winposn)
let &lz = lzkeep
" call Dret("RestoreMark")
endfun
" ---------------------------------------------------------------------
" DestroyMark: {{{1
" call DestroyMark("a") -- destroys mark
fun! DestroyMark(markname)
" call Dfunc("DestroyMark(markname<".a:markname.">)")
" save options and set to standard values
let reportkeep= &report
let lzkeep = &lz
set lz report=10000
let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname)
let curmod = &mod
let winposn = SaveWinPosn(0)
1
let lineone = getline(".")
exe "k".markname
d
put! =lineone
let &mod = curmod
call RestoreWinPosn(winposn)
" restore options to user settings
let &report = reportkeep
let &lz = lzkeep
" call Dret("DestroyMark")
endfun
" ---------------------------------------------------------------------
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{1
" However, <q-args> doesn't split at all, so this one returns a list
" with splits at all whitespace (only!), plus a leading length-of-list.
" The resulting list: qarglist[0] corresponds to a:0
" qarglist[i] corresponds to a:{i}
fun! QArgSplitter(qarg)
" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
let qarglist = split(a:qarg)
let qarglistlen = len(qarglist)
let qarglist = insert(qarglist,qarglistlen)
" call Dret("QArgSplitter ".string(qarglist))
return qarglist
endfun
" ---------------------------------------------------------------------
" ListWinPosn:
"fun! ListWinPosn() " Decho
" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
" call Decho("nothing on SWP stack") " Decho
" else " Decho
" let jwinposn= b:cecutil_iwinposn " Decho
" while jwinposn >= 1 " Decho
" if exists("b:cecutil_winposn{jwinposn}") " Decho
" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
" else " Decho
" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
" endif " Decho
" let jwinposn= jwinposn - 1 " Decho
" endwhile " Decho
" endif " Decho
"endfun " Decho
"com! -nargs=0 LWP call ListWinPosn() " Decho
" ---------------------------------------------------------------------
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{1
" which can be used to restore user maps later with
" call RestoreUserMaps()
"
" mapmode - see :help maparg for its list
" ex. "n" = Normal
" If the first letter is u, then unmapping will be done
" ex. "un" = Normal + unmapping
" maplead - see mapchx
" mapchx - "<something>" handled as a single map item.
" ex. "<left>"
" - "string" a string of single letters which are actually
" multiple two-letter maps (using the maplead:
" maplead . each_character_in_string)
" ex. maplead="\" and mapchx="abc" saves user mappings for
" \a, \b, and \c
" Of course, if maplead is "", then for mapchx="abc",
" mappings for a, b, and c are saved.
" - :something handled as a single map item, w/o the ":"
" ex. mapchx= ":abc" will save a mapping for "abc"
" suffix - a string unique to your plugin
" ex. suffix= "DrawIt"
fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
if !exists("s:restoremap_{a:suffix}")
" initialize restoremap_suffix to null string
let s:restoremap_{a:suffix}= ""
endif
" set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
" if 0, save only
if a:mapmode =~ '^u'
let dounmap= 1
let mapmode= strpart(a:mapmode,1)
else
let dounmap= 0
let mapmode= a:mapmode
endif
" save single map :...something...
if strpart(a:mapchx,0,1) == ':'
let amap= strpart(a:mapchx,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let amap = a:maplead.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
" save single map <something>
elseif strpart(a:mapchx,0,1) == '<'
let amap = a:mapchx
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
if maparg(a:mapchx,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
" save multiple maps
else
let i= 1
while i <= strlen(a:mapchx)
let amap= a:maplead.strpart(a:mapchx,i-1,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
let i= i + 1
endwhile
endif
" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
endfun
" ---------------------------------------------------------------------
" RestoreUserMaps: {{{1
" Used to restore user maps saved by SaveUserMaps()
fun! RestoreUserMaps(suffix)
" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
if exists("s:restoremap_{a: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}
endif
unlet s:restoremap_{a:suffix}
endif
" call Dret("RestoreUserMaps")
endfun
" ---------------------------------------------------------------------
" Restore: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" ---------------------------------------------------------------------
" Modelines: {{{1
" vim: ts=4 fdm=marker

View File

@ -1,11 +1,11 @@
" FILE: plugin/conque_term.vim {{{
" AUTHOR: Nico Raffo <nicoraffo@gmail.com>
" WEBSITE: http://conque.googlecode.com
" MODIFIED: 2010-11-15
" VERSION: 2.0, for Vim 7.0
" MODIFIED: 2011-08-12
" VERSION: 2.2, for Vim 7.0
" LICENSE:
" Conque - Vim terminal/console emulator
" Copyright (C) 2009-2010 Nico Raffo
" Copyright (C) 2009-__YEAR__ Nico Raffo
"
" MIT License
"
@ -28,18 +28,26 @@
" THE SOFTWARE.
" }}}
" See docs/conque_term.txt for help or type :help conque_term
" See docs/conque_term.txt for help or type :help ConqueTerm
if exists('g:ConqueTerm_Loaded') || v:version < 700
finish
endif
" **********************************************************************************************************
" **** CONFIG **********************************************************************************************
" **** CONFIGURATION ***************************************************************************************
" **********************************************************************************************************
" {{{
" Fast mode {{{
" Disables all features which could cause Conque to run slowly, including:
" * Disables terminal colors
" * Disables some multi-byte character handling
if !exists('g:ConqueTerm_FastMode')
let g:ConqueTerm_FastMode = 0
endif " }}}
" automatically go into insert mode when entering buffer {{{
if !exists('g:ConqueTerm_InsertOnEnter')
let g:ConqueTerm_InsertOnEnter = 0
@ -57,22 +65,46 @@ if !exists('g:ConqueTerm_EscKey')
let g:ConqueTerm_EscKey = '<Esc>'
endif " }}}
" Use this key to execute the current file in a split window. {{{
" THIS IS A GLOBAL KEY MAPPING
if !exists('g:ConqueTerm_ExecFileKey')
let g:ConqueTerm_ExecFileKey = '<F11>'
endif " }}}
" Use this key to send the current file contents to conque. {{{
" THIS IS A GLOBAL KEY MAPPING
if !exists('g:ConqueTerm_SendFileKey')
let g:ConqueTerm_SendFileKey = '<F10>'
endif " }}}
" Use this key to send selected text to conque. {{{
" THIS IS A GLOBAL KEY MAPPING
if !exists('g:ConqueTerm_SendVisKey')
let g:ConqueTerm_SendVisKey = '<F9>'
endif " }}}
" Use this key to toggle terminal key mappings. {{{
" Only mapped inside of Conque buffers.
if !exists('g:ConqueTerm_ToggleKey')
let g:ConqueTerm_ToggleKey = '<F8>'
endif " }}}
" Enable color. {{{
" If your apps use a lot of color it will slow down the shell.
" 0 - no terminal colors. You still will see Vim syntax highlighting.
" 1 - limited terminal colors (recommended). Past terminal color history cleared regularly.
" 2 - all terminal colors. Terminal color history never cleared.
if !exists('g:ConqueTerm_Color')
let g:ConqueTerm_Color = 1
endif " }}}
" Color mode. Windows ONLY {{{
" Set this variable to 'conceal' to use Vim's conceal mode for terminal colors.
" This makes colors render much faster, but has some odd baggage.
if !exists('g:ConqueTerm_ColorMode')
let g:ConqueTerm_ColorMode = ''
endif " }}}
" TERM environment setting {{{
if !exists('g:ConqueTerm_TERM')
let g:ConqueTerm_TERM = 'vt100'
@ -117,6 +149,32 @@ if !exists('g:ConqueTerm_SendFunctionKeys')
let g:ConqueTerm_SendFunctionKeys = 0
endif " }}}
" Session support {{{
if !exists('g:ConqueTerm_SessionSupport')
let g:ConqueTerm_SessionSupport = 0
endif " }}}
" hide Conque startup messages {{{
" messages should only appear the first 3 times you start Vim with a new version of Conque
" and include important Conque feature and option descriptions
" TODO - disabled and unused for now
if !exists('g:ConqueTerm_StartMessages')
let g:ConqueTerm_StartMessages = 1
endif " }}}
" Windows character code page {{{
" Leave at 0 to use current environment code page.
" Use 65001 for utf-8, although many console apps do not support it.
if !exists('g:ConqueTerm_CodePage')
let g:ConqueTerm_CodePage = 0
endif " }}}
" InsertCharPre support {{{
" Disable this feature by default, still in Beta
if !exists('g:ConqueTerm_InsertCharPre')
let g:ConqueTerm_InsertCharPre = 0
endif " }}}
" }}}
" **********************************************************************************************************
@ -127,7 +185,7 @@ endif " }}}
let g:ConqueTerm_Loaded = 1
let g:ConqueTerm_Idx = 0
let g:ConqueTerm_Version = 200
let g:ConqueTerm_Version = 210
command! -nargs=+ -complete=shellcmd ConqueTerm call conque_term#open(<q-args>)
command! -nargs=+ -complete=shellcmd ConqueTermSplit call conque_term#open(<q-args>, ['belowright split'])
@ -136,4 +194,20 @@ command! -nargs=+ -complete=shellcmd ConqueTermTab call conque_term#open(<q-args
" }}}
" **********************************************************************************************************
" **** Global Mappings & Autocommands **********************************************************************
" **********************************************************************************************************
" Startup {{{
if exists('g:ConqueTerm_SessionSupport') && g:ConqueTerm_SessionSupport == 1
autocmd SessionLoadPost * call conque_term#resume_session()
endif
if maparg(g:ConqueTerm_ExecFileKey, 'n') == ''
exe 'nnoremap <silent> ' . g:ConqueTerm_ExecFileKey . ' :call conque_term#exec_file()<CR>'
endif
" }}}
" vim:foldmethod=marker

View File

@ -0,0 +1,38 @@
" ---------------------------------------------------------------------
" getscriptPlugin.vim
" Author: Charles E. Campbell, Jr.
" Date: Jan 07, 2008
" Installing: :help glvs-install
" Usage: :help glvs
"
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
"
" (Rom 15:11 WEB) Again, "Praise the Lord, all you Gentiles! Let
" all the peoples praise Him."
" ---------------------------------------------------------------------
" Initialization: {{{1
" if you're sourcing this file, surely you can't be
" expecting vim to be in its vi-compatible mode
if &cp || exists("g:loaded_getscriptPlugin")
if &verbose
echo "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
endif
finish
endif
let g:loaded_getscriptPlugin = "v33"
let s:keepcpo = &cpo
set cpo&vim
" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
com! -nargs=0 GetScripts call getscript#GetLatestVimScripts()
silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
" ---------------------------------------------------------------------
" Restore Options: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" ---------------------------------------------------------------------
" vim: ts=8 sts=2 fdm=marker nowrap

View File

@ -1,78 +0,0 @@
"pydoc.vim: pydoc integration for vim
"performs searches and can display the documentation of python modules
"Author: Andr<64> Kelpe <fs111 at web dot de>
"http://www.vim.org/scripts/script.php?script_id=910
"This plugin integrates the pydoc into vim. You can view the
"documentation of a module by using :Pydoc foo.bar.baz or search
"a word (uses pydoc -k) in the documentation by typing PydocSearch
"foobar. You can also view the documentation of the word under the
"cursor by pressing <leader>pw or the WORD (see :help WORD) by pressing
"<leader>pW. "This is very useful if you want to jump to a module which was found by
"PydocSearch. To have a browser like feeling you can use u and CTRL-R to
"go back and forward, just like editing normal text.
"If you want to use the script and pydoc is not in your PATH, just put a
"line like
" let g:pydoc_cmd = \"/usr/bin/pydoc" (without the backslash!!)
"in your .vimrc
"pydoc.vim is free software, you can redistribute or modify
"it under the terms of the GNU General Public License Version 2 or any
"later Version (see http://www.gnu.org/copyleft/gpl.html for details).
"Please feel free to contact me.
set switchbuf=useopen
function! ShowPyDoc(name, type)
if !exists('g:pydoc_cmd')
let g:pydoc_cmd = 'pydoc'
endif
if bufnr("__doc__") >0
exe "sb __doc__"
else
exe 'split __doc__'
endif
setlocal noswapfile
set buftype=nofile
setlocal modifiable
normal ggdG
let s:name2 = substitute(a:name, '(.*', '', 'g' )
if a:type==1
execute "silent read ! " g:pydoc_cmd . " " . s:name2
else
execute "silent read ! ".g:pydoc_cmd. " -k " . s:name2
endif
setlocal nomodified
set filetype=man
normal 1G
if !exists('g:pydoc_highlight')
let g:pydoc_highlight = 1
endif
if g:pydoc_highlight ==1
call Highlight(s:name2)
endif
endfunction
function! Highlight(name)
exe "sb __doc__"
set filetype=man
syn on
exe 'syntax keyword pydoc '.s:name2
hi pydoc gui=reverse
endfunction
"mappings
map <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
map <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>
"commands
command -nargs=1 Pydoc :call ShowPyDoc('<args>', 1)
command -nargs=* PydocSearch :call ShowPyDoc('<args>', 0)

196
vim/plugin/python_pydoc.vim Normal file
View File

@ -0,0 +1,196 @@
" Vim ftplugin file
" Language: Python
" Authors: André Kelpe <efeshundertelf at googlemail dot com>
" Romain Chossart <romainchossat at gmail dot com>
" Matthias Vogelgesang
" Ricardo Catalinas Jiménez <jimenezrick at gmail dot com>
" Patches and suggestions from all sorts of fine people
"
" More info and updates at:
"
" http://www.vim.org/scripts/script.php?script_id=910
"
"
" This plugin integrates the Python documentation view and search tool pydoc
" into Vim. It allows you to view the documentation of a Python module or class
" by typing:
"
" :Pydoc foo.bar.baz (e.g. :Pydoc re.compile)
"
" Or search a word (uses pydoc -k) in the documentation by typing:
"
" :PydocSearch foobar (e.g. :PydocSearch socket)
"
" Vim will split the current window to show the Python documentation found by
" pydoc (the buffer will be called '__doc__', Pythonic, isn't it ;-) ). The
" name may cause problems if you have a file with the same name, but usually
" this should not happen.
"
" pydoc.vim also allows you to view the documentation of the 'word' (see :help
" word) under the cursor by pressing <Leader>pw or the 'WORD' (see :help WORD)
" under the cursor by pressing <Leader>pW. This is very useful if you want to
" jump to the docs of a module or class found by 'PydocSearch' or if you want
" to see the docs of a module/class in your source code. Additionally K is
" mapped to show invoke pydoc as well, when you are editing python files.
"
" The script is developed in GitHub at:
"
" http://github.com/fs111/pydoc.vim
"
"
" If you want to use the script and pydoc is not in your PATH, just put a
" line like this in your .vimrc:
"
" let g:pydoc_cmd = '/usr/bin/pydoc'
"
" or more portable
"
" let g:pydoc_cmd = 'python -m pydoc'
"
" If you want to open pydoc files in vertical splits or tabs, give the
" appropriate command in your .vimrc with:
"
" let g:pydoc_open_cmd = 'vsplit'
"
" or
"
" let g:pydoc_open_cmd = 'tabnew'
"
" The script will highlight the search term by default. To disable this behaviour
" put in your .vimrc:
"
" let g:pydoc_highlight=0
"
"
" In order to install pydoc.vim download it from vim.org or clone the repository
" on githubi and put it in your .vim/ftplugin directory. pydoc.vim is also fully
" compatible with pathogen, so cloning the repository into your bundle directory
" is also a valid way to install it. (I do this myself. see
" https://github.com/fs111/dotvim).
"
" pydoc.vim is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License
" as published by the Free Software Foundation; either version 2
" of the License, or (at your option) any later version.
"
" Please feel free to contact me and follow me on twitter (@fs111).
" IMPORTANT: We don't use here the `exists("b:did_ftplugin")' guard becase we
" want to let the Python filetype script that comes with Vim to execute as
" normal.
" Don't redefine the functions if this ftplugin has been executed previously
" and before finish create the local mappings in the current buffer
if exists('*s:ShowPyDoc') && g:pydoc_perform_mappings
call s:PerformMappings()
finish
endif
if !exists('g:pydoc_perform_mappings')
let g:pydoc_perform_mappings = 1
endif
if !exists('g:pydoc_highlight')
let g:pydoc_highlight = 1
endif
if !exists('g:pydoc_cmd')
let g:pydoc_cmd = 'pydoc'
endif
if !exists('g:pydoc_open_cmd')
let g:pydoc_open_cmd = 'split'
endif
setlocal switchbuf=useopen
highlight pydoc cterm=reverse gui=reverse
function s:ShowPyDoc(name, type)
if a:name == ''
return
endif
if g:pydoc_open_cmd == 'split'
let l:pydoc_wh = 10
endif
if bufloaded("__doc__")
let l:buf_is_new = 0
if bufname("%") == "__doc__"
" The current buffer is __doc__, thus do not
" recreate nor resize it
let l:pydoc_wh = -1
else
" If the __doc__ buffer is open, jump to it
silent execute "sbuffer" bufnr("__doc__")
let l:pydoc_wh = -1
endif
else
let l:buf_is_new = 1
silent execute g:pydoc_open_cmd '__doc__'
if g:pydoc_perform_mappings
call s:PerformMappings()
endif
endif
setlocal modifiable
setlocal noswapfile
setlocal buftype=nofile
setlocal bufhidden=delete
setlocal syntax=man
silent normal ggdG
" Remove function/method arguments
let s:name2 = substitute(a:name, '(.*', '', 'g' )
" Remove all colons
let s:name2 = substitute(s:name2, ':', '', 'g' )
if a:type == 1
execute "silent read !" g:pydoc_cmd s:name2
else
execute "silent read !" g:pydoc_cmd "-k" s:name2
endif
normal 1G
if exists('l:pydoc_wh') && l:pydoc_wh != -1
execute "silent resize" l:pydoc_wh
end
if g:pydoc_highlight == 1
execute 'syntax match pydoc' "'" . s:name2 . "'"
endif
let l:line = getline(2)
if l:line =~ "^no Python documentation found for.*$"
if l:buf_is_new
execute "bdelete!"
else
normal u
setlocal nomodified
setlocal nomodifiable
endif
redraw
echohl WarningMsg | echo l:line | echohl None
else
setlocal nomodified
setlocal nomodifiable
endif
endfunction
" Mappings
function s:PerformMappings()
nnoremap <silent> <buffer> <Leader>pw :call <SID>ShowPyDoc('<C-R><C-W>', 1)<CR>
nnoremap <silent> <buffer> <Leader>pW :call <SID>ShowPyDoc('<C-R><C-A>', 1)<CR>
nnoremap <silent> <buffer> <Leader>pk :call <SID>ShowPyDoc('<C-R><C-W>', 0)<CR>
nnoremap <silent> <buffer> <Leader>pK :call <SID>ShowPyDoc('<C-R><C-A>', 0)<CR>
" remap the K (or 'help') key
nnoremap <silent> <buffer> K :call <SID>ShowPyDoc(expand("<cword>"), 1)<CR>
endfunction
if g:pydoc_perform_mappings
call s:PerformMappings()
endif
" Commands
command -nargs=1 Pydoc :call s:ShowPyDoc('<args>', 1)
command -nargs=* PydocSearch :call s:ShowPyDoc('<args>', 0)

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,9 @@
"
" BZR extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -44,7 +43,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
" BZR is not installed
@ -64,7 +65,7 @@ let s:bzrFunctions = {}
" Returns the executable used to invoke bzr suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
return VCSCommandGetOption('VCSCommandBZRExec', 'bzr')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
@ -84,7 +85,13 @@ endfunction
" Function: s:bzrFunctions.Identify(buffer) {{{2
function! s:bzrFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
let l:save_bzr_log=$BZR_LOG
try
let $BZR_LOG=has("win32") || has("win95") || has("win64") || has("win16") ? "nul" : "/dev/null"
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
finally
let $BZR_LOG=l:save_bzr_log
endtry
if(v:shell_error)
return 0
else
@ -100,7 +107,7 @@ endfunction
" Function: s:bzrFunctions.Annotate(argList) {{{2
function! s:bzrFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'BZRAnnotate'
if &filetype ==? 'bzrannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -118,8 +125,7 @@ function! s:bzrFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=BZRAnnotate
normal! 1G2dd
endif
return resultBuffer
endfunction
@ -151,13 +157,7 @@ function! s:bzrFunctions.Diff(argList)
let revOptions = a:argList
endif
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:bzrFunctions.GetBufferInfo() {{{2
@ -234,17 +234,13 @@ function! s:bzrFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:bzrFunctions.Status(argList) {{{2
function! s:bzrFunctions.Status(argList)
let options = ['-S']
if len(a:argList) == 0
if len(a:argList) != 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@ -5,7 +5,7 @@
"
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2008 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -204,6 +204,10 @@
" This variable, if set to a non-zero value, prevents the default command
" mappings from being set for commands specific to an individual VCS.
"
" VCSCommandDisableMenu
" This variable, if set to a non-zero value, prevents the default command
" menu from being set.
"
" VCSCommandEdit
" This variable controls whether to split the current window to display a
" scratch buffer ('split'), or to display it in the current buffer ('edit').
@ -226,6 +230,12 @@
" This allows customization of the mapping space used by the vcscommand
" shortcuts.
"
" VCSCommandMenuPriority
" This variable, if set, overrides the default menu priority '' (empty)
"
" VCSCommandMenuRoot
" This variable, if set, overrides the default menu root 'Plugin.VCS'
"
" VCSCommandResultBufferNameExtension
" This variable, if set to a non-blank value, is appended to the name of the
" VCS command output buffers. For example, '.vcs'. Using this option may
@ -262,6 +272,13 @@
" full file name of a given buffer. If it matches, the second element will
" be used as the VCS type.
"
" VCSCommandVCSTypePreference
" This variable allows the VCS type detection to be weighted towards a
" specific VCS, in case more than one potential VCS is detected as useable.
" The format of the variable is either a list or a space-separated string
" containing the ordered-by-preference abbreviations of the preferred VCS
" types.
"
" Event documentation {{{2
" For additional customization, VCSCommand.vim uses User event autocommand
" hooks. Each event is in the VCSCommand group, and different patterns
@ -340,21 +357,12 @@ let s:VCSCommandUtility = {}
" plugin-specific information: {vcs -> [script, {command -> function}, {key -> mapping}]}
let s:plugins = {}
" temporary values of overridden configuration variables
let s:optionOverrides = {}
" Stack of dictionaries representing nested options
let s:executionContext = []
" state flag used to vary behavior of certain automated actions
let s:isEditFileRunning = 0
" commands needed to restore diff buffers to their original state
unlet! s:vimDiffRestoreCmd
" original buffer currently reflected in vimdiff windows
unlet! s:vimDiffSourceBuffer
"
unlet! s:vimDiffScratchList
" Section: Utility functions {{{1
" Function: s:ReportError(mapping) {{{2
@ -365,7 +373,7 @@ function! s:ReportError(error)
echohl WarningMsg|echomsg 'VCSCommand: ' . a:error|echohl None
endfunction
" Function s:VCSCommandUtility.system(...) {{{2
" Function: s:VCSCommandUtility.system(...) {{{2
" Replacement for system() function. This version protects the quoting in the
" command line on Windows systems.
@ -375,12 +383,58 @@ function! s:VCSCommandUtility.system(...)
set sxq=\"
endif
try
return call('system', a:000)
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
return output
endfunction
" Function: s:VCSCommandUtility.addMenuItem(shortcut, command) {{{2
" Adds the given menu item.
function! s:VCSCommandUtility.addMenuItem(shortcut, command)
if s:menuEnabled
exe 'amenu <silent> '.s:menuPriority.' '.s:menuRoot.'.'.a:shortcut.' '.a:command
endif
endfunction
" Function: s:VCSCommandUtility.pushContext(context) {{{2
" Adds a dictionary containing current options to the stack.
function! s:VCSCommandUtility.pushContext(context)
call insert(s:executionContext, a:context)
endfunction
" Function: s:VCSCommandUtility.popContext() {{{2
" Removes a dictionary containing current options from the stack.
function! s:VCSCommandUtility.popContext()
call remove(s:executionContext, 0)
endfunction
" Function: s:ClearMenu() {{{2
" Removes all VCSCommand menu items
function! s:ClearMenu()
if s:menuEnabled
execute 'aunmenu' s:menuRoot
endif
endfunction
" Function: s:CreateMapping(shortcut, expansion, display) {{{2
@ -416,7 +470,7 @@ function! s:ExecuteExtensionMapping(mapping)
if !has_key(s:plugins[vcsType][2], a:mapping)
throw 'This extended mapping is not defined for ' . vcsType
endif
silent execute 'normal' ':' . s:plugins[vcsType][2][a:mapping] . "\<CR>"
silent execute 'normal!' ':' . s:plugins[vcsType][2][a:mapping] . "\<CR>"
endfunction
" Function: s:ExecuteVCSCommand(command, argList) {{{2
@ -469,7 +523,7 @@ function! s:GenerateResultBufferName(command, originalBuffer, vcsType, statusTex
let bufferName .= ' ' . fileName
let counter = 0
let versionedBufferName = bufferName
while buflisted(versionedBufferName)
while bufexists(versionedBufferName)
let counter += 1
let versionedBufferName = bufferName . ' (' . counter . ')'
endwhile
@ -489,7 +543,7 @@ function! s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsTy
let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs')
let counter = 0
let versionedBufferName = bufferName
while buflisted(versionedBufferName)
while bufexists(versionedBufferName)
let counter += 1
let versionedBufferName = '(' . counter . ') ' . bufferName
endwhile
@ -524,6 +578,64 @@ function! s:EditFile(command, originalBuffer, statusText)
endtry
endfunction
" Function: s:IdentifyVCSType() {{{2
" This function implements the non-cached identification strategy for
" VcsCommandGetVCSType().
"
" Returns: VCS type name identified for the given buffer; an exception is
" thrown in case no type can be identified.
function! s:IdentifyVCSType(buffer)
if exists("g:VCSCommandVCSTypeOverride")
let fullpath = fnamemodify(bufname(a:buffer), ':p')
for [path, vcsType] in g:VCSCommandVCSTypeOverride
if match(fullpath, path) > -1
return vcsType
endif
endfor
endif
let matches = []
let exactMatch = ''
let exactMatchCount = 0
for vcsType in keys(s:plugins)
let identified = s:plugins[vcsType][1].Identify(a:buffer)
if identified
if identified == g:VCSCOMMAND_IDENTIFY_EXACT
let exactMatch = vcsType
let exactMatchCount += 1
endif
call add(matches, [vcsType, identified])
endif
endfor
if len(matches) == 1
return matches[0][0]
elseif len(matches) == 0
throw 'No suitable plugin'
else
let preferences = VCSCommandGetOption("VCSCommandVCSTypePreference", [])
if len(preferences) > 0
if type(preferences) == 1
let listPreferences = split(preferences, '\W\+')
unlet preferences
let preferences = listPreferences
endif
for preferred in preferences
for [vcsType, identified] in matches
if vcsType ==? preferred
return vcsType
endif
endfor
endfor
endif
if exactMatchCount == 1
return exactMatch
endif
throw 'can''t identify VCS type for current buffer due to too many matching VCS: ' . join(map(matches, 'v:val[0]'))
endif
endfunction
" Function: s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText) {{{2
" Creates convenience buffer variables and the name of a vcscommand result
" buffer.
@ -548,7 +660,7 @@ function! s:SetupScratchBuffer(command, vcsType, originalBuffer, statusText)
setlocal buftype=nofile
setlocal noswapfile
let &filetype = a:vcsType . a:command
let &filetype = tolower(a:vcsType . a:command)
if VCSCommandGetOption('VCSCommandDeleteOnHide', 0)
setlocal bufhidden=delete
@ -604,21 +716,6 @@ function! s:MarkOrigBufferForSetup(buffer)
return a:buffer
endfunction
" Function: s:OverrideOption(option, [value]) {{{2
" Provides a temporary override for the given VCS option. If no value is
" passed, the override is disabled.
function! s:OverrideOption(option, ...)
if a:0 == 0
call remove(s:optionOverrides[a:option], -1)
else
if !has_key(s:optionOverrides, a:option)
let s:optionOverrides[a:option] = []
endif
call add(s:optionOverrides[a:option], a:1)
endif
endfunction
" Function: s:WipeoutCommandBuffers() {{{2
" Clears all current VCS output buffers of the specified type for a given source.
@ -642,30 +739,30 @@ endfunction
function! s:VimDiffRestore(vimDiffBuff)
let s:isEditFileRunning += 1
try
if exists('s:vimDiffSourceBuffer')
if a:vimDiffBuff == s:vimDiffSourceBuffer
if exists('t:vcsCommandVimDiffSourceBuffer')
if a:vimDiffBuff == t:vcsCommandVimDiffSourceBuffer
" Original file is being removed.
unlet! s:vimDiffSourceBuffer
unlet! s:vimDiffRestoreCmd
unlet! s:vimDiffScratchList
unlet! t:vcsCommandVimDiffSourceBuffer
unlet! t:vcsCommandVimDiffRestoreCmd
unlet! t:vcsCommandVimDiffScratchList
else
let index = index(s:vimDiffScratchList, a:vimDiffBuff)
let index = index(t:vcsCommandVimDiffScratchList, a:vimDiffBuff)
if index >= 0
call remove(s:vimDiffScratchList, index)
if len(s:vimDiffScratchList) == 0
if exists('s:vimDiffRestoreCmd')
call remove(t:vcsCommandVimDiffScratchList, index)
if len(t:vcsCommandVimDiffScratchList) == 0
if exists('t:vcsCommandVimDiffRestoreCmd')
" All scratch buffers are gone, reset the original.
" Only restore if the source buffer is still in Diff mode
let sourceWinNR = bufwinnr(s:vimDiffSourceBuffer)
let sourceWinNR = bufwinnr(t:vcsCommandVimDiffSourceBuffer)
if sourceWinNR != -1
" The buffer is visible in at least one window
let currentWinNR = winnr()
while winbufnr(sourceWinNR) != -1
if winbufnr(sourceWinNR) == s:vimDiffSourceBuffer
if winbufnr(sourceWinNR) == t:vcsCommandVimDiffSourceBuffer
execute sourceWinNR . 'wincmd w'
if getwinvar(0, '&diff')
execute s:vimDiffRestoreCmd
execute t:vcsCommandVimDiffRestoreCmd
endif
endif
let sourceWinNR = sourceWinNR + 1
@ -675,18 +772,18 @@ function! s:VimDiffRestore(vimDiffBuff)
" The buffer is hidden. It must be visible in order to set the
" diff option.
let currentBufNR = bufnr('')
execute 'hide buffer' s:vimDiffSourceBuffer
execute 'hide buffer' t:vcsCommandVimDiffSourceBuffer
if getwinvar(0, '&diff')
execute s:vimDiffRestoreCmd
execute t:vcsCommandVimDiffRestoreCmd
endif
execute 'hide buffer' currentBufNR
endif
unlet s:vimDiffRestoreCmd
unlet t:vcsCommandVimDiffRestoreCmd
endif
" All buffers are gone.
unlet s:vimDiffSourceBuffer
unlet s:vimDiffScratchList
unlet t:vcsCommandVimDiffSourceBuffer
unlet t:vcsCommandVimDiffScratchList
endif
endif
endif
@ -700,7 +797,12 @@ endfunction
" Function: s:VCSAnnotate(...) {{{2
function! s:VCSAnnotate(bang, ...)
call s:VCSCommandUtility.pushContext({'VCSCommandEncodeAsFile': bufnr('%')})
try
let line = line('.')
let currentBuffer = bufnr('%')
let originalBuffer = VCSCommandGetOriginalBuffer(currentBuffer)
let annotateBuffer = s:ExecuteVCSCommand('Annotate', a:000)
if annotateBuffer == -1
return -1
@ -716,22 +818,50 @@ function! s:VCSAnnotate(bang, ...)
if splitRegex == ''
return annotateBuffer
endif
let originalBuffer = VCSCommandGetOriginalBuffer(annotateBuffer)
wincmd J
let originalFileType = getbufvar(originalBuffer, '&ft')
let annotateFileType = getbufvar(annotateBuffer, '&ft')
execute "normal 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
let saveselection = &selection
set selection=inclusive
try
execute "normal! 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
finally
let &selection = saveselection
endtry
call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype'))
set scrollbind
leftabove vert new
normal 0P
execute "normal" . col('$') . "\<c-w>|"
normal! 0P
execute "normal!" . (col('$') + (&number ? &numberwidth : 0)). "\<c-w>|"
call s:SetupScratchBuffer('annotate', vcsType, originalBuffer, 'header')
wincmd l
endif
if currentBuffer == originalBuffer
" Starting from the original source buffer, so the
" current line is relevant.
if a:0 == 0
" No argument list means that we're annotating
" the current version, so jumping to the same
" line is the expected action.
execute "normal!" line . 'G'
if has('folding')
" The execution of the buffer created autocommand
" re-folds the buffer. Display the current line
" unfolded.
normal! zv
endif
endif
endif
return annotateBuffer
catch
call s:ReportError(v:exception)
return -1
finally
call s:VCSCommandUtility.popContext()
endtry
endfunction
@ -773,6 +903,7 @@ function! s:VCSCommit(bang, message)
silent put ='VCS: ----------------------------------------------------------------------'
$
setlocal nomodified
silent do VCSCommand User VCSBufferCreated
catch
call s:ReportError(v:exception)
return -1
@ -797,22 +928,21 @@ endfunction
" Function: s:VCSFinishCommit(logMessageList, originalBuffer) {{{2
function! s:VCSFinishCommit(logMessageList, originalBuffer)
let shellSlashBak = &shellslash
let messageFileName = tempname()
if exists('*iconv') && has('multi_byte')
if(strlen(&tenc) && &tenc != &enc)
call map(a:logMessageList, 'iconv(v:val, &enc, &tenc)')
endif
endif
call writefile(a:logMessageList, messageFileName)
try
set shellslash
let messageFileName = tempname()
call writefile(a:logMessageList, messageFileName)
try
let resultBuffer = s:ExecuteVCSCommand('Commit', [messageFileName])
if resultBuffer < 0
return resultBuffer
endif
return s:MarkOrigBufferForSetup(resultBuffer)
finally
call delete(messageFileName)
endtry
let resultBuffer = s:ExecuteVCSCommand('Commit', [messageFileName])
if resultBuffer < 0
return resultBuffer
endif
return s:MarkOrigBufferForSetup(resultBuffer)
finally
let &shellslash = shellSlashBak
call delete(messageFileName)
endtry
endfunction
@ -839,6 +969,34 @@ function! s:VCSGotoOriginal(bang)
endif
endfunction
function! s:VCSDiff(...) "{{{2
call s:VCSCommandUtility.pushContext({'VCSCommandEncodeAsFile': bufnr('%')})
try
let resultBuffer = s:ExecuteVCSCommand('Diff', a:000)
if resultBuffer > 0
let &filetype = 'diff'
elseif resultBuffer == 0
echomsg 'No differences found'
endif
return resultBuffer
finally
call s:VCSCommandUtility.popContext()
endtry
endfunction
function! s:VCSReview(...) "{{{2
call s:VCSCommandUtility.pushContext({'VCSCommandEncodeAsFile': bufnr('%')})
try
let resultBuffer = s:ExecuteVCSCommand('Review', a:000)
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
finally
call s:VCSCommandUtility.popContext()
endtry
endfunction
" Function: s:VCSVimDiff(...) {{{2
function! s:VCSVimDiff(...)
try
@ -852,9 +1010,9 @@ function! s:VCSVimDiff(...)
" If there's already a VimDiff'ed window, restore it.
" There may only be one VCSVimDiff original window at a time.
if exists('s:vimDiffSourceBuffer') && s:vimDiffSourceBuffer != originalBuffer
if exists('t:vcsCommandVimDiffSourceBuffer') && t:vcsCommandVimDiffSourceBuffer != originalBuffer
" Clear the existing vimdiff setup by removing the result buffers.
call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
call s:WipeoutCommandBuffers(t:vcsCommandVimDiffSourceBuffer, 'vimdiff')
endif
let orientation = &diffopt =~ 'horizontal' ? 'horizontal' : 'vertical'
@ -864,23 +1022,23 @@ function! s:VCSVimDiff(...)
" Split and diff
if(a:0 == 2)
" Reset the vimdiff system, as 2 explicit versions were provided.
if exists('s:vimDiffSourceBuffer')
call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
if exists('t:vcsCommandVimDiffSourceBuffer')
call s:WipeoutCommandBuffers(t:vcsCommandVimDiffSourceBuffer, 'vimdiff')
endif
let resultBuffer = s:plugins[vcsType][1].Review([a:1])
let resultBuffer = s:VCSReview(a:1)
if resultBuffer < 0
echomsg 'Can''t open revision ' . a:1
return resultBuffer
endif
let b:VCSCommandCommand = 'vimdiff'
diffthis
let s:vimDiffScratchList = [resultBuffer]
let t:vcsCommandVimDiffScratchList = [resultBuffer]
" If no split method is defined, cheat, and set it to vertical.
call s:VCSCommandUtility.pushContext({'VCSCommandSplit': orientation})
try
call s:OverrideOption('VCSCommandSplit', orientation)
let resultBuffer = s:plugins[vcsType][1].Review([a:2])
let resultBuffer = s:VCSReview(a:2)
finally
call s:OverrideOption('VCSCommandSplit')
call s:VCSCommandUtility.popContext()
endtry
if resultBuffer < 0
echomsg 'Can''t open revision ' . a:1
@ -888,24 +1046,18 @@ function! s:VCSVimDiff(...)
endif
let b:VCSCommandCommand = 'vimdiff'
diffthis
let s:vimDiffScratchList += [resultBuffer]
let t:vcsCommandVimDiffScratchList += [resultBuffer]
else
" Add new buffer
call s:OverrideOption('VCSCommandEdit', 'split')
" Add new buffer. Force splitting behavior, otherwise why use vimdiff?
call s:VCSCommandUtility.pushContext({'VCSCommandEdit': 'split', 'VCSCommandSplit': orientation})
try
" Force splitting behavior, otherwise why use vimdiff?
call s:OverrideOption('VCSCommandSplit', orientation)
try
if(a:0 == 0)
let resultBuffer = s:plugins[vcsType][1].Review([])
else
let resultBuffer = s:plugins[vcsType][1].Review([a:1])
endif
finally
call s:OverrideOption('VCSCommandSplit')
endtry
if(a:0 == 0)
let resultBuffer = s:VCSReview()
else
let resultBuffer = s:VCSReview(a:1)
endif
finally
call s:OverrideOption('VCSCommandEdit')
call s:VCSCommandUtility.popContext()
endtry
if resultBuffer < 0
echomsg 'Can''t open current revision'
@ -914,16 +1066,16 @@ function! s:VCSVimDiff(...)
let b:VCSCommandCommand = 'vimdiff'
diffthis
if !exists('s:vimDiffSourceBuffer')
if !exists('t:vcsCommandVimDiffSourceBuffer')
" New instance of vimdiff.
let s:vimDiffScratchList = [resultBuffer]
let t:vcsCommandVimDiffScratchList = [resultBuffer]
" This could have been invoked on a VCS result buffer, not the
" original buffer.
wincmd W
execute 'buffer' originalBuffer
" Store info for later original buffer restore
let s:vimDiffRestoreCmd =
let t:vcsCommandVimDiffRestoreCmd =
\ 'call setbufvar('.originalBuffer.', ''&diff'', '.getbufvar(originalBuffer, '&diff').')'
\ . '|call setbufvar('.originalBuffer.', ''&foldcolumn'', '.getbufvar(originalBuffer, '&foldcolumn').')'
\ . '|call setbufvar('.originalBuffer.', ''&foldenable'', '.getbufvar(originalBuffer, '&foldenable').')'
@ -931,16 +1083,19 @@ function! s:VCSVimDiff(...)
\ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
\ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
\ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
\ . '|if &foldmethod==''manual''|execute ''normal zE''|endif'
if has('cursorbind')
let t:vcsCommandVimDiffRestoreCmd .= '|call setbufvar('.originalBuffer.', ''&cursorbind'', '.getbufvar(originalBuffer, '&cursorbind').')'
endif
let t:vcsCommandVimDiffRestoreCmd .= '|if &foldmethod==''manual''|execute ''normal! zE''|endif'
diffthis
wincmd w
else
" Adding a window to an existing vimdiff
let s:vimDiffScratchList += [resultBuffer]
let t:vcsCommandVimDiffScratchList += [resultBuffer]
endif
endif
let s:vimDiffSourceBuffer = originalBuffer
let t:vcsCommandVimDiffSourceBuffer = originalBuffer
" Avoid executing the modeline in the current buffer after the autocommand.
@ -965,49 +1120,31 @@ endfunction
" Section: Public functions {{{1
" Function: VCSCommandGetVCSType() {{{2
" Sets the b:VCSCommandVCSType variable in the given buffer to the
" appropriate source control system name.
" This function sets the b:VCSCommandVCSType variable in the given buffer to the
" appropriate source control system name and returns the same name.
"
" This uses the Identify extension function to test the buffer. If the
" Identify function returns VCSCOMMAND_IDENTIFY_EXACT, the match is considered
" exact. If the Identify function returns VCSCOMMAND_IDENTIFY_INEXACT, the
" match is considered inexact, and is only applied if no exact match is found.
" Multiple inexact matches is currently considered an error.
" Returns: VCS type name identified for the given buffer. An exception is
" thrown if no type can be identified.
"
" Rules for determining type:
" 1. use previously-cached value
" 2. use value from 'VCSCommandVCSTypeOverride'
" 3. use single match
" 4. use first matching value from 'VCSCommandTypePreference'
" 5. use single exact match
" 6. error if multiple matching types
" 7. error if no matching types
function! VCSCommandGetVCSType(buffer)
let vcsType = getbufvar(a:buffer, 'VCSCommandVCSType')
if strlen(vcsType) > 0
return vcsType
endif
if exists("g:VCSCommandVCSTypeOverride")
let fullpath = fnamemodify(bufname(a:buffer), ':p')
for [path, vcsType] in g:VCSCommandVCSTypeOverride
if match(fullpath, path) > -1
call setbufvar(a:buffer, 'VCSCommandVCSType', vcsType)
return vcsType
endif
endfor
endif
let matches = []
for vcsType in keys(s:plugins)
let identified = s:plugins[vcsType][1].Identify(a:buffer)
if identified
if identified == g:VCSCOMMAND_IDENTIFY_EXACT
let matches = [vcsType]
break
else
let matches += [vcsType]
endif
let vcsType = VCSCommandGetOption('VCSCommandVCSTypeExplicitOverride', '')
if len(vcsType) == 0
let vcsType = getbufvar(a:buffer, 'VCSCommandVCSType')
if strlen(vcsType) == 0
let vcsType = s:IdentifyVCSType(a:buffer)
call setbufvar(a:buffer, 'VCSCommandVCSType', vcsType)
endif
endfor
if len(matches) == 1
call setbufvar(a:buffer, 'VCSCommandVCSType', matches[0])
return matches[0]
elseif len(matches) == 0
throw 'No suitable plugin'
else
throw 'Too many matching VCS: ' . join(matches)
endif
return vcsType
endfunction
" Function: VCSCommandChdir(directory) {{{2
@ -1018,7 +1155,11 @@ function! VCSCommandChdir(directory)
if exists("*haslocaldir") && haslocaldir()
let command = 'lcd'
endif
execute command escape(a:directory, ' ')
if exists("*fnameescape")
execute command fnameescape(a:directory)
else
execute command escape(a:directory, ' ')
endif
endfunction
" Function: VCSCommandChangeToCurrentFileDir() {{{2
@ -1058,6 +1199,7 @@ endfunction
function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap]
if !empty(a:mappingMap)
\ && !exists("g:no_plugin_maps")
\ && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
\ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0)
for shortcut in keys(a:mappingMap)
@ -1105,7 +1247,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
if match(a:cmd, '<VCSCOMMANDFILE>') > 0
let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
else
let fullCmd = a:cmd . ' -- "' . fileName . '"'
let fullCmd = a:cmd . ' -- ' . shellescape(fileName)
endif
" Change to the directory of the current buffer. This is done for CVS, but
@ -1152,7 +1294,7 @@ function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
" within a fold, but I prefer to simply unfold the result buffer altogether.
if has('folding')
normal zR
normal! zR
endif
$d
@ -1169,9 +1311,12 @@ endfunction
" searched in the window, buffer, then global spaces.
function! VCSCommandGetOption(name, default)
if has_key(s:optionOverrides, a:name) && len(s:optionOverrides[a:name]) > 0
return s:optionOverrides[a:name][-1]
elseif exists('w:' . a:name)
for context in s:executionContext
if has_key(context, a:name)
return context[a:name]
endif
endfor
if exists('w:' . a:name)
return w:{a:name}
elseif exists('b:' . a:name)
return b:{a:name}
@ -1229,6 +1374,14 @@ function! VCSCommandGetStatusLine()
endif
endfunction
function! VCSCommandSetVCSType(type)
if exists('b:VCSCommandBufferSetup')
unlet b:VCSCommandBufferSetup
endif
let b:VCSCommandVCSType = a:type
call s:SetupBuffer()
endfunction
" Section: Command definitions {{{1
" Section: Primary commands {{{2
com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', [<f-args>]))
@ -1236,14 +1389,14 @@ com! -nargs=* -bang VCSAnnotate call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=* -bang VCSBlame call s:VCSAnnotate(<q-bang>, <f-args>)
com! -nargs=? -bang VCSCommit call s:VCSCommit(<q-bang>, <q-args>)
com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', [<f-args>])
com! -nargs=* VCSDiff call s:ExecuteVCSCommand('Diff', [<f-args>])
com! -nargs=* VCSDiff call s:VCSDiff(<f-args>)
com! -nargs=0 -bang VCSGotoOriginal call s:VCSGotoOriginal(<q-bang>)
com! -nargs=* VCSInfo call s:ExecuteVCSCommand('Info', [<f-args>])
com! -nargs=* VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', [<f-args>]))
com! -nargs=* VCSLog call s:ExecuteVCSCommand('Log', [<f-args>])
com! -nargs=* VCSRemove call s:ExecuteVCSCommand('Delete', [<f-args>])
com! -nargs=0 VCSRevert call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Revert', []))
com! -nargs=? VCSReview call s:ExecuteVCSCommand('Review', [<f-args>])
com! -nargs=? VCSReview call s:VCSReview(<f-args>)
com! -nargs=* VCSStatus call s:ExecuteVCSCommand('Status', [<f-args>])
com! -nargs=* VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', [<f-args>]))
com! -nargs=0 VCSUpdate call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Update', []))
@ -1254,26 +1407,28 @@ com! VCSCommandDisableBufferSetup call VCSCommandDisableBufferSetup()
com! VCSCommandEnableBufferSetup call VCSCommandEnableBufferSetup()
" Allow reloading VCSCommand.vim
com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|aunmenu Plugin.VCS|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins
com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|call s:ClearMenu()|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins
" Section: Plugin command mappings {{{1
nnoremap <silent> <Plug>VCSAdd :VCSAdd<CR>
nnoremap <silent> <Plug>VCSAnnotate :VCSAnnotate<CR>
nnoremap <silent> <Plug>VCSCommit :VCSCommit<CR>
nnoremap <silent> <Plug>VCSDelete :VCSDelete<CR>
nnoremap <silent> <Plug>VCSDiff :VCSDiff<CR>
nnoremap <silent> <Plug>VCSGotoOriginal :VCSGotoOriginal<CR>
nnoremap <silent> <Plug>VCSClearAndGotoOriginal :VCSGotoOriginal!<CR>
nnoremap <silent> <Plug>VCSInfo :VCSInfo<CR>
nnoremap <silent> <Plug>VCSLock :VCSLock<CR>
nnoremap <silent> <Plug>VCSLog :VCSLog<CR>
nnoremap <silent> <Plug>VCSRevert :VCSRevert<CR>
nnoremap <silent> <Plug>VCSReview :VCSReview<CR>
nnoremap <silent> <Plug>VCSSplitAnnotate :VCSAnnotate!<CR>
nnoremap <silent> <Plug>VCSStatus :VCSStatus<CR>
nnoremap <silent> <Plug>VCSUnlock :VCSUnlock<CR>
nnoremap <silent> <Plug>VCSUpdate :VCSUpdate<CR>
nnoremap <silent> <Plug>VCSVimDiff :VCSVimDiff<CR>
if !exists("no_plugin_maps")
nnoremap <silent> <Plug>VCSAdd :VCSAdd<CR>
nnoremap <silent> <Plug>VCSAnnotate :VCSAnnotate<CR>
nnoremap <silent> <Plug>VCSCommit :VCSCommit<CR>
nnoremap <silent> <Plug>VCSDelete :VCSDelete<CR>
nnoremap <silent> <Plug>VCSDiff :VCSDiff<CR>
nnoremap <silent> <Plug>VCSGotoOriginal :VCSGotoOriginal<CR>
nnoremap <silent> <Plug>VCSClearAndGotoOriginal :VCSGotoOriginal!<CR>
nnoremap <silent> <Plug>VCSInfo :VCSInfo<CR>
nnoremap <silent> <Plug>VCSLock :VCSLock<CR>
nnoremap <silent> <Plug>VCSLog :VCSLog<CR>
nnoremap <silent> <Plug>VCSRevert :VCSRevert<CR>
nnoremap <silent> <Plug>VCSReview :VCSReview<CR>
nnoremap <silent> <Plug>VCSSplitAnnotate :VCSAnnotate!<CR>
nnoremap <silent> <Plug>VCSStatus :VCSStatus<CR>
nnoremap <silent> <Plug>VCSUnlock :VCSUnlock<CR>
nnoremap <silent> <Plug>VCSUpdate :VCSUpdate<CR>
nnoremap <silent> <Plug>VCSVimDiff :VCSVimDiff<CR>
endif
" Section: Default mappings {{{1
@ -1297,25 +1452,37 @@ let s:defaultMappings = [
\['v', 'VCSVimDiff'],
\]
if !VCSCommandGetOption('VCSCommandDisableMappings', 0)
for [shortcut, vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings)
call s:CreateMapping(shortcut, '<Plug>' . vcsFunction, '''' . vcsFunction . '''')
if !exists("g:no_plugin_maps") && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
for [s:shortcut, s:vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings)
call s:CreateMapping(s:shortcut, '<Plug>' . s:vcsFunction, '''' . s:vcsFunction . '''')
endfor
unlet s:shortcut s:vcsFunction
endif
unlet s:defaultMappings
" Section: Menu items {{{1
amenu <silent> &Plugin.VCS.&Add <Plug>VCSAdd
amenu <silent> &Plugin.VCS.A&nnotate <Plug>VCSAnnotate
amenu <silent> &Plugin.VCS.&Commit <Plug>VCSCommit
amenu <silent> &Plugin.VCS.Delete <Plug>VCSDelete
amenu <silent> &Plugin.VCS.&Diff <Plug>VCSDiff
amenu <silent> &Plugin.VCS.&Info <Plug>VCSInfo
amenu <silent> &Plugin.VCS.&Log <Plug>VCSLog
amenu <silent> &Plugin.VCS.Revert <Plug>VCSRevert
amenu <silent> &Plugin.VCS.&Review <Plug>VCSReview
amenu <silent> &Plugin.VCS.&Status <Plug>VCSStatus
amenu <silent> &Plugin.VCS.&Update <Plug>VCSUpdate
amenu <silent> &Plugin.VCS.&VimDiff <Plug>VCSVimDiff
let s:menuEnabled = !VCSCommandGetOption('VCSCommandDisableMenu', 0)
let s:menuRoot = VCSCommandGetOption('VCSCommandMenuRoot', '&Plugin.VCS')
let s:menuPriority = VCSCommandGetOption('VCSCommandMenuPriority', '')
for [s:shortcut, s:command] in [
\['&Add', '<Plug>VCSAdd'],
\['A&nnotate', '<Plug>VCSAnnotate'],
\['&Commit', '<Plug>VCSCommit'],
\['Delete', '<Plug>VCSDelete'],
\['&Diff', '<Plug>VCSDiff'],
\['&Info', '<Plug>VCSInfo'],
\['&Log', '<Plug>VCSLog'],
\['Revert', '<Plug>VCSRevert'],
\['&Review', '<Plug>VCSReview'],
\['&Status', '<Plug>VCSStatus'],
\['&Update', '<Plug>VCSUpdate'],
\['&VimDiff', '<Plug>VCSVimDiff']
\]
call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command)
endfor
unlet s:shortcut s:command
" Section: Autocommands to restore vimdiff state {{{1
augroup VimDiffRestore

View File

@ -2,10 +2,9 @@
"
" CVS extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -90,7 +89,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
" CVS is not installed
@ -110,7 +111,7 @@ let s:cvsFunctions = {}
" Returns the executable used to invoke cvs suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
return VCSCommandGetOption('VCSCommandCVSExec', 'cvs')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -181,7 +182,7 @@ endfunction
" Function: s:cvsFunctions.Annotate(argList) {{{2
function! s:cvsFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'CVSAnnotate'
if &filetype ==? 'cvsannotate'
" This is a CVSAnnotate buffer. Perform annotation of the version
" indicated by the current line.
let caption = matchstr(getline('.'),'\v^[0-9.]+')
@ -216,7 +217,6 @@ function! s:cvsFunctions.Annotate(argList)
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
if resultBuffer > 0
set filetype=CVSAnnotate
" Remove header lines from standard error
silent v/^\d\+\%(\.\d\+\)\+/d
endif
@ -266,13 +266,7 @@ function! s:cvsFunctions.Diff(argList)
let diffOptions = ['-' . cvsDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:cvsFunctions.GetBufferInfo() {{{2
@ -338,11 +332,7 @@ function! s:cvsFunctions.Log(argList)
let caption = join(a:argList, ' ')
endif
let resultBuffer=s:DoCommand(join(['log'] + options), 'log', caption, {})
if resultBuffer > 0
set filetype=rcslog
endif
return resultBuffer
return s:DoCommand(join(['log'] + options), 'log', caption, {})
endfunction
" Function: s:cvsFunctions.Revert(argList) {{{2
@ -360,11 +350,7 @@ function! s:cvsFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:cvsFunctions.Status(argList) {{{2
@ -426,35 +412,42 @@ com! CVSWatchers call s:CVSWatchers()
" Section: Plugin command mappings {{{1
let s:cvsExtensionMappings = {}
let mappingInfo = [
\['CVSEdit', 'CVSEdit', 'e'],
\['CVSEditors', 'CVSEditors', 'E'],
\['CVSUnedit', 'CVSUnedit', 't'],
\['CVSWatchers', 'CVSWatchers', 'wv'],
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
\['CVSWatchOff', 'CVSWatch off', 'wf'],
\['CVSWatchOn', 'CVSWatch on', 'wn'],
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
\]
if !exists("no_plugin_maps")
let mappingInfo = [
\['CVSEdit', 'CVSEdit', 'e'],
\['CVSEditors', 'CVSEditors', 'E'],
\['CVSUnedit', 'CVSUnedit', 't'],
\['CVSWatchers', 'CVSWatchers', 'wv'],
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
\['CVSWatchOff', 'CVSWatch off', 'wf'],
\['CVSWatchOn', 'CVSWatch on', 'wn'],
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
\]
for [pluginName, commandText, shortCut] in mappingInfo
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
if !hasmapto('<Plug>' . pluginName)
let s:cvsExtensionMappings[shortCut] = commandText
endif
endfor
" Section: Menu items {{{1
amenu <silent> &Plugin.VCS.CVS.&Edit <Plug>CVSEdit
amenu <silent> &Plugin.VCS.CVS.Ed&itors <Plug>CVSEditors
amenu <silent> &Plugin.VCS.CVS.Unedi&t <Plug>CVSUnedit
amenu <silent> &Plugin.VCS.CVS.&Watchers <Plug>CVSWatchers
amenu <silent> &Plugin.VCS.CVS.WatchAdd <Plug>CVSWatchAdd
amenu <silent> &Plugin.VCS.CVS.WatchOn <Plug>CVSWatchOn
amenu <silent> &Plugin.VCS.CVS.WatchOff <Plug>CVSWatchOff
amenu <silent> &Plugin.VCS.CVS.WatchRemove <Plug>CVSWatchRemove
for [pluginName, commandText, shortCut] in mappingInfo
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
if !hasmapto('<Plug>' . pluginName)
let s:cvsExtensionMappings[shortCut] = commandText
endif
endfor
endif
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
" Section: Menu items {{{1
for [s:shortcut, s:command] in [
\['CVS.&Edit', '<Plug>CVSEdit'],
\['CVS.Ed&itors', '<Plug>CVSEditors'],
\['CVS.Unedi&t', '<Plug>CVSUnedit'],
\['CVS.&Watchers', '<Plug>CVSWatchers'],
\['CVS.WatchAdd', '<Plug>CVSWatchAdd'],
\['CVS.WatchOn', '<Plug>CVSWatchOn'],
\['CVS.WatchOff', '<Plug>CVSWatchOff'],
\['CVS.WatchRemove', '<Plug>CVSWatchRemove']
\]
call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command)
endfor
unlet s:shortcut s:command
let &cpo = s:save_cpo

View File

@ -2,10 +2,9 @@
"
" git extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2008 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -49,7 +48,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
" git is not installed
@ -69,7 +70,7 @@ let s:gitFunctions = {}
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
return VCSCommandGetOption('VCSCommandGitExec', 'git')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -111,7 +112,7 @@ endfunction
" Function: s:gitFunctions.Annotate(argList) {{{2
function! s:gitFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'gitAnnotate'
if &filetype == 'gitannotate'
" Perform annotation of the version indicated by the current line.
let options = matchstr(getline('.'),'^\x\+')
else
@ -123,21 +124,16 @@ function! s:gitFunctions.Annotate(argList)
let options = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand('blame ' . options, 'annotate', options, {})
if resultBuffer > 0
normal 1G
set filetype=gitAnnotate
endif
return resultBuffer
return s:DoCommand('blame ' . options, 'annotate', options, {})
endfunction
" Function: s:gitFunctions.Commit(argList) {{{2
function! s:gitFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
try
return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
catch /\m^Version control command failed.*nothing\%( added\)\? to commit/
echomsg 'No commit needed.'
endif
return resultBuffer
endtry
endfunction
" Function: s:gitFunctions.Delete() {{{2
@ -165,13 +161,7 @@ function! s:gitFunctions.Diff(argList)
endfor
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
endfunction
" Function: s:gitFunctions.GetBufferInfo() {{{2
@ -212,11 +202,7 @@ endfunction
" Function: s:gitFunctions.Log() {{{2
function! s:gitFunctions.Log(argList)
let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
if resultBuffer > 0
set filetype=gitlog
endif
return resultBuffer
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
endfunction
" Function: s:gitFunctions.Revert(argList) {{{2
@ -241,11 +227,7 @@ function! s:gitFunctions.Review(argList)
let prefix = substitute(prefix, '\n$', '', '')
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('show ' . blob, 'review', revision, {})
endfunction
" Function: s:gitFunctions.Status(argList) {{{2

View File

@ -2,10 +2,9 @@
"
" Mercurial extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -51,7 +50,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
" HG is not installed
@ -71,7 +72,7 @@ let s:hgFunctions = {}
" Returns the executable used to invoke hg suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
return VCSCommandGetOption('VCSCommandHGExec', 'hg')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -105,16 +106,16 @@ endfunction
" Function: s:hgFunctions.Add() {{{2
function! s:hgFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
return s:DoCommand(join(['add -v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2
function! s:hgFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'HGAnnotate'
if &filetype ==? 'hgannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
let caption = matchstr(getline('.'),'\v^\s*\w+\s+\zs\d+')
let options = ' -un -r' . caption
else
let caption = ''
let options = ' -un'
@ -127,19 +128,16 @@ function! s:hgFunctions.Annotate(argList)
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
set filetype=HGAnnotate
endif
return resultBuffer
return s:DoCommand('blame' . options, 'annotate', caption, {})
endfunction
" Function: s:hgFunctions.Commit(argList) {{{2
function! s:hgFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -l "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
try
return s:DoCommand('commit -v -l "' . a:argList[0] . '"', 'commit', '', {})
catch /Version control command failed.*nothing changed/
echomsg 'No commit needed.'
endif
endtry
endfunction
" Function: s:hgFunctions.Delete() {{{2
@ -175,15 +173,7 @@ function! s:hgFunctions.Diff(argList)
let diffOptions = ['-x -' . hgDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if hgDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:hgFunctions.Info(argList) {{{2
@ -259,18 +249,13 @@ function! s:hgFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
" let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:hgFunctions.Status(argList) {{{2
function! s:hgFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
let options = ['-A', '-v']
if len(a:argList) != 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@ -2,10 +2,9 @@
"
" SVK extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -44,7 +43,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
" SVK is not installed
@ -64,7 +65,7 @@ let s:svkFunctions = {}
" Returns the executable used to invoke SVK suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
return VCSCommandGetOption('VCSCommandSVKExec', 'svk')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -105,7 +106,7 @@ endfunction
" Function: s:svkFunctions.Annotate(argList) {{{2
function! s:svkFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVKAnnotate'
if &filetype ==? 'svkannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -123,8 +124,7 @@ function! s:svkFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
set filetype=SVKAnnotate
normal! 1G2dd
endif
return resultBuffer
endfunction
@ -156,13 +156,7 @@ function! s:svkFunctions.Diff(argList)
let revOptions = a:argList
endif
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
echomsg 'No differences found'
endif
return resultBuffer
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
endfunction
" Function: s:svkFunctions.GetBufferInfo() {{{2
@ -238,17 +232,13 @@ function! s:svkFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svkFunctions.Status(argList) {{{2
function! s:svkFunctions.Status(argList)
let options = ['-v']
if len(a:argList) == 0
if len(a:argList) != 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})

View File

@ -2,10 +2,9 @@
"
" SVN extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
" Copyright (c) Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
@ -51,7 +50,9 @@ if v:version < 700
finish
endif
runtime plugin/vcscommand.vim
if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
" SVN is not installed
@ -71,7 +72,7 @@ let s:svnFunctions = {}
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
return VCSCommandGetOption('VCSCommandSVNExec', 'svn')
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
@ -90,22 +91,17 @@ endfunction
" Function: s:svnFunctions.Identify(buffer) {{{2
function! s:svnFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':h')
endif
if strlen(directoryName) > 0
let svnDir = directoryName . '/.svn'
else
let svnDir = '.svn'
endif
if isdirectory(svnDir)
return 1
else
return 0
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call s:VCSCommandUtility.system(s:Executable() . ' info .')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_EXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:svnFunctions.Add() {{{2
@ -116,7 +112,7 @@ endfunction
" Function: s:svnFunctions.Annotate(argList) {{{2
function! s:svnFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVNAnnotate'
if &filetype ==? 'svnannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
@ -132,11 +128,7 @@ function! s:svnFunctions.Annotate(argList)
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
if resultBuffer > 0
set filetype=SVNAnnotate
endif
return resultBuffer
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
endfunction
" Function: s:svnFunctions.Commit(argList) {{{2
@ -180,15 +172,7 @@ function! s:svnFunctions.Diff(argList)
let diffOptions = ['-x -' . svnDiffOpt]
endif
let resultBuffer = s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
if resultBuffer > 0
set filetype=diff
else
if svnDiffExt == ''
echomsg 'No differences found'
endif
endif
return resultBuffer
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:svnFunctions.GetBufferInfo() {{{2
@ -200,7 +184,7 @@ endfunction
function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"')
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -v -- "' . fileName . '"')
if(v:shell_error)
return []
endif
@ -210,12 +194,14 @@ function! s:svnFunctions.GetBufferInfo()
return ['Unknown']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
elseif flags =~ '*'
return [revision, repository, '*']
else
return [revision, repository]
endif
@ -264,17 +250,13 @@ function! s:svnFunctions.Review(argList)
let versionOption = ' -r ' . versiontag . ' '
endif
let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
if resultBuffer > 0
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
endif
return resultBuffer
return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svnFunctions.Status(argList) {{{2
function! s:svnFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
if len(a:argList) != 0
let options = a:argList
endif
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})