1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Updated buffergator and vcscommand plugins

This commit is contained in:
2011-10-23 10:49:02 +02:00
parent 62aa951be8
commit 52a8266c56
10 changed files with 179 additions and 105 deletions

View File

@@ -1,7 +1,7 @@
ScriptID SourceID Filename ScriptID SourceID Filename
-------------------------- --------------------------
### plugins ### plugins
3619 16426 buffergator 3619 16686 buffergator
102 16171 DirDiff.vim 102 16171 DirDiff.vim
1984 13961 :AutoInstall: FuzzyFinder 1984 13961 :AutoInstall: FuzzyFinder
311 7645 grep.vim 311 7645 grep.vim
@@ -17,7 +17,7 @@ ScriptID SourceID Filename
2540 11006 snipMate.vim 2540 11006 snipMate.vim
1697 12566 :AutoInstall: surround.vim 1697 12566 :AutoInstall: surround.vim
3465 15751 Tagbar 3465 15751 Tagbar
90 16616 vcscommand.vim 90 16705 vcscommand.vim
2226 15854 vimwiki.vim 2226 15854 vimwiki.vim
1334 6377 vst.vim 1334 6377 vst.vim
2321 9055 zoom.vim 2321 9055 zoom.vim

View File

@@ -108,52 +108,72 @@ q Quit the index/catalog window.
Open Selected Buffer~ Open Selected Buffer~
The following keys all open the currently-selected buffer and switch focus to The following keys all open the currently-selected buffer and switch focus to
it. The catalog buffer will be closed if 'g:buffergator_autodismiss_on_select' it. If the key presses are preceded by a number, then the buffer with that
evaluates to true; otherwise it will be kept open. number will be selected and opened instead of the current buffer. The catalog
buffer will be closed if 'g:buffergator_autodismiss_on_select' evaluates to
true; otherwise it will be kept open.
<CR>, o Open the currently-selected buffer in previous window. <CR>, o Open the currently-selected buffer (or, if [count] is
s Open the currently-selected buffer in a new vertical given, buffer with number [count]), in previous window.
s Open the currently-selected buffer (or, if [count] is
given, buffer with number [count]), in a new vertical
split. split.
i Open the currently-selected buffer in a new split. i Open the currently-selected buffer (or, if [count] is
t Open the currently-selected buffer in a new tab page. given, buffer with number [count]), in a new split.
t Open the currently-selected buffer (or, if [count] is
given, buffer with number [count]), in a new tab page.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Preview Selected Buffer~ Preview Selected Buffer~
The following keys all open the currently-selected buffer, but retain focus on The following keys all open the currently-selected buffer, but retain focus on
the catalog viewer. the catalog viewer. If the key presses are preceded by a number, than the
buffer with that number will be opened.
O, go Preview the currently-selected buffer in the previous O, go Preview the currently-selected buffer (or, if [count] is
given, buffer with number [count]), in the previous
window. window.
S, gs Preview the currently-selected buffer is a new vertical S, gs Preview the currently-selected buffer (or, if [count] is
given, buffer with number [count]), is a new vertical
split. split.
I, gi Preview the currently-selected buffer is a new split I, gi Preview the currently-selected buffer (or, if [count] is
T Preview the currently-selected buffer is a new tab given, buffer with number [count]), in a new split
T Preview the currently-selected buffer (or, if [count] is
given, buffer with number [count]), in a new tab
page. page.
<SPACE>, <C-N> Go to the next buffer entry and preview it in the previous <SPACE>, <C-N> Go to the next buffer entry (or, if [count] is
window. given, buffer with number [count]), and preview it in the
<C-SPACE>, <C-P> Go to the previous buffer entry and preview it in the previous window.
<C-SPACE>, <C-P> Go to the previous buffer entry (or, if [count] is
given, buffer with number [count]), and preview it in the
previous window. previous window.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Go to Existing Viewport Showing Buffer~ Go to Existing Viewport Showing Buffer~
The following keys will try to find the selected buffer in an existing The following keys will try to find the selected buffer in an existing
viewport (whether on the current tab page or another). viewport (whether on the current tab page or another). If the key presses are
preceded by a number, then the buffer with that number will be the target
buffer.
eo If currently-selected buffer is showing in an existing eo If currently-selected buffer (or, if [count] is
given, buffer with number [count]), is showing in an existing
viewport on this or any other tab page, go it it; viewport on this or any other tab page, go it it;
otherwise show it in the previous window. otherwise show it in the previous window.
es If currently-selected buffer is showing in an existing es If currently-selected buffer (or, if [count] is
given, buffer with number [count]), is showing in an existing
viewport on this or any other tab page, go it it; viewport on this or any other tab page, go it it;
otherwise show it in a new vertical split. otherwise show it in a new vertical split.
ei If currently-selected buffer is showing in an existing ei If currently-selected buffer (or, if [count] is
given, buffer with number [count]), is showing in an existing
viewport on this or any other tab page, go it it; viewport on this or any other tab page, go it it;
otherwise show it in a new horizontal split. otherwise show it in a new horizontal split.
et If currently-selected buffer is showing in an existing et If currently-selected buffer (or, if [count] is
given, buffer with number [count]), is showing in an existing
viewport on this or any other tab page, go it it; viewport on this or any other tab page, go it it;
otherwise show it in a new tab page. otherwise show it in a new tab page.
E If currently-selected buffer is showing in an existing E If currently-selected buffer (or, if [count] is
given, buffer with number [count]), is showing in an existing
viewport on this or any other tab page, go it it; viewport on this or any other tab page, go it it;
otherwise do nothing. otherwise do nothing.

