mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
" fugitive.vim - A Git wrapper so awesome, it should be illegal
|
||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||
" Version: 3.3
|
||||
" Version: 3.4
|
||||
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
|
||||
|
||||
if exists('g:loaded_fugitive')
|
||||
@ -16,9 +16,9 @@ let s:bad_git_dir = '/$\|^fugitive:'
|
||||
" Fugitive is active in the current buffer. Do not rely on this for direct
|
||||
" filesystem access; use FugitiveFind('.git/whatever') instead.
|
||||
function! FugitiveGitDir(...) abort
|
||||
if v:version < 704
|
||||
if v:version < 703
|
||||
return ''
|
||||
elseif !a:0 || type(a:1) == type(0) && a:1 < 0
|
||||
elseif !a:0 || type(a:1) == type(0) && a:1 < 0 || a:1 is# get(v:, 'true', -1)
|
||||
if exists('g:fugitive_event')
|
||||
return g:fugitive_event
|
||||
endif
|
||||
@ -30,7 +30,7 @@ function! FugitiveGitDir(...) abort
|
||||
return b:git_dir
|
||||
endif
|
||||
return dir =~# s:bad_git_dir ? '' : dir
|
||||
elseif type(a:1) == type(0)
|
||||
elseif type(a:1) == type(0) && a:1 isnot# 0
|
||||
if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
|
||||
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
|
||||
endif
|
||||
@ -55,7 +55,11 @@ endfunction
|
||||
" exists, call FooReal("foo://bar").
|
||||
function! FugitiveReal(...) abort
|
||||
let file = a:0 ? a:1 : @%
|
||||
if file =~# '^\a\a\+:' || a:0 > 1
|
||||
if type(file) ==# type({})
|
||||
let dir = FugitiveGitDir(file)
|
||||
let tree = s:Tree(dir)
|
||||
return FugitiveVimPath(empty(tree) ? dir : tree)
|
||||
elseif file =~# '^\a\a\+:' || a:0 > 1
|
||||
return call('fugitive#Real', [file] + a:000[1:-1])
|
||||
elseif file =~# '^/\|^\a:\|^$'
|
||||
return file
|
||||
@ -72,14 +76,10 @@ endfunction
|
||||
" An optional second argument provides the Git dir, or the buffer number of a
|
||||
" buffer with a Git dir. The default is the current buffer.
|
||||
function! FugitiveFind(...) abort
|
||||
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||
endfunction
|
||||
|
||||
function! FugitivePath(...) abort
|
||||
if a:0 > 1
|
||||
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
|
||||
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type(0))
|
||||
return call('fugitive#Find', a:000[1:-1] + [FugitiveGitDir(a:1)])
|
||||
else
|
||||
return FugitiveReal(a:0 ? a:1 : @%)
|
||||
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -99,6 +99,14 @@ function! FugitiveParse(...) abort
|
||||
throw v:errmsg
|
||||
endfunction
|
||||
|
||||
" FugitiveGitVersion() queries the version of Git in use. Pass up to 3
|
||||
" arguments to return a Boolean of whether a certain minimum version is
|
||||
" available (FugitiveGitVersion(2,3,4) checks for 2.3.4 or higher) or no
|
||||
" arguments to get a raw string.
|
||||
function! FugitiveGitVersion(...) abort
|
||||
return call('fugitive#GitVersion', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveResult() returns an object encapsulating the result of the most
|
||||
" recent :Git command. Will be empty if no result is available. During a
|
||||
" User FugitiveChanged event, this is guaranteed to correspond to the :Git
|
||||
@ -108,7 +116,7 @@ endfunction
|
||||
"
|
||||
" * "args": List of command arguments, starting with the subcommand. Will be
|
||||
" empty for usages like :Git --help.
|
||||
" * "dir": Git dir of the relevant repository.
|
||||
" * "git_dir": Git dir of the relevant repository.
|
||||
" * "exit_status": The integer exit code of the process.
|
||||
" * "flags": Flags passed directly to Git, like -c and --help.
|
||||
" * "file": Path to file containing command output. Not guaranteed to exist,
|
||||
@ -117,16 +125,44 @@ function! FugitiveResult(...) abort
|
||||
return call('fugitive#Result', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitivePrepare() constructs a Git command string which can be executed with
|
||||
" functions like system() and commands like :!. Integer arguments will be
|
||||
" treated as buffer numbers, and the appropriate relative path inserted in
|
||||
" their place.
|
||||
" FugitiveExecute() runs Git with a list of arguments and returns a dictionary
|
||||
" with the following keys:
|
||||
"
|
||||
" If the first argument is a string that looks like a path or an empty string,
|
||||
" it will be used as the Git dir. If it's a buffer number, the Git dir for
|
||||
" that buffer will be used. The default is the current buffer.
|
||||
" * "exit_status": The integer exit code of the process.
|
||||
" * "stdout": The stdout produced by the process, as a list of lines.
|
||||
" * "stderr": The stdout produced by the process, as a list of lines.
|
||||
"
|
||||
" An optional second argument provides the Git dir, or the buffer number of a
|
||||
" buffer with a Git dir. The default is the current buffer.
|
||||
"
|
||||
" An optional final argument is a callback Funcref, for asynchronous
|
||||
" execution.
|
||||
function! FugitiveExecute(args, ...) abort
|
||||
return call('fugitive#Execute', [a:args] + a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveShellCommand() turns an array of arugments into a Git command string
|
||||
" which can be executed with functions like system() and commands like :!.
|
||||
" Integer arguments will be treated as buffer numbers, and the appropriate
|
||||
" relative path inserted in their place.
|
||||
"
|
||||
" An optional second argument provides the Git dir, or the buffer number of a
|
||||
" buffer with a Git dir. The default is the current buffer.
|
||||
function! FugitiveShellCommand(...) abort
|
||||
return call('fugitive#ShellCommand', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitivePrepare() is a deprecated alias for FugitiveShellCommand(). If you
|
||||
" are using this in conjunction with system(), consider using
|
||||
" FugitiveExecute() instead.
|
||||
function! FugitivePrepare(...) abort
|
||||
return call('fugitive#Prepare', a:000)
|
||||
if !exists('s:did_prepare_warning')
|
||||
let s:did_prepare_warning = 1
|
||||
echohl WarningMsg
|
||||
unsilent echomsg 'FugitivePrepare() has been superseded by FugitiveShellCommand()'
|
||||
echohl NONE
|
||||
endif
|
||||
return call('fugitive#ShellCommand', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveConfig() get returns an opaque structure that can be passed to other
|
||||
@ -171,7 +207,19 @@ endfunction
|
||||
" An optional second argument provides the Git dir, or the buffer number of a
|
||||
" buffer with a Git dir. The default is the current buffer.
|
||||
function! FugitiveRemoteUrl(...) abort
|
||||
return fugitive#RemoteUrl(a:0 ? a:1 : '', a:0 > 1 ? a:2 : -1, a:0 > 2 ? a:3 : 0)
|
||||
return call('fugitive#RemoteUrl', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveDidChange() triggers a FugitiveChanged event and reloads the summary
|
||||
" buffer for the current or given buffer number's repository. You can also
|
||||
" give the result of a FugitiveExecute() and that context will be made
|
||||
" available inside the FugitiveChanged() event.
|
||||
"
|
||||
" Passing the special argument 0 (the number zero) softly expires summary
|
||||
" buffers for all repositories. This can be used after a call to system()
|
||||
" with unclear implications.
|
||||
function! FugitiveDidChange(...) abort
|
||||
return call('fugitive#DidChange', a:000)
|
||||
endfunction
|
||||
|
||||
" FugitiveHead() retrieves the name of the current branch. If the current HEAD
|
||||
@ -182,15 +230,36 @@ endfunction
|
||||
" An optional second argument provides the Git dir, or the buffer number of a
|
||||
" buffer with a Git dir. The default is the current buffer.
|
||||
function! FugitiveHead(...) abort
|
||||
let dir = FugitiveGitDir(a:0 > 1 ? a:2 : -1)
|
||||
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type('') && a:1 !~# '^\d\+$')
|
||||
let dir = FugitiveGitDir(a:1)
|
||||
let arg = get(a:, 2, 0)
|
||||
elseif a:0 > 1
|
||||
let dir = FugitiveGitDir(a:2)
|
||||
let arg = a:1
|
||||
else
|
||||
let dir = FugitiveGitDir()
|
||||
let arg = get(a:, 1, 0)
|
||||
endif
|
||||
if empty(dir)
|
||||
return ''
|
||||
endif
|
||||
return fugitive#Head(a:0 ? a:1 : 0, dir)
|
||||
return fugitive#Head(arg, dir)
|
||||
endfunction
|
||||
|
||||
function! FugitivePath(...) abort
|
||||
if a:0 > 2 && type(a:1) ==# type({})
|
||||
return fugitive#Path(a:2, a:3, FugitiveGitDir(a:1))
|
||||
elseif a:0 && type(a:1) ==# type({})
|
||||
return FugitiveReal(a:0 > 1 ? a:2 : @%)
|
||||
elseif a:0 > 1
|
||||
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
|
||||
else
|
||||
return FugitiveReal(a:0 ? a:1 : @%)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveStatusline(...) abort
|
||||
if empty(get(b:, 'git_dir', ''))
|
||||
if empty(FugitiveGitDir(bufnr('')))
|
||||
return ''
|
||||
endif
|
||||
return fugitive#Statusline()
|
||||
@ -213,9 +282,12 @@ function! FugitiveWorkTree(...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveIsGitDir(path) abort
|
||||
let path = substitute(a:path, '[\/]$', '', '') . '/'
|
||||
return len(a:path) && getfsize(path.'HEAD') > 10 && (
|
||||
function! FugitiveIsGitDir(...) abort
|
||||
if !a:0 || type(a:1) !=# type('')
|
||||
return !empty(call('FugitiveGitDir', a:000))
|
||||
endif
|
||||
let path = substitute(a:1, '[\/]$', '', '') . '/'
|
||||
return len(path) && getfsize(path.'HEAD') > 10 && (
|
||||
\ isdirectory(path.'objects') && isdirectory(path.'refs') ||
|
||||
\ getftype(path.'commondir') ==# 'file')
|
||||
endfunction
|
||||
@ -279,7 +351,13 @@ function! s:CeilingDirectories() abort
|
||||
endfunction
|
||||
|
||||
function! FugitiveExtractGitDir(path) abort
|
||||
let path = s:Slash(a:path)
|
||||
if type(a:path) ==# type({})
|
||||
return get(a:path, 'git_dir', '')
|
||||
elseif type(a:path) == type(0)
|
||||
let path = s:Slash(a:path >= 0 ? bufname(a:path) : bufname(''))
|
||||
else
|
||||
let path = s:Slash(a:path)
|
||||
endif
|
||||
if path =~# '^fugitive:'
|
||||
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
|
||||
elseif empty(path)
|
||||
@ -335,15 +413,18 @@ function! FugitiveExtractGitDir(path) abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! FugitiveDetect(path) abort
|
||||
if v:version < 704
|
||||
function! FugitiveDetect(...) abort
|
||||
if v:version < 703
|
||||
return ''
|
||||
endif
|
||||
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
|
||||
unlet b:git_dir
|
||||
endif
|
||||
if a:0 > 1 && a:2 is# 0 && !exists('#User#Fugitive')
|
||||
return ''
|
||||
endif
|
||||
if !exists('b:git_dir')
|
||||
let b:git_dir = FugitiveExtractGitDir(a:path)
|
||||
let b:git_dir = FugitiveExtractGitDir(a:0 ? a:1 : bufnr(''))
|
||||
endif
|
||||
if empty(b:git_dir) || !exists('#User#Fugitive')
|
||||
return ''
|
||||
@ -397,14 +478,14 @@ function! s:ProjectionistDetect() abort
|
||||
if exists('+shellslash') && !&shellslash
|
||||
let base = tr(base, '/', '\')
|
||||
endif
|
||||
let file = FugitiveCommonDir(dir) . '/info/projections.json'
|
||||
let file = FugitiveFind('.git/info/projections.json', dir)
|
||||
if filereadable(file)
|
||||
call projectionist#append(base, file)
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
|
||||
let s:addr_other = has('patch-8.1.560') || has('nvim-0.5.0') ? '-addr=other' : ''
|
||||
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
|
||||
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
|
||||
|
||||
@ -413,16 +494,22 @@ if exists(':G') != 2
|
||||
endif
|
||||
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
|
||||
|
||||
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 0)
|
||||
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|echohl WarningMSG|echomsg ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
|
||||
elseif exists(':Gstatus') != 2 && !exists('g:fugitive_legacy_commands')
|
||||
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus'
|
||||
\ ' echoerr ":Gstatus has been removed in favor of :Git (with no arguments)"'
|
||||
endif
|
||||
|
||||
for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame']
|
||||
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 0)
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
|
||||
\ 'echohl WarningMSG|echomsg ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|'
|
||||
\ 'exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "' . tolower(s:cmd) . ' " . <q-args>)'
|
||||
elseif exists(':G' . tolower(s:cmd)) != 2 && !exists('g:fugitive_legacy_commands')
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
|
||||
\ 'echoerr ":G' . tolower(s:cmd) . ' has been removed in favor of :Git ' . tolower(s:cmd) . '"'
|
||||
endif
|
||||
endfor
|
||||
unlet s:cmd
|
||||
@ -431,66 +518,68 @@ exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd
|
||||
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(<q-args>, 1)"
|
||||
|
||||
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
|
||||
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 0)
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
|
||||
\ '|echohl WarningMSG|echomsg ":Glog is deprecated in favor of :Gclog"|echohl NONE'
|
||||
elseif exists(':Glog') != 2 && !exists('g:fugitive_legacy_commands')
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog'
|
||||
\ ' echoerr ":Glog has been removed in favor of :Gclog"'
|
||||
endif
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
|
||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
|
||||
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "split" : "edit"), <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "vsplit" : "edit!"), <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open((<count> >= 0 ? <count> : "")."tabedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "split" : "edit"), <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "vsplit" : "edit!"), <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open((<count> >= 0 ? <count> : "")."tabedit", <bang>0, "<mods>", <q-args>)'
|
||||
|
||||
if exists(':Gr') != 2
|
||||
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
endif
|
||||
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, <bang>0, "vertical <mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, <bang>0, "vertical <mods>", <q-args>)'
|
||||
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
|
||||
exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
exe 'command! -bar -bang -nargs=0 Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=0 Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|echohl WarningMSG|echomsg ":Gremove is deprecated in favor of :GRemove"|echohl NONE'
|
||||
endif
|
||||
if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
exe 'command! -bar -bang -nargs=0 Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=0 Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|echohl WarningMSG|echomsg ":Gdelete is deprecated in favor of :GDelete"|echohl NONE'
|
||||
endif
|
||||
if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|echohl WarningMSG|echomsg ":Gmove is deprecated in favor of :GMove"|echohl NONE'
|
||||
endif
|
||||
if exists(':Grename') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|echohl WarningMSG|echomsg ":Grename is deprecated in favor of :GRename"|echohl NONE'
|
||||
endif
|
||||
|
||||
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
||||
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
||||
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
||||
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echomsg ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
|
||||
endif
|
||||
|
||||
if v:version < 704
|
||||
if v:version < 703
|
||||
finish
|
||||
endif
|
||||
|
||||
@ -514,8 +603,9 @@ let g:io_fugitive = {
|
||||
augroup fugitive
|
||||
autocmd!
|
||||
|
||||
autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('<amatch>:p'))
|
||||
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
|
||||
autocmd BufNewFile,BufReadPost *
|
||||
\ call FugitiveDetect(expand('<amatch>:p'), 0)
|
||||
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<afile>:p')), ':p'), 1)
|
||||
|
||||
autocmd FileType git
|
||||
\ call fugitive#MapCfile()
|
||||
@ -526,7 +616,7 @@ augroup fugitive
|
||||
\ setlocal foldtext=fugitive#Foldtext() |
|
||||
\ endif
|
||||
autocmd FileType fugitive
|
||||
\ call fugitive#MapCfile('fugitive#StatusCfile()')
|
||||
\ call fugitive#MapCfile('fugitive#PorcelainCfile()')
|
||||
autocmd FileType gitrebase
|
||||
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
|
||||
\ if &l:includeexpr !~# 'Fugitive' |
|
||||
@ -570,15 +660,12 @@ endif
|
||||
|
||||
let s:nowait = v:version >= 704 ? '<nowait>' : ''
|
||||
|
||||
function! s:Map(mode, lhs, rhs, ...) abort
|
||||
for mode in split(a:mode, '\zs')
|
||||
let flags = (a:0 ? a:1 : '') . (a:rhs =~# '<Plug>' ? '' : '<script>')
|
||||
let head = a:lhs
|
||||
let tail = ''
|
||||
let keys = get(g:, mode.'remap', {})
|
||||
if type(keys) == type([])
|
||||
return
|
||||
endif
|
||||
function! s:Map(mode, lhs, rhs, flags) abort
|
||||
let flags = a:flags . (a:rhs =~# '<Plug>' ? '' : '<script>')
|
||||
let head = a:lhs
|
||||
let tail = ''
|
||||
let keys = get(g:, a:mode.'remap', {})
|
||||
if len(keys) && type(keys) == type({})
|
||||
while !empty(head)
|
||||
if has_key(keys, head)
|
||||
let head = keys[head]
|
||||
@ -590,10 +677,10 @@ function! s:Map(mode, lhs, rhs, ...) abort
|
||||
let tail = matchstr(head, '<[^<>]*>$\|.$') . tail
|
||||
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
|
||||
endwhile
|
||||
if flags !~# '<unique>' || empty(mapcheck(head.tail, mode))
|
||||
exe mode.'map' s:nowait flags head.tail a:rhs
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if flags !~# '<unique>' || empty(mapcheck(head.tail, a:mode))
|
||||
exe a:mode.'map' s:nowait flags head.tail a:rhs
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call s:Map('c', '<C-R><C-G>', 'fnameescape(fugitive#Object(@%))', '<expr>')
|
||||
|
Reference in New Issue
Block a user