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

Update of plugins VCSCommand, gundo and tagbar. Update vy* colorschemes.

This commit is contained in:
2011-06-09 11:30:08 +02:00
parent c12ebf43d0
commit 5cd8324b5e
16 changed files with 459 additions and 139 deletions

View File

@@ -66,6 +66,9 @@ endif"}}}
if !exists("g:gundo_map_move_newer")"{{{
let g:gundo_map_move_newer = 'k'
endif"}}}
if !exists("g:gundo_close_on_revert")"{{{
let g:gundo_close_on_revert = 0
endif"}}}
"}}}
@@ -595,11 +598,19 @@ function! s:GundoClose()"{{{
endfunction"}}}
function! s:GundoOpen()"{{{
" Save `splitbelow` value and set it to default to avoid problems with
" positioning new windows.
let saved_splitbelow = &splitbelow
let &splitbelow = 0
call s:GundoOpenPreview()
exe bufwinnr(g:gundo_target_n) . "wincmd w"
call s:GundoRenderGraph()
call s:GundoRenderPreview()
" Restore `splitbelow` value.
let &splitbelow = saved_splitbelow
endfunction"}}}
function! s:GundoToggle()"{{{
@@ -884,6 +895,9 @@ def GundoRevert():
vim.command('GundoRenderGraph')
_goto_window_for_buffer(back)
if int(vim.eval('g:gundo_close_on_revert')):
vim.command('GundoToggle')
GundoRevert()
ENDPYTHON
endfunction"}}}

View File