View File

@@ -533,8 +533,10 @@ function! s:NewCatalogViewer(name, title)
execute("silent keepalt keepjumps " . self.split_mode . " " . self.bufnum) execute("silent keepalt keepjumps " . self.split_mode . " " . self.bufnum)
if g:buffergator_viewport_split_policy =~ '[RrLl]' && g:buffergator_split_size if g:buffergator_viewport_split_policy =~ '[RrLl]' && g:buffergator_split_size
execute("vertical resize " . g:buffergator_split_size) execute("vertical resize " . g:buffergator_split_size)
setlocal winfixwidth
elseif g:buffergator_viewport_split_policy =~ '[TtBb]' && g:buffergator_split_size elseif g:buffergator_viewport_split_policy =~ '[TtBb]' && g:buffergator_split_size
execute("resize " . g:buffergator_split_size) execute("resize " . g:buffergator_split_size)
setlocal winfixheight
endif endif
endif endif
endfunction endfunction
@@ -1004,28 +1006,28 @@ function! s:NewBufferCatalogViewer()
noremap <buffer> <silent> cd :call b:buffergator_catalog_viewer.cycle_display_regime()<CR> noremap <buffer> <silent> cd :call b:buffergator_catalog_viewer.cycle_display_regime()<CR>
noremap <buffer> <silent> r :call b:buffergator_catalog_viewer.rebuild_catalog()<CR> noremap <buffer> <silent> r :call b:buffergator_catalog_viewer.rebuild_catalog()<CR>
noremap <buffer> <silent> q :call b:buffergator_catalog_viewer.close(1)<CR> noremap <buffer> <silent> q :call b:buffergator_catalog_viewer.close(1)<CR>
noremap <buffer> <silent> d :call b:buffergator_catalog_viewer.delete_target(0, 0)<CR> noremap <buffer> <silent> d :<C-U>call b:buffergator_catalog_viewer.delete_target(0, 0)<CR>
noremap <buffer> <silent> D :call b:buffergator_catalog_viewer.delete_target(0, 1)<CR> noremap <buffer> <silent> D :<C-U>call b:buffergator_catalog_viewer.delete_target(0, 1)<CR>
noremap <buffer> <silent> x :call b:buffergator_catalog_viewer.delete_target(1, 0)<CR> noremap <buffer> <silent> x :<C-U>call b:buffergator_catalog_viewer.delete_target(1, 0)<CR>
noremap <buffer> <silent> X :call b:buffergator_catalog_viewer.delete_target(1, 1)<CR> noremap <buffer> <silent> X :<C-U>call b:buffergator_catalog_viewer.delete_target(1, 1)<CR>
""""" Selection: show target and switch focus """"" Selection: show target and switch focus
noremap <buffer> <silent> <CR> :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR> noremap <buffer> <silent> <CR> :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
noremap <buffer> <silent> o :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR> noremap <buffer> <silent> o :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "")<CR>
" gryf: let's keep it stright: s should h split, v should vertical " gryf: let's keep it stright: s should h split, v should vertical
" split " split
noremap <buffer> <silent> s :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR> noremap <buffer> <silent> s :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb")<CR>
noremap <buffer> <silent> v :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR> noremap <buffer> <silent> v :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb")<CR>
noremap <buffer> <silent> t :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb")<CR> noremap <buffer> <silent> t :<C-U>call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb")<CR>
""""" Preview: show target , keeping focus on catalog """"" Preview: show target , keeping focus on catalog
noremap <buffer> <silent> O :call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR> noremap <buffer> <silent> O :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR>
noremap <buffer> <silent> go :call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR> noremap <buffer> <silent> go :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "")<CR>
noremap <buffer> <silent> S :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR> noremap <buffer> <silent> S :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR>
noremap <buffer> <silent> gs :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR> noremap <buffer> <silent> gs :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb")<CR>
noremap <buffer> <silent> I :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR> noremap <buffer> <silent> I :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR>
noremap <buffer> <silent> gi :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR> noremap <buffer> <silent> gi :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "sb")<CR>
noremap <buffer> <silent> T :call b:buffergator_catalog_viewer.visit_target(1, 1, "tab sb")<CR> noremap <buffer> <silent> T :<C-U>call b:buffergator_catalog_viewer.visit_target(1, 1, "tab sb")<CR>
noremap <buffer> <silent> <SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1)<CR> noremap <buffer> <silent> <SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1)<CR>
noremap <buffer> <silent> <C-SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR> noremap <buffer> <silent> <C-SPACE> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
noremap <buffer> <silent> <C-@> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR> noremap <buffer> <silent> <C-@> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
@@ -1033,11 +1035,11 @@ function! s:NewBufferCatalogViewer()
noremap <buffer> <silent> <C-P> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR> noremap <buffer> <silent> <C-P> :<C-U>call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1)<CR>
""""" Preview: go to existing window showing target """"" Preview: go to existing window showing target
noremap <buffer> <silent> E :call b:buffergator_catalog_viewer.visit_open_target(1, !g:buffergator_autodismiss_on_select, "")<CR> noremap <buffer> <silent> E :<C-U>call b:buffergator_catalog_viewer.visit_open_target(1, !g:buffergator_autodismiss_on_select, "")<CR>
noremap <buffer> <silent> eo :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "")<CR> noremap <buffer> <silent> eo :<C-U>call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "")<CR>
noremap <buffer> <silent> es :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "vert sb")<CR> noremap <buffer> <silent> es :<C-U>call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "vert sb")<CR>
noremap <buffer> <silent> ei :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "sb")<CR> noremap <buffer> <silent> ei :<C-U>call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "sb")<CR>
noremap <buffer> <silent> et :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "tab sb")<CR> noremap <buffer> <silent> et :<C-U>call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "tab sb")<CR>
else else
@@ -1140,7 +1142,7 @@ function! s:NewBufferCatalogViewer()
" explicit split command not given: switch to buffer in current " explicit split command not given: switch to buffer in current
" window " window
let &switchbuf="useopen" let &switchbuf="useopen"
execute("silent keepalt keepjumps buffer " . a:bufnum) execute("silent buffer " . a:bufnum)
else else
" explcit split command given: split current window " explcit split command given: split current window
let &switchbuf="split" let &switchbuf="split"
@@ -1149,14 +1151,38 @@ function! s:NewBufferCatalogViewer()
let &switchbuf=l:old_switch_buf let &switchbuf=l:old_switch_buf
endfunction endfunction
" Go to the selected buffer. function! l:catalog_viewer.get_target_bufnum(cmd_count) dict
function! l:catalog_viewer.visit_target(keep_catalog, refocus_catalog, split_cmd) dict if a:cmd_count == 0
let l:cur_line = line(".") let l:cur_line = line(".")
if !has_key(l:self.jump_map, l:cur_line) if !has_key(l:self.jump_map, l:cur_line)
call s:_buffergator_messenger.send_info("Not a valid navigation line") call s:_buffergator_messenger.send_info("Not a valid navigation line")
return 0 return -1
endif endif
let [l:jump_to_bufnum] = self.jump_map[l:cur_line].target let [l:jump_to_bufnum] = self.jump_map[l:cur_line].target
return l:jump_to_bufnum
else
let l:jump_to_bufnum = a:cmd_count
if bufnr(l:jump_to_bufnum) == -1
call s:_buffergator_messenger.send_info("Not a valid buffer number: " . string(l:jump_to_bufnum) )
return -1
endif
for lnum in range(1, line("$"))
if self.jump_map[lnum].target[0] == l:jump_to_bufnum
call cursor(lnum, 1)
return l:jump_to_bufnum
endif
endfor
call s:_buffergator_messenger.send_info("Not a listed buffer number: " . string(l:jump_to_bufnum) )
return -1
endif
endfunction
" Go to the selected buffer.
function! l:catalog_viewer.visit_target(keep_catalog, refocus_catalog, split_cmd) dict range
let l:jump_to_bufnum = self.get_target_bufnum(v:count)
if l:jump_to_bufnum == -1
return 0
endif
let l:cur_tab_num = tabpagenr() let l:cur_tab_num = tabpagenr()
if !a:keep_catalog if !a:keep_catalog
call self.close(0) call self.close(0)
@@ -1171,13 +1197,11 @@ function! s:NewBufferCatalogViewer()
" Go to the selected buffer, preferentially using a window that already is " Go to the selected buffer, preferentially using a window that already is
" showing it; if not, create a window using split_cmd " showing it; if not, create a window using split_cmd
function! l:catalog_viewer.visit_open_target(unconditional, keep_catalog, split_cmd) dict function! l:catalog_viewer.visit_open_target(unconditional, keep_catalog, split_cmd) dict range
let l:cur_line = line(".") let l:jump_to_bufnum = self.get_target_bufnum(v:count)
if !has_key(l:self.jump_map, l:cur_line) if l:jump_to_bufnum == -1
call s:_buffergator_messenger.send_info("Not a valid navigation line")
return 0 return 0
endif endif
let [l:jump_to_bufnum] = self.jump_map[l:cur_line].target
let wnr = bufwinnr(l:jump_to_bufnum) let wnr = bufwinnr(l:jump_to_bufnum)
if wnr != -1 if wnr != -1
execute(wnr . "wincmd w") execute(wnr . "wincmd w")
@@ -1204,13 +1228,11 @@ function! s:NewBufferCatalogViewer()
endif endif
endfunction endfunction
function! l:catalog_viewer.delete_target(wipe, force) dict function! l:catalog_viewer.delete_target(wipe, force) dict range
let l:cur_line = line(".") let l:bufnum_to_delete = self.get_target_bufnum(v:count)
if !has_key(l:self.jump_map, l:cur_line) if l:bufnum_to_delete == -1
call s:_buffergator_messenger.send_info("Not a valid navigation line")
return 0 return 0
endif endif
let [l:bufnum_to_delete] = self.jump_map[l:cur_line].target
if !bufexists(l:bufnum_to_delete) if !bufexists(l:bufnum_to_delete)
call s:_buffergator_messenger.send_info("Not a valid or existing buffer") call s:_buffergator_messenger.send_info("Not a valid or existing buffer")
return 0 return 0
@@ -1290,18 +1312,29 @@ function! s:NewBufferCatalogViewer()
endfunction endfunction
" Finds next line with occurrence of a rendered index " Finds next line with occurrence of a rendered index
function! l:catalog_viewer.goto_index_entry(direction, visit_target, refocus_catalog) dict function! l:catalog_viewer.goto_index_entry(direction, visit_target, refocus_catalog) dict range
if v:count > 0
let l:target_bufnum = v:count
if bufnr(l:target_bufnum) == -1
call s:_buffergator_messenger.send_info("Not a valid buffer number: " . string(l:target_bufnum) )
return -1
endif
let l:ok = 0
for lnum in range(1, line("$"))
if self.jump_map[lnum].target[0] == l:target_bufnum
call cursor(lnum, 1)
let l:ok = 1
break
endif
endfor
if !l:ok
call s:_buffergator_messenger.send_info("Not a listed buffer number: " . string(l:target_bufnum) )
return -1
endif
else
let l:ok = self.goto_pattern("^\[", a:direction) let l:ok = self.goto_pattern("^\[", a:direction)
execute("normal! zz") execute("normal! zz")
if l:ok && a:visit_target
call self.visit_target(1, a:refocus_catalog, "")
endif endif
endfunction
" Finds next line with occurrence of a file pattern.
function! l:catalog_viewer.goto_file_start(direction, visit_target, refocus_catalog) dict
let l:ok = self.goto_pattern("^:::", a:direction)
execute("normal! zz")
if l:ok && a:visit_target if l:ok && a:visit_target
call self.visit_target(1, a:refocus_catalog, "") call self.visit_target(1, a:refocus_catalog, "")
endif endif
@@ -1382,7 +1415,8 @@ function! s:NewTabCatalogViewer()
if l:cur_tab_num - 1 == l:tidx if l:cur_tab_num - 1 == l:tidx
let l:initial_line = line("$") let l:initial_line = line("$")
endif endif
let l:tabfield = "==== Tab Page [" . string(l:tidx+1) . "] ====" " let l:tabfield = "==== Tab Page [" . string(l:tidx+1) . "] ===="
let l:tabfield = "TAB PAGE " . string(l:tidx+1) . ":"
call self.append_line(l:tabfield, l:tidx+1, 1) call self.append_line(l:tabfield, l:tidx+1, 1)
for widx in range(len(l:tabinfo)) for widx in range(len(l:tabinfo))
let l:tabbufnum = l:tabinfo[widx] let l:tabbufnum = l:tabinfo[widx]
@@ -1419,7 +1453,7 @@ function! s:NewTabCatalogViewer()
function! l:catalog_viewer.setup_buffer_syntax() dict function! l:catalog_viewer.setup_buffer_syntax() dict
if has("syntax") if has("syntax")
syn match BuffergatorTabPageLine '^==== Tab Page \[\d\+\] ====$' syn match BuffergatorTabPageLine '^TAB PAGE \d\+\:$'
" syn match BuffergatorTabPageLineStart '^==== Tab Page \[' nextgroup=BuffergatorTabPageNumber " syn match BuffergatorTabPageLineStart '^==== Tab Page \[' nextgroup=BuffergatorTabPageNumber
" syn match BuffergatorTabPageNumber '\d\+' nextgroup=BuffergatorTabPageLineEnd " syn match BuffergatorTabPageNumber '\d\+' nextgroup=BuffergatorTabPageLineEnd
" syn match BuffergatorTabPageLineEnd '\] ====$' " syn match BuffergatorTabPageLineEnd '\] ====$'
@@ -1476,7 +1510,7 @@ function! s:NewTabCatalogViewer()
endfunction endfunction
function! l:catalog_viewer.goto_index_entry(direction) dict function! l:catalog_viewer.goto_index_entry(direction) dict
let l:ok = self.goto_pattern("^=", a:direction) let l:ok = self.goto_pattern("^T", a:direction)
execute("normal! zz") execute("normal! zz")
" if l:ok && a:visit_target " if l:ok && a:visit_target
" call self.visit_target(1, a:refocus_catalog, "") " call self.visit_target(1, a:refocus_catalog, "")
@@ -1523,7 +1557,12 @@ function! BuffergatorBuffersStatusLine()
return l:status_line return l:status_line
endfunction endfunction
function! BuffergatorTabsStatusLine() function! BuffergatorTabsStatusLine()
let l:status_line = "[[buffergator: tabs]]" let l:status_line = "[[buffergator]]"
let l:line = line(".")
if has_key(b:buffergator_catalog_viewer.jump_map, l:line)
let l:status_line .= " Tab Page: " . b:buffergator_catalog_viewer.jump_map[l:line].target[0]
let l:status_line .= ", Window: " . b:buffergator_catalog_viewer.jump_map[l:line].target[1]
endif
return l:status_line return l:status_line
endfunction endfunction
" 1}}} " 1}}}

