mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-04-25 00:34:00 +08:00
Compare commits
100 Commits
v3.3
...
parallel-status
| Author | SHA1 | Date | |
|---|---|---|---|
| 195edd146f | |||
| 6c53da0783 | |||
| b709d9f782 | |||
| 0b53a4daff | |||
| 7a34996886 | |||
| 239089f6e7 | |||
| f11b80022f | |||
| 56561e47a6 | |||
| 8e4a677c7f | |||
| 35872c5dca | |||
| 5853cb0fc3 | |||
| b20e4145c7 | |||
| d1970112f4 | |||
| 371a5062d3 | |||
| 4adf054a3f | |||
| 19e7604839 | |||
| dfae8191f4 | |||
| 89c9f96d49 | |||
| b8ba07f7d8 | |||
| f58ac20359 | |||
| 55382eb722 | |||
| 2ee6a48d0b | |||
| 8def00c247 | |||
| 8082606fd0 | |||
| 2dc08dfe35 | |||
| a25d4d6961 | |||
| 2d0f51679c | |||
| 99e65ce049 | |||
| ebc828ef7c | |||
| dc579a0dfb | |||
| e9f913ff8a | |||
| 3a5d8c8770 | |||
| 1da2c02421 | |||
| 7a087725ee | |||
| 24fd3d9599 | |||
| 058ffa406d | |||
| 11aee0ba82 | |||
| c417518819 | |||
| 93f25f6883 | |||
| a41329ab7c | |||
| 5f87622277 | |||
| 6bacc1039c | |||
| d6edaf7a4d | |||
| af5ba43aa3 | |||
| 8b0a40dfa2 | |||
| 8820f3f89c | |||
| 7ab4ab9796 | |||
| 295780c507 | |||
| 07b8277475 | |||
| 75b2a9a8da | |||
| a7c54990f0 | |||
| de6495ae84 | |||
| 58516a13c6 | |||
| 1c2663f516 | |||
| b5316d0e96 | |||
| e9f93be356 | |||
| fd5b553029 | |||
| 3e2d531322 | |||
| 4cdeff8c33 | |||
| 7412370dc8 | |||
| 78d41a014e | |||
| 957d962e06 | |||
| f920245d6b | |||
| 5551853f34 | |||
| b498607aa7 | |||
| 0ec3bb2bdd | |||
| d11c90ad66 | |||
| ca03f1d069 | |||
| ae6f84adf3 | |||
| 8e0a8abf08 | |||
| ca0ff578ad | |||
| 24d1c60364 | |||
| 79e2bd381a | |||
| 857c107e5a | |||
| be9ff95f27 | |||
| c26b4b018a | |||
| 41960996e0 | |||
| 8886d97070 | |||
| f7f1413ed9 | |||
| 10ed70a9c2 | |||
| 9eec18e76b | |||
| 9871822dd5 | |||
| 6ae064c5aa | |||
| 798f65a180 | |||
| da8d532b1a | |||
| bee78a418f | |||
| 28afd12151 | |||
| dd01e40106 | |||
| 47a07a0a32 | |||
| 7a75c18554 | |||
| c926aadfaf | |||
| 0868c30cc0 | |||
| 32b0d62663 | |||
| 8f4a23e663 | |||
| f7a6097caa | |||
| b227b887bb | |||
| 895e56daca | |||
| 55e9f2f47e | |||
| 9a1dab0b27 | |||
| f037ce631a |
+5
-5
@@ -36,11 +36,11 @@ Additional commands are provided for higher level operations:
|
|||||||
* View any blob, tree, commit, or tag in the repository with `:Gedit` (and
|
* View any blob, tree, commit, or tag in the repository with `:Gedit` (and
|
||||||
`:Gsplit`, etc.). For example, `:Gedit HEAD~3:%` loads the current file as
|
`:Gsplit`, etc.). For example, `:Gedit HEAD~3:%` loads the current file as
|
||||||
it existed 3 commits ago.
|
it existed 3 commits ago.
|
||||||
* `:Gdiffsplit` brings up the staged version of the file side by side with the
|
* `:Gdiffsplit` (or `:Gvdiffsplit`) brings up the staged version of the file
|
||||||
working tree version. Use Vim's diff handling capabilities to apply changes
|
side by side with the working tree version. Use Vim's diff handling
|
||||||
to the staged version, and write that buffer to stage the changes. You can
|
capabilities to apply changes to the staged version, and write that buffer
|
||||||
also give an arbitrary `:Gedit` argument to diff against older versions of
|
to stage the changes. You can also give an arbitrary `:Gedit` argument to
|
||||||
the file.
|
diff against older versions of the file.
|
||||||
* `:Gread` is a variant of `git checkout -- filename` that operates on the
|
* `:Gread` is a variant of `git checkout -- filename` that operates on the
|
||||||
buffer rather than the file itself. This means you can use `u` to undo it
|
buffer rather than the file itself. This means you can use `u` to undo it
|
||||||
and you never get any warnings about the file changing outside Vim.
|
and you never get any warnings about the file changing outside Vim.
|
||||||
|
|||||||
+918
-429
File diff suppressed because it is too large
Load Diff
+47
-12
@@ -309,7 +309,7 @@ Navigation maps ~
|
|||||||
|
|
||||||
*fugitive_<CR>*
|
*fugitive_<CR>*
|
||||||
<CR> Open the file or |fugitive-object| under the cursor.
|
<CR> Open the file or |fugitive-object| under the cursor.
|
||||||
in a blob, this and similar maps jump to the patch
|
In a blob, this and similar maps jump to the patch
|
||||||
from the diff where this was added, or where it was
|
from the diff where this was added, or where it was
|
||||||
removed if a count was given. If the line is still in
|
removed if a count was given. If the line is still in
|
||||||
the work tree version, passing a count takes you to
|
the work tree version, passing a count takes you to
|
||||||
@@ -601,20 +601,47 @@ a statusline, this one matches the default when 'ruler' is set:
|
|||||||
>
|
>
|
||||||
set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P
|
set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P
|
||||||
<
|
<
|
||||||
*FugitiveHead(...)* *fugitive#head(...)*
|
AUTOCOMMANDS *fugitive-autocommands*
|
||||||
Use FugitiveHead() to return the name of the current branch. If the current
|
|
||||||
HEAD is detached, FugitiveHead() will return the empty string, unless the
|
A handful of |User| |autocommands| are provided to allow extending and
|
||||||
optional argument is given, in which case the hash of the current commit will
|
overriding Fugitive behaviors. Example usage:
|
||||||
be truncated to the given number of characters.
|
>
|
||||||
|
autocmd User FugitiveBlob call s:BlobOverrides()
|
||||||
|
<
|
||||||
|
*User_FugitiveIndex*
|
||||||
|
FugitiveIndex After loading the |fugitive-summary| buffer.
|
||||||
|
|
||||||
|
*User_FugitiveTag*
|
||||||
|
FugitiveTag After loading a tag object.
|
||||||
|
|
||||||
|
*User_FugitiveCommit*
|
||||||
|
FugitiveCommit After loading a commit object.
|
||||||
|
|
||||||
|
*User_FugitiveTree*
|
||||||
|
FugitiveTree After loading a tree (directory) object.
|
||||||
|
|
||||||
|
*User_FugitiveBlob*
|
||||||
|
FugitiveBlob After loading a blob (file) object. This includes
|
||||||
|
both committed blobs which are read only, and staged
|
||||||
|
blobs which can be edited and written. Check
|
||||||
|
&modifiable to distinguish between the two.
|
||||||
|
|
||||||
|
*User_FugitiveChanged*
|
||||||
|
FugitiveChanged After any event which can potentially change the
|
||||||
|
repository, for example, any invocation of |:Git|.
|
||||||
|
Originally intended for expiring caches, but can have
|
||||||
|
other uses.
|
||||||
|
|
||||||
|
API *fugitive-api*
|
||||||
|
|
||||||
|
Officially supported functions are documented inline in plugin/fugitive.vim.
|
||||||
|
|
||||||
DEPRECATIONS *fugitive-deprecated*
|
DEPRECATIONS *fugitive-deprecated*
|
||||||
|
|
||||||
The following commands are softly deprecated in favor of replacements that
|
The following commands are deprecated in favor of replacements that adhere to
|
||||||
adhere to a new naming scheme. They will eventually be removed, but probably
|
a new naming scheme. Remember that |:Git| can be shortened to |:G|, so
|
||||||
not in the near future.
|
replacements using it are just one space character longer than the legacy
|
||||||
|
version.
|
||||||
Remember that |:Git| can be shortened to |:G|, so replacements using it are
|
|
||||||
just one space character longer than the legacy version.
|
|
||||||
|
|
||||||
*:Gremove* Superseded by |:GRemove|.
|
*:Gremove* Superseded by |:GRemove|.
|
||||||
*:Gdelete* Superseded by |:GDelete|.
|
*:Gdelete* Superseded by |:GDelete|.
|
||||||
@@ -640,6 +667,14 @@ just one space character longer than the legacy version.
|
|||||||
*:Gtabsplit!* Superseded by :tab Git --paginate.
|
*:Gtabsplit!* Superseded by :tab Git --paginate.
|
||||||
*:Gpedit!* Superseded by :Git! --paginate.
|
*:Gpedit!* Superseded by :Git! --paginate.
|
||||||
|
|
||||||
|
*User_Fugitive*
|
||||||
|
Fugitive used to support `:autocmd User Fugitive` to run an autocommand after
|
||||||
|
loading any buffer belonging to a Git repository, but this is being phased
|
||||||
|
out. Instead, one can leverage regular autocommand events like |BufNewFile|
|
||||||
|
and |BufReadPost|, and check !empty(FugitiveGitDir()) to confirm Fugitive has
|
||||||
|
found a repository. See also |fugitive-autocommands| for other, more
|
||||||
|
selective events.
|
||||||
|
|
||||||
ABOUT *fugitive-about*
|
ABOUT *fugitive-about*
|
||||||
|
|
||||||
Grab the latest version or report a bug on GitHub:
|
Grab the latest version or report a bug on GitHub:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
if exists("b:did_ftplugin") || !exists('*fugitive#BlameFileType')
|
if exists("b:did_ftplugin") || !exists("*FugitiveGitDir")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|||||||
+176
-143
@@ -10,13 +10,20 @@ let g:loaded_fugitive = 1
|
|||||||
|
|
||||||
let s:bad_git_dir = '/$\|^fugitive:'
|
let s:bad_git_dir = '/$\|^fugitive:'
|
||||||
|
|
||||||
|
" FugitiveGitDir() returns the detected Git dir for the given buffer number,
|
||||||
|
" or the current buffer if no argument is passed. This will be an empty
|
||||||
|
" string if no Git dir was found. Use !empty(FugitiveGitDir()) to check if
|
||||||
|
" Fugitive is active in the current buffer. Do not rely on this for direct
|
||||||
|
" filesystem access; use FugitiveFind('.git/whatever') instead.
|
||||||
function! FugitiveGitDir(...) abort
|
function! FugitiveGitDir(...) abort
|
||||||
if !a:0 || type(a:1) == type(0) && a:1 < 0
|
if v:version < 704
|
||||||
|
return ''
|
||||||
|
elseif !a:0 || type(a:1) == type(0) && a:1 < 0
|
||||||
if exists('g:fugitive_event')
|
if exists('g:fugitive_event')
|
||||||
return g:fugitive_event
|
return g:fugitive_event
|
||||||
endif
|
endif
|
||||||
let dir = get(b:, 'git_dir', '')
|
let dir = get(b:, 'git_dir', '')
|
||||||
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|prompt\)$')
|
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
|
||||||
return FugitiveExtractGitDir(getcwd())
|
return FugitiveExtractGitDir(getcwd())
|
||||||
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
|
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
|
||||||
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
|
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
|
||||||
@@ -65,11 +72,19 @@ endfunction
|
|||||||
" An optional second argument provides the Git dir, or the buffer number of a
|
" 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.
|
" buffer with a Git dir. The default is the current buffer.
|
||||||
function! FugitiveFind(...) abort
|
function! FugitiveFind(...) abort
|
||||||
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
if a:0 && type(a:1) ==# type({})
|
||||||
|
return call('fugitive#Find', a:000[1:-1] + [FugitiveGitDir(a:1)])
|
||||||
|
else
|
||||||
|
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitivePath(...) abort
|
function! FugitivePath(...) abort
|
||||||
if a:0 > 1
|
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))
|
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
|
||||||
else
|
else
|
||||||
return FugitiveReal(a:0 ? a:1 : @%)
|
return FugitiveReal(a:0 ? a:1 : @%)
|
||||||
@@ -93,13 +108,15 @@ function! FugitiveParse(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveResult() returns an object encapsulating the result of the most
|
" FugitiveResult() returns an object encapsulating the result of the most
|
||||||
" recend :Git command. Will be empty if no result is available. Pass in the
|
" recent :Git command. Will be empty if no result is available. During a
|
||||||
" name of a temp buffer to get the result object for that command instead.
|
" User FugitiveChanged event, this is guaranteed to correspond to the :Git
|
||||||
" Contains the following keys:
|
" command that triggered the event, or be empty if :Git was not the trigger.
|
||||||
|
" Pass in the name of a temp buffer to get the result object for that command
|
||||||
|
" instead. Contains the following keys:
|
||||||
"
|
"
|
||||||
" * "args": List of command arguments, starting with the subcommand. Will be
|
" * "args": List of command arguments, starting with the subcommand. Will be
|
||||||
" empty for usages like :Git --help.
|
" 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.
|
" * "exit_status": The integer exit code of the process.
|
||||||
" * "flags": Flags passed directly to Git, like -c and --help.
|
" * "flags": Flags passed directly to Git, like -c and --help.
|
||||||
" * "file": Path to file containing command output. Not guaranteed to exist,
|
" * "file": Path to file containing command output. Not guaranteed to exist,
|
||||||
@@ -117,7 +134,7 @@ endfunction
|
|||||||
" it will be used as the Git dir. If it's a buffer number, the Git dir for
|
" 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.
|
" that buffer will be used. The default is the current buffer.
|
||||||
function! FugitivePrepare(...) abort
|
function! FugitivePrepare(...) abort
|
||||||
return call('fugitive#Prepare', a:000)
|
return call('fugitive#ShellCommand', a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveConfig() get returns an opaque structure that can be passed to other
|
" FugitiveConfig() get returns an opaque structure that can be passed to other
|
||||||
@@ -125,33 +142,25 @@ endfunction
|
|||||||
" when performing multiple config queries. Do not rely on the internal
|
" when performing multiple config queries. Do not rely on the internal
|
||||||
" structure of the return value as it is not guaranteed. If you want a full
|
" structure of the return value as it is not guaranteed. If you want a full
|
||||||
" dictionary of every config value, use FugitiveConfigGetRegexp('.*').
|
" dictionary of every config value, use FugitiveConfigGetRegexp('.*').
|
||||||
|
"
|
||||||
|
" An optional argument provides the Git dir, or the buffer number of a
|
||||||
|
" buffer with a Git dir. The default is the current buffer. Pass a blank
|
||||||
|
" string to limit to the global config.
|
||||||
function! FugitiveConfig(...) abort
|
function! FugitiveConfig(...) abort
|
||||||
if a:0 == 2 && (type(a:2) != type({}) || has_key(a:2, 'git_dir'))
|
return call('fugitive#Config', a:000)
|
||||||
return fugitive#Config(a:1, FugitiveGitDir(a:2))
|
|
||||||
elseif a:0 == 1 && (type(a:1) !=# type('') || a:1 !~# '^[[:alnum:]-]\+\.')
|
|
||||||
return fugitive#Config(FugitiveGitDir(a:1))
|
|
||||||
else
|
|
||||||
return call('fugitive#Config', a:000)
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveConfigGet() retrieves a Git configuration value. An optional second
|
" FugitiveConfigGet() retrieves a Git configuration value. An optional second
|
||||||
" argument provides the Git dir as with FugitiveFind(). Pass a blank string
|
" argument can be either the object returned by FugitiveConfig(), or a Git
|
||||||
" to limit to the global config.
|
" dir or buffer number to be passed along to FugitiveConfig().
|
||||||
function! FugitiveConfigGet(name, ...) abort
|
function! FugitiveConfigGet(name, ...) abort
|
||||||
return call('FugitiveConfig', [a:name] + a:000)
|
return get(call('FugitiveConfigGetAll', [a:name] + (a:0 ? [a:1] : [])), 0, get(a:, 2, ''))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of
|
" FugitiveConfigGetAll() is like FugitiveConfigGet() but returns a list of
|
||||||
" all values.
|
" all values.
|
||||||
function! FugitiveConfigGetAll(name, ...) abort
|
function! FugitiveConfigGetAll(name, ...) abort
|
||||||
if a:0 && type(a:1) ==# type({}) && !has_key(a:1, 'git_dir')
|
return call('fugitive#ConfigGetAll', [a:name] + a:000)
|
||||||
let config = a:1
|
|
||||||
else
|
|
||||||
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
|
||||||
endif
|
|
||||||
let name = substitute(a:name, '^[^.]\+\|[^.]\+$', '\L&', 'g')
|
|
||||||
return copy(get(config, name, []))
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values
|
" FugitiveConfigGetRegexp() retrieves a dictionary of all configuration values
|
||||||
@@ -159,35 +168,42 @@ endfunction
|
|||||||
" using a Vim regexp. Second argument has same semantics as
|
" using a Vim regexp. Second argument has same semantics as
|
||||||
" FugitiveConfigGet().
|
" FugitiveConfigGet().
|
||||||
function! FugitiveConfigGetRegexp(pattern, ...) abort
|
function! FugitiveConfigGetRegexp(pattern, ...) abort
|
||||||
if a:0 && type(a:1) ==# type({}) && !has_key(a:2, 'git_dir')
|
return call('fugitive#ConfigGetRegexp', [a:pattern] + a:000)
|
||||||
let config = a:1
|
|
||||||
else
|
|
||||||
let config = fugitive#Config(FugitiveGitDir(a:0 ? a:1 : -1))
|
|
||||||
endif
|
|
||||||
let filtered = map(filter(copy(config), 'v:key =~# "\\." && v:key =~# a:pattern'), 'copy(v:val)')
|
|
||||||
if a:pattern !~# '\\\@<!\%(\\\\\)*\\z[se]'
|
|
||||||
return filtered
|
|
||||||
endif
|
|
||||||
let transformed = {}
|
|
||||||
for [k, v] in items(filtered)
|
|
||||||
let k = matchstr(k, a:pattern)
|
|
||||||
if len(k)
|
|
||||||
let transformed[k] = v
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return transformed
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FugitiveRemoteUrl() retrieves the remote URL for the given remote name,
|
||||||
|
" defaulting to the current branch's remote or "origin" if no argument is
|
||||||
|
" given. Similar to `git remote get-url`, but also attempts to resolve HTTP
|
||||||
|
" redirects and SSH host aliases.
|
||||||
|
"
|
||||||
|
" 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
|
function! FugitiveRemoteUrl(...) abort
|
||||||
return fugitive#RemoteUrl(a:0 ? a:1 : '', FugitiveGitDir(a:0 > 1 ? a:2 : -1), a:0 > 2 ? a:3 : 0)
|
return call('fugitive#RemoteUrl', a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FugitiveHead() retrieves the name of the current branch. If the current HEAD
|
||||||
|
" is detached, FugitiveHead() will return the empty string, unless the
|
||||||
|
" optional argument is given, in which case the hash of the current commit
|
||||||
|
" will be truncated to the given number of characters.
|
||||||
|
"
|
||||||
|
" 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
|
function! FugitiveHead(...) abort
|
||||||
let dir = FugitiveGitDir(a:0 > 1 ? a:2 : -1)
|
if a:0 && type(a:1) ==# type({})
|
||||||
|
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)
|
if empty(dir)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
return fugitive#Head(a:0 ? a:1 : 0, dir)
|
return fugitive#Head(arg, dir)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveStatusline(...) abort
|
function! FugitiveStatusline(...) abort
|
||||||
@@ -202,16 +218,24 @@ function! FugitiveCommonDir(...) abort
|
|||||||
if empty(dir)
|
if empty(dir)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
return fugitive#CommonDir(dir)
|
return fugitive#Find('.git/refs/..', dir)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveWorkTree(...) abort
|
function! FugitiveWorkTree(...) abort
|
||||||
return s:Tree(FugitiveGitDir(a:0 ? a:1 : -1))
|
let tree = s:Tree(FugitiveGitDir(a:0 ? a:1 : -1))
|
||||||
|
if tree isnot# 0 || a:0 > 1
|
||||||
|
return tree
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveIsGitDir(path) abort
|
function! FugitiveIsGitDir(...) abort
|
||||||
let path = substitute(a:path, '[\/]$', '', '') . '/'
|
if !a:0 || type(a:1) !=# type('')
|
||||||
return len(a:path) && getfsize(path.'HEAD') > 10 && (
|
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') ||
|
\ isdirectory(path.'objects') && isdirectory(path.'refs') ||
|
||||||
\ getftype(path.'commondir') ==# 'file')
|
\ getftype(path.'commondir') ==# 'file')
|
||||||
endfunction
|
endfunction
|
||||||
@@ -230,9 +254,14 @@ function! s:Tree(path) abort
|
|||||||
let config_file = dir . '/config'
|
let config_file = dir . '/config'
|
||||||
if filereadable(config_file)
|
if filereadable(config_file)
|
||||||
let config = readfile(config_file,'',10)
|
let config = readfile(config_file,'',10)
|
||||||
call filter(config,'v:val =~# "^\\s*worktree *="')
|
let wt_config = filter(copy(config),'v:val =~# "^\\s*worktree *="')
|
||||||
if len(config) == 1
|
if len(wt_config) == 1
|
||||||
let worktree = FugitiveVimPath(matchstr(config[0], '= *\zs.*'))
|
let worktree = FugitiveVimPath(matchstr(wt_config[0], '= *\zs.*'))
|
||||||
|
else
|
||||||
|
call filter(config,'v:val =~# "^\\s*bare *= *false *$"')
|
||||||
|
if len(config)
|
||||||
|
let s:worktree_for_dir[dir] = 0
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
elseif filereadable(dir . '/gitdir')
|
elseif filereadable(dir . '/gitdir')
|
||||||
let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')
|
let worktree = fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')
|
||||||
@@ -327,6 +356,9 @@ function! FugitiveExtractGitDir(path) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! FugitiveDetect(path) abort
|
function! FugitiveDetect(path) abort
|
||||||
|
if v:version < 704
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
|
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
|
||||||
unlet b:git_dir
|
unlet b:git_dir
|
||||||
endif
|
endif
|
||||||
@@ -381,7 +413,7 @@ function! s:ProjectionistDetect() abort
|
|||||||
if empty(base)
|
if empty(base)
|
||||||
let base = s:Tree(dir)
|
let base = s:Tree(dir)
|
||||||
endif
|
endif
|
||||||
if len(base)
|
if !empty(base)
|
||||||
if exists('+shellslash') && !&shellslash
|
if exists('+shellslash') && !&shellslash
|
||||||
let base = tr(base, '/', '\')
|
let base = tr(base, '/', '\')
|
||||||
endif
|
endif
|
||||||
@@ -392,9 +424,96 @@ function! s:ProjectionistDetect() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if v:version + has('patch061') < 703
|
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
|
||||||
runtime! autoload/fugitive.vim
|
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
|
||||||
|
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
|
||||||
|
|
||||||
|
if exists(':G') != 2
|
||||||
|
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
|
||||||
endif
|
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)
|
||||||
|
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'
|
||||||
|
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)
|
||||||
|
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>)'
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
unlet s:cmd
|
||||||
|
|
||||||
|
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(<q-args>, 0)"
|
||||||
|
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)
|
||||||
|
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'
|
||||||
|
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>])'
|
||||||
|
|
||||||
|
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>])'
|
||||||
|
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=* -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 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=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>])'
|
||||||
|
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>])'
|
||||||
|
\ '|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>])'
|
||||||
|
\ '|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>])'
|
||||||
|
\ '|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>])'
|
||||||
|
\ '|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>])'
|
||||||
|
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>])'
|
||||||
|
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echomsg ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if v:version < 704
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
let g:io_fugitive = {
|
let g:io_fugitive = {
|
||||||
\ 'simplify': function('fugitive#simplify'),
|
\ 'simplify': function('fugitive#simplify'),
|
||||||
\ 'resolve': function('fugitive#resolve'),
|
\ 'resolve': function('fugitive#resolve'),
|
||||||
@@ -465,92 +584,6 @@ augroup fugitive
|
|||||||
autocmd User ProjectionistDetect call s:ProjectionistDetect()
|
autocmd User ProjectionistDetect call s:ProjectionistDetect()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
|
|
||||||
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
|
|
||||||
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
|
|
||||||
|
|
||||||
if exists(':G') != 2
|
|
||||||
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete G exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
|
|
||||||
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)
|
|
||||||
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
|
|
||||||
\ '|echohl WarningMSG|echo ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
|
|
||||||
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)
|
|
||||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
|
|
||||||
\ 'echohl WarningMSG|echo ":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>)'
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
unlet s:cmd
|
|
||||||
|
|
||||||
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd exe fugitive#Cd(<q-args>, 0)"
|
|
||||||
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)
|
|
||||||
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
|
|
||||||
\ '|echohl WarningMSG|echo ":Glog is deprecated in favor of :Gclog"|echohl NONE'
|
|
||||||
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>])'
|
|
||||||
|
|
||||||
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>])'
|
|
||||||
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=* -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, "vert <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>, [<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=0 -complete=customlist,fugitive#CompleteObject GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
|
||||||
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject 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>])'
|
|
||||||
if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
|
|
||||||
exe 'command! -bar -bang -nargs=0 -complete=customlist,fugitive#CompleteObject Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
|
||||||
\ '|echohl WarningMSG|echo ":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 -complete=customlist,fugitive#CompleteObject Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
|
|
||||||
\ '|echohl WarningMSG|echo ":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>])'
|
|
||||||
\ '|echohl WarningMSG|echo ":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>])'
|
|
||||||
\ '|echohl WarningMSG|echo ":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>])'
|
|
||||||
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>])'
|
|
||||||
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echo ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if get(g:, 'fugitive_no_maps')
|
if get(g:, 'fugitive_no_maps')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|||||||
+4
-4
@@ -7,8 +7,9 @@ syn spell notoplevel
|
|||||||
|
|
||||||
syn include @fugitiveDiff syntax/diff.vim
|
syn include @fugitiveDiff syntax/diff.vim
|
||||||
|
|
||||||
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
|
syn match fugitiveHeader /^[A-Z][a-z][^:]*:/
|
||||||
syn match fugitiveBareHeader /^Bare:/
|
syn match fugitiveHeader /^Head:/ nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
|
||||||
|
syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveSymbolicRef skipwhite
|
||||||
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
|
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
|
||||||
syn match fugitiveHelpTag /\S\+/ contained
|
syn match fugitiveHelpTag /\S\+/ contained
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ syn match fugitiveSymbolicRef /\.\@!\%(\.\.\@!\|[^[:space:][:cntrl:]\:.]\)\+\.\@
|
|||||||
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
|
syn match fugitiveHash /^\x\{4,\}\S\@!/ contained containedin=@fugitiveSection
|
||||||
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
|
syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
|
||||||
|
|
||||||
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=@fugitiveDiff containedin=@fugitiveSection fold
|
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
|
||||||
|
|
||||||
for s:section in ['Untracked', 'Unstaged', 'Staged']
|
for s:section in ['Untracked', 'Unstaged', 'Staged']
|
||||||
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
|
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
|
||||||
@@ -36,7 +37,6 @@ for s:section in ['Untracked', 'Unstaged', 'Staged']
|
|||||||
endfor
|
endfor
|
||||||
unlet s:section
|
unlet s:section
|
||||||
|
|
||||||
hi def link fugitiveBareHeader fugitiveHeader
|
|
||||||
hi def link fugitiveHelpHeader fugitiveHeader
|
hi def link fugitiveHelpHeader fugitiveHeader
|
||||||
hi def link fugitiveHeader Label
|
hi def link fugitiveHeader Label
|
||||||
hi def link fugitiveHelpTag Tag
|
hi def link fugitiveHelpTag Tag
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax") || !exists("*FugitiveGitDir")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user