@@ -4,7 +4,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.0.1
" Version: 2.1
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -25,9 +25,17 @@ endif
" Initialization {{{1
" Basic init {{{2
if v:version < 700
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
finish
endif
if !exists('g:tagbar_ctags_bin')
if executable('ctags-exuberant')
let g:tagbar_ctags_bin = 'ctags-exuberant'
elseif executable('exuberant-ctags')
let g:tagbar_ctags_bin = 'exuberant-ctags'
elseif executable('exctags')
let g:tagbar_ctags_bin = 'exctags'
elseif executable('ctags')
@@ -49,6 +57,16 @@ else
endif
endif
redir => s:ftype_out
silent filetype
redir END
if s:ftype_out !~# 'detection:ON'
echomsg 'Tagbar: Filetype detection is turned off, skipping plugin'
unlet s:ftype_out
finish
endif
unlet s:ftype_out
let g:loaded_tagbar = 1
if !exists('g:tagbar_left')
@@ -91,6 +109,10 @@ if !exists('g:tagbar_autoshowtag')
let g:tagbar_autoshowtag = 0
endif
if !exists('g:tagbar_systemenc')
let g:tagbar_systemenc = &encoding
endif
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
\ (empty(&termencoding) || &termencoding == 'utf-8')
let s:icon_closed = '▶'
@@ -105,6 +127,7 @@ endif
let s:type_init_done = 0
let s:autocommands_done = 0
let s:checked_ctags = 0
let s:window_expanded = 0
let s:access_symbols = {
@@ -113,6 +136,8 @@ let s:access_symbols = {
\ 'private' : '-'
\ }
autocmd SessionLoadPost * nested call s:RestoreSession()
" s:InitTypes() {{{2
function! s:InitTypes()
let s:known_types = {}
@@ -808,6 +833,42 @@ function! s:GetUserTypeDefs()
return defdict
endfunction
" s:RestoreSession() {{{2
" Properly restore Tagbar after a session got loaded
function! s:RestoreSession()
let tagbarwinnr = bufwinnr('__Tagbar__')
if tagbarwinnr == -1
" Tagbar wasn't open in the saved session, nothing to do
return
else
let in_tagbar = 1
if winnr() != tagbarwinnr
execute tagbarwinnr . 'wincmd w'
let in_tagbar = 0
endif
endif
if !s:type_init_done
call s:InitTypes()
endif
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
endif
call s:InitWindow(g:tagbar_autoclose)
" Leave the Tagbar window and come back so the update event gets triggered
execute 'wincmd p'
execute tagbarwinnr . 'wincmd w'
if !in_tagbar
execute 'wincmd p'
endif
endfunction
" s:MapKeys() {{{2
function! s:MapKeys()
nnoremap <script> <silent> <buffer> <CR> :call <SID>JumpToTag(0)<CR>
@@ -841,7 +902,7 @@ function! s:MapKeys()
nnoremap <script> <silent> <buffer> s :call <SID>ToggleSort()<CR>
nnoremap <script> <silent> <buffer> x :call <SID>ZoomWindow()<CR>
nnoremap <script> <silent> <buffer> q :close<CR>
nnoremap <script> <silent> <buffer> q :call <SID>CloseWindow()<CR>
nnoremap <script> <silent> <buffer> <F1> :call <SID>ToggleHelp()<CR>
endfunction
@@ -862,6 +923,58 @@ function! s:CreateAutocommands()
let s:autocommands_done = 1
endfunction
" s:CheckForExCtags() {{{2
" Test whether the ctags binary is actually Exuberant Ctags and not GNU ctags
" (or something else)
function! s:CheckForExCtags()
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--version')
if ctags_cmd == ''
return
endif
let ctags_output = s:ExecuteCtags(ctags_cmd)
if v:shell_error || ctags_output !~# 'Exuberant Ctags'
echoerr 'Tagbar: Ctags doesn''t seem to be Exuberant Ctags!'
echomsg 'GNU ctags will NOT WORK.'
\ 'Please download Exuberant Ctags from ctags.sourceforge.net'
\ 'and install it in a directory in your $PATH'
\ 'or set g:tagbar_ctags_bin.'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
endif
return 0
elseif !s:CheckExCtagsVersion(ctags_output)
echoerr 'Tagbar: Exuberant Ctags is too old!'
echomsg 'You need at least version 5.5 for Tagbar to work.'
\ 'Please download a newer version from ctags.sourceforge.net.'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
endif
return 0
else
let s:checked_ctags = 1
return 1
endif
endfunction
" s:CheckExCtagsVersion() {{{2
function! s:CheckExCtagsVersion(output)
let matchlist = matchlist(a:output, '\vExuberant Ctags (\d+)\.(\d+)')
let major = matchlist[1]
let minor = matchlist[2]
return major >= 6 || (major == 5 && minor >= 5)
endfunction
" Prototypes {{{1
" Base tag {{{2
let s:BaseTag = {}
@@ -1284,10 +1397,6 @@ endfunction
" s:OpenWindow() {{{2
function! s:OpenWindow(autoclose)
if !s:type_init_done
call s:InitTypes()
endif
" If the tagbar window is already open jump to it
let tagbarwinnr = bufwinnr('__Tagbar__')
if tagbarwinnr != -1
@@ -1297,6 +1406,16 @@ function! s:OpenWindow(autoclose)
return
endif
if !s:type_init_done
call s:InitTypes()
endif
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
endif
" Expand the Vim window to accomodate for the Tagbar window if requested
if g:tagbar_expand && !s:window_expanded && has('gui_running')
let &columns += g:tagbar_width + 1
@@ -1306,6 +1425,20 @@ function! s:OpenWindow(autoclose)
let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical '
exe 'silent keepalt ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__'
call s:InitWindow(a:autoclose)
execute 'wincmd p'
" Jump back to the tagbar window if autoclose or autofocus is set. Can't
" just stay in it since it wouldn't trigger the update event
if g:tagbar_autoclose || a:autoclose || g:tagbar_autofocus
let tagbarwinnr = bufwinnr('__Tagbar__')
execute tagbarwinnr . 'wincmd w'
endif
endfunction
" s:InitWindow() {{{2
function! s:InitWindow(autoclose)
setlocal noreadonly " in case the "view" mode is used
setlocal buftype=nofile
setlocal bufhidden=hide
@@ -1324,13 +1457,14 @@ function! s:OpenWindow(autoclose)
endif
setlocal nofoldenable
" Reset fold settings in case a plugin set them globally to something
" expensive. Apparently 'foldexpr' gets executed even if 'foldenable' is
" off, and then for every appended line (like with :put).
setlocal foldmethod&
setlocal foldexpr&
setlocal statusline=%!TagbarGenerateStatusline()
" Variable for saving the current file for functions that are called from
" the tagbar window
let s:current_file = ''
" Script-local variable needed since compare functions can't
" take extra arguments
let s:compare_typeinfo = {}
@@ -1357,15 +1491,6 @@ function! s:OpenWindow(autoclose)
endif
let &cpoptions = cpoptions_save
execute 'wincmd p'
" Jump back to the tagbar window if autoclose or autofocus is set. Can't
" just stay in it since it wouldn't trigger the update event
if g:tagbar_autoclose || a:autoclose || g:tagbar_autofocus
let tagbarwinnr = bufwinnr('__Tagbar__')
execute tagbarwinnr . 'wincmd w'
endif
endfunction
" s:CloseWindow() {{{2
@@ -1430,61 +1555,15 @@ function! s:ProcessFile(fname, ftype)
return
endif
let typeinfo = s:known_types[a:ftype]
let ctags_output = s:ExecuteCtagsOnFile(a:fname, a:ftype)
if has_key(typeinfo, 'ctagsargs')
let ctags_args = ' ' . typeinfo.ctagsargs . ' '
else
let ctags_args = ' -f - '
let ctags_args .= ' --format=2 '
let ctags_args .= ' --excmd=pattern '
let ctags_args .= ' --fields=nksSa '
let ctags_args .= ' --extra= '
let ctags_args .= ' --sort=yes '
" Include extra type definitions
if has_key(typeinfo, 'deffile')
let ctags_args .= ' --options=' . typeinfo.deffile . ' '
endif
let ctags_type = typeinfo.ctagstype
let ctags_kinds = ''
for kind in typeinfo.kinds
let ctags_kinds .= kind.short
endfor
let ctags_args .= ' --language-force=' . ctags_type .
\ ' --' . ctags_type . '-kinds=' . ctags_kinds . ' '
endif
if has_key(typeinfo, 'ctagsbin')
let ctags_bin = expand(typeinfo.ctagsbin)
else
let ctags_bin = g:tagbar_ctags_bin
endif
if has('win32') || has('win64')
let ctags_bin = fnamemodify(ctags_bin, ':8')
else
let ctags_bin = shellescape(ctags_bin)
endif
let ctags_cmd = ctags_bin . ctags_args . shellescape(a:fname)
let ctags_output = system(ctags_cmd)
if v:shell_error
echoerr 'Tagbar: Could not execute ctags for ' . a:fname . '!'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
endif
if ctags_output == -1
" put an empty entry into known_files so the error message is only
" shown once
call s:known_files.put({}, a:fname)
return
elseif ctags_output == ''
return
endif
" If the file has only been updated preserve the fold states, otherwise
@@ -1496,6 +1575,8 @@ function! s:ProcessFile(fname, ftype)
let fileinfo = s:FileInfo.New(a:fname, a:ftype)
endif
let typeinfo = s:known_types[a:ftype]
" Parse the ctags output lines
let rawtaglist = split(ctags_output, '\n\+')
for line in rawtaglist
@@ -1559,6 +1640,64 @@ function! s:ProcessFile(fname, ftype)
call s:known_files.put(fileinfo)
endfunction
" s:ExecuteCtagsOnFile() {{{2
function! s:ExecuteCtagsOnFile(fname, ftype)
let typeinfo = s:known_types[a:ftype]
if has_key(typeinfo, 'ctagsargs')
let ctags_args = ' ' . typeinfo.ctagsargs . ' '
else
let ctags_args = ' -f - '
let ctags_args .= ' --format=2 '
let ctags_args .= ' --excmd=pattern '
let ctags_args .= ' --fields=nksSa '
let ctags_args .= ' --extra= '
let ctags_args .= ' --sort=yes '
" Include extra type definitions
if has_key(typeinfo, 'deffile')
let ctags_args .= ' --options=' . typeinfo.deffile . ' '
endif
let ctags_type = typeinfo.ctagstype
let ctags_kinds = ''
for kind in typeinfo.kinds
let ctags_kinds .= kind.short
endfor
let ctags_args .= ' --language-force=' . ctags_type .
\ ' --' . ctags_type . '-kinds=' . ctags_kinds . ' '
endif
if has_key(typeinfo, 'ctagsbin')
let ctags_bin = expand(typeinfo.ctagsbin)
else
let ctags_bin = g:tagbar_ctags_bin
endif
let ctags_cmd = s:EscapeCtagsCmd(ctags_bin, ctags_args, a:fname)
if ctags_cmd == ''
return ''
endif
let ctags_output = s:ExecuteCtags(ctags_cmd)
if v:shell_error || ctags_output =~ 'Warning: cannot open source file'
echoerr 'Tagbar: Could not execute ctags for ' . a:fname . '!'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
endfor
endif
return -1
endif
return ctags_output
endfunction
" s:ParseTagline() {{{2
" Structure of a tag line:
" tagname<TAB>filename<TAB>expattern;"fields
@@ -1911,6 +2050,8 @@ function! s:RenderContent(...)
let lazyredraw_save = &lazyredraw
set lazyredraw
let eventignore_save = &eventignore
set eventignore=all
setlocal modifiable
@@ -1951,7 +2092,8 @@ function! s:RenderContent(...)
call winline()
endif
let &lazyredraw = lazyredraw_save
let &lazyredraw = lazyredraw_save
let &eventignore = eventignore_save
if !in_tagbar
execute prevwinnr . 'wincmd w'
@@ -2177,7 +2319,30 @@ function! s:JumpToTag(stay_in_tagbar)
endif
let tagbarwinnr = winnr()
" This elaborate construct will try to switch to the correct
" buffer/window; if the buffer isn't currently shown in a window it will
" open it in the first window with a non-special buffer in it
execute 'wincmd p'
let filebufnr = bufnr(taginfo.fileinfo.fpath)
if bufnr('%') != filebufnr
let filewinnr = bufwinnr(filebufnr)
if filewinnr != -1
execute filewinnr . 'wincmd w'
else
for i in range(1, winnr('$'))
execute i . 'wincmd w'
if &buftype == ''
execute 'buffer ' . filebufnr
break
endif
endfor
endif
" To make ctrl-w_p work we switch between the Tagbar window and the
" correct window once
execute tagbarwinnr . 'wincmd w'
execute 'wincmd p'
endif
" Mark current position so it can be jumped back to
mark '
@@ -2400,7 +2565,6 @@ endfunction
function! s:CleanUp()
silent autocmd! TagbarAutoCmds
unlet s:current_file
unlet s:is_maximized
unlet s:compare_typeinfo
unlet s:short_help
@@ -2434,14 +2598,14 @@ function! s:AutoUpdate(fname)
return
endif
" Only consider the main filetype in cases like 'python.django'
let ftype = get(split(&filetype, '\.'), 0, '')
" Don't do anything if the file isn't supported
if !s:IsValidFile(a:fname, &filetype)
if !s:IsValidFile(a:fname, ftype)
return
endif
" Only consider the main filetype in cases like 'python.django'
let ftype = split(&filetype, '\.')[0]
" Process the file if it's unknown or the information is outdated
" Also test for entries that exist but are empty, which will be the case
" if there was an error during the ctags execution
@@ -2490,6 +2654,76 @@ function! s:IsValidFile(fname, ftype)
return 1
endfunction
" s:EscapeCtagsCmd() {{{2
" Assemble the ctags command line in a way that all problematic characters are
" properly escaped and converted to the system's encoding
" Optional third parameter is a file name to run ctags on
function! s:EscapeCtagsCmd(ctags_bin, args, ...)
if exists('+shellslash')
let shellslash_save = &shellslash
set noshellslash
endif
if a:0 == 1
let fname = shellescape(a:1)
else
let fname = ''
endif
let ctags_cmd = shellescape(a:ctags_bin) . ' ' . a:args . ' ' . fname
if exists('+shellslash')
let &shellslash = shellslash_save
endif
" Needed for cases where 'encoding' is different from the system's
" encoding
if g:tagbar_systemenc != &encoding
let ctags_cmd = iconv(ctags_cmd, &encoding, g:tagbar_systemenc)
elseif $LANG != ''
let ctags_cmd = iconv(ctags_cmd, &encoding, $LANG)
endif
if ctags_cmd == ''
echoerr 'Tagbar: Encoding conversion failed!'
\ 'Please make sure your system is set up correctly'
\ 'and that Vim is compiled with the "iconv" feature.'
endif
return ctags_cmd
endfunction
" s:ExecuteCtags() {{{2
" Execute ctags with necessary shell settings
" Partially based on the discussion at
" http://vim.1045645.n5.nabble.com/bad-default-shellxquote-in-Widows-td1208284.html
function! s:ExecuteCtags(ctags_cmd)
if exists('+shellslash')
let shellslash_save = &shellslash
set noshellslash
endif
if &shell =~ 'cmd\.exe'
let shellxquote_save = &shellxquote
set shellxquote=\"
let shellcmdflag_save = &shellcmdflag
set shellcmdflag=/s\ /c
endif
let ctags_output = system(a:ctags_cmd)
if &shell =~ 'cmd\.exe'
let &shellxquote = shellxquote_save
let &shellcmdflag = shellcmdflag_save
endif
if exists('+shellslash')
let &shellslash = shellslash_save
endif
return ctags_output
endfunction
" s:GetTagInfo() {{{2
" Return the info dictionary of the tag on the specified line. If the line
" does not contain a valid tag (for example because it is empty or only

View File

@@ -63,7 +63,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
@@ -123,7 +123,7 @@ function! s:bzrFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
normal! 1G2dd
endif
return resultBuffer
endfunction

View File

@@ -376,6 +376,9 @@ function! s:VCSCommandUtility.system(...)
set sxq=\"
endif
try
if exists('*iconv')
return iconv(call('system', a:000), &tenc, &enc)
endif
return call('system', a:000)
finally
if exists("save_sxq")
@@ -434,7 +437,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
@@ -740,12 +743,12 @@ function! s:VCSAnnotate(bang, ...)
endif
let originalFileType = getbufvar(originalBuffer, '&ft')
let annotateFileType = getbufvar(annotateBuffer, '&ft')
execute "normal 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
execute "normal! 0zR\<c-v>G/" . splitRegex . "/e\<cr>d"
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
@@ -757,12 +760,12 @@ function! s:VCSAnnotate(bang, ...)
" 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'
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
normal! zv
endif
endif
endif
@@ -982,8 +985,9 @@ function! s:VCSVimDiff(...)
\ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')'
\ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
\ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
\ . '|call setbufvar('.originalBuffer.', ''&cursorbind'', '.getbufvar(originalBuffer, '&cursorbind').')'
\ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
\ . '|if &foldmethod==''manual''|execute ''normal zE''|endif'
\ . '|if &foldmethod==''manual''|execute ''normal! zE''|endif'
diffthis
wincmd w
else
@@ -1073,7 +1077,7 @@ function! VCSCommandChdir(directory)
if exists("*haslocaldir") && haslocaldir()
let command = 'lcd'
endif
execute command escape(a:directory, ' ')
execute command fnameescape(a:directory)
endfunction
" Function: VCSCommandChangeToCurrentFileDir() {{{2
@@ -1113,6 +1117,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)
@@ -1160,7 +1165,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
@@ -1207,7 +1212,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
@@ -1284,6 +1289,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>]))
@@ -1312,23 +1325,25 @@ com! VCSCommandEnableBufferSetup call VCSCommandEnableBufferSetup()
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
@@ -1352,7 +1367,7 @@ let s:defaultMappings = [
\['v', 'VCSVimDiff'],
\]
if !VCSCommandGetOption('VCSCommandDisableMappings', 0)
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

View File

@@ -109,7 +109,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
@@ -410,23 +410,25 @@ 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
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)

View File

@@ -68,7 +68,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

View File

@@ -70,7 +70,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

View File

@@ -63,7 +63,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
@@ -122,7 +122,7 @@ function! s:svkFunctions.Annotate(argList)
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
normal! 1G2dd
endif
return resultBuffer
endfunction

View File

@@ -70,7 +70,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