View File

@@ -43,7 +43,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr')) if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
" BZR is not installed " BZR is not installed
@@ -105,7 +107,7 @@ endfunction
" Function: s:bzrFunctions.Annotate(argList) {{{2 " Function: s:bzrFunctions.Annotate(argList) {{{2
function! s:bzrFunctions.Annotate(argList) function! s:bzrFunctions.Annotate(argList)
if len(a:argList) == 0 if len(a:argList) == 0
if &filetype == 'BZRannotate' if &filetype ==? 'bzrannotate'
" Perform annotation of the version indicated by the current line. " Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption let options = ' -r' . caption

View File

@@ -820,7 +820,15 @@ function! s:VCSAnnotate(bang, ...)
endif endif
let originalFileType = getbufvar(originalBuffer, '&ft') let originalFileType = getbufvar(originalBuffer, '&ft')
let annotateFileType = getbufvar(annotateBuffer, '&ft') let annotateFileType = getbufvar(annotateBuffer, '&ft')
let saveselection = &selection
set selection=inclusive
try
execute "normal! 0zR\<c-v>G/" . splitRegex . "/e\<cr>d" execute "normal! 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
finally
let &selection = saveselection
endtry
call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype')) call setbufvar('%', '&filetype', getbufvar(originalBuffer, '&filetype'))
set scrollbind set scrollbind
leftabove vert new leftabove vert new

View File

@@ -89,7 +89,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs')) if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
" CVS is not installed " CVS is not installed
@@ -180,7 +182,7 @@ endfunction
" Function: s:cvsFunctions.Annotate(argList) {{{2 " Function: s:cvsFunctions.Annotate(argList) {{{2
function! s:cvsFunctions.Annotate(argList) function! s:cvsFunctions.Annotate(argList)
if len(a:argList) == 0 if len(a:argList) == 0
if &filetype == 'CVSannotate' if &filetype ==? 'cvsannotate'
" This is a CVSAnnotate buffer. Perform annotation of the version " This is a CVSAnnotate buffer. Perform annotation of the version
" indicated by the current line. " indicated by the current line.
let caption = matchstr(getline('.'),'\v^[0-9.]+') let caption = matchstr(getline('.'),'\v^[0-9.]+')

View File

@@ -48,7 +48,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git')) if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
" git is not installed " git is not installed

View File

@@ -50,7 +50,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg')) if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
" HG is not installed " HG is not installed
@@ -110,10 +112,10 @@ endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2 " Function: s:hgFunctions.Annotate(argList) {{{2
function! s:hgFunctions.Annotate(argList) function! s:hgFunctions.Annotate(argList)
if len(a:argList) == 0 if len(a:argList) == 0
if &filetype == 'HGannotate' if &filetype ==? 'hgannotate'
" Perform annotation of the version indicated by the current line. " Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let caption = matchstr(getline('.'),'\v^\s*\w+\s+\zs\d+')
let options = ' -r' . caption let options = ' -un -r' . caption
else else
let caption = '' let caption = ''
let options = ' -un' let options = ' -un'

View File

@@ -43,7 +43,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk')) if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
" SVK is not installed " SVK is not installed
@@ -104,7 +106,7 @@ endfunction
" Function: s:svkFunctions.Annotate(argList) {{{2 " Function: s:svkFunctions.Annotate(argList) {{{2
function! s:svkFunctions.Annotate(argList) function! s:svkFunctions.Annotate(argList)
if len(a:argList) == 0 if len(a:argList) == 0
if &filetype == 'SVKannotate' if &filetype ==? 'svkannotate'
" Perform annotation of the version indicated by the current line. " Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption let options = ' -r' . caption

View File

@@ -50,7 +50,9 @@ if v:version < 700
finish finish
endif endif
runtime plugin/vcscommand.vim if !exists('g:loaded_VCSCommand')
runtime plugin/vcscommand.vim
endif
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn')) if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
" SVN is not installed " SVN is not installed
@@ -89,22 +91,17 @@ endfunction
" Function: s:svnFunctions.Identify(buffer) {{{2 " Function: s:svnFunctions.Identify(buffer) {{{2
function! s:svnFunctions.Identify(buffer) function! s:svnFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer)) let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
if isdirectory(fileName) try
let directoryName = fileName call s:VCSCommandUtility.system(s:Executable() . ' info .')
else if(v:shell_error)
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 return 0
else
return g:VCSCOMMAND_IDENTIFY_EXACT
endif endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction endfunction
" Function: s:svnFunctions.Add() {{{2 " Function: s:svnFunctions.Add() {{{2
@@ -115,7 +112,7 @@ endfunction
" Function: s:svnFunctions.Annotate(argList) {{{2 " Function: s:svnFunctions.Annotate(argList) {{{2
function! s:svnFunctions.Annotate(argList) function! s:svnFunctions.Annotate(argList)
if len(a:argList) == 0 if len(a:argList) == 0
if &filetype == 'SVNannotate' if &filetype ==? 'svnannotate'
" Perform annotation of the version indicated by the current line. " Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption let options = ' -r' . caption
@@ -187,7 +184,7 @@ endfunction
function! s:svnFunctions.GetBufferInfo() function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%')) let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer) 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) if(v:shell_error)
return [] return []
endif endif