mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-18 16:45:39 -05:00
Compare commits
5 Commits
0cb2df9e31
...
ad112389b5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad112389b5 | ||
|
|
d74a7cff4c | ||
|
|
f4e8453ce7 | ||
|
|
de42a732ee | ||
|
|
07de0b8d9f |
@@ -2471,6 +2471,17 @@ function! s:CompleteHeads(dir) abort
|
||||
\ sort(s:LinesError([a:dir, 'rev-parse', '--symbolic', '--branches', '--tags', '--remotes'])[0])
|
||||
endfunction
|
||||
|
||||
function! s:SplitRevRange(base, pat)
|
||||
let index = matchend(a:base, a:pat)
|
||||
if index == -1
|
||||
return ['', a:base]
|
||||
endif
|
||||
let pre = a:base[:index - 1]
|
||||
let base = a:base[index:]
|
||||
return [pre, base]
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fugitive#CompleteObject(base, ...) abort
|
||||
let dir = a:0 == 1 ? a:1 : a:0 >= 3 ? a:3 : s:Dir()
|
||||
let tree = s:Tree(dir)
|
||||
@@ -2480,9 +2491,10 @@ function! fugitive#CompleteObject(base, ...) abort
|
||||
let subdir = strpart(cwd, len(tree) + 1) . '/'
|
||||
endif
|
||||
let base = s:Expand(a:base)
|
||||
let [pre, base] = s:SplitRevRange(base, '^[^:]*\/\@<!\.\.\.\=[\/\.]\@!')
|
||||
|
||||
if a:base =~# '^!\d*$' && base !~# '^!'
|
||||
return [base]
|
||||
return [pre . base]
|
||||
elseif base =~# '^\.\=/\|^:(' || base !~# ':'
|
||||
let results = []
|
||||
if base =~# '^refs/'
|
||||
@@ -2498,6 +2510,7 @@ function! fugitive#CompleteObject(base, ...) abort
|
||||
let results += s:FilterEscape(heads, fnameescape(base))
|
||||
endif
|
||||
let results += a:0 == 1 || a:0 >= 3 ? fugitive#CompletePath(base, 0, '', dir, a:0 >= 4 ? a:4 : tree) : fugitive#CompletePath(base)
|
||||
let results = map(results, 'pre . v:val')
|
||||
return results
|
||||
|
||||
elseif base =~# '^:'
|
||||
@@ -2517,7 +2530,7 @@ function! fugitive#CompleteObject(base, ...) abort
|
||||
call map(entries,'s:sub(v:val,"^04.*\\zs$","/")')
|
||||
call map(entries,'parent.s:sub(v:val,".*\t","")')
|
||||
endif
|
||||
return s:FilterEscape(entries, fnameescape(base))
|
||||
return map(s:FilterEscape(entries, fnameescape(base)), 'pre . v:val')
|
||||
endfunction
|
||||
|
||||
function! s:CompleteSub(subcommand, A, L, P, ...) abort
|
||||
@@ -5191,7 +5204,7 @@ function! s:DoToggleHeadHeader(value) abort
|
||||
endfunction
|
||||
|
||||
function! s:DoToggleHelpHeader(value) abort
|
||||
exe 'help fugitive-map'
|
||||
exe 'help fugitive-maps'
|
||||
endfunction
|
||||
|
||||
function! s:DoStagePushHeader(value) abort
|
||||
@@ -7917,6 +7930,7 @@ function! s:MapGitOps(is_ftplugin) abort
|
||||
exe s:Map('n', 'cc', ':<C-U>Git commit<CR>', '<silent>', ft)
|
||||
exe s:Map('n', 'ce', ':<C-U>Git commit --amend --no-edit<CR>', '<silent>', ft)
|
||||
exe s:Map('n', 'cw', ':<C-U>Git commit --amend --only<CR>', '<silent>', ft)
|
||||
exe s:Map('n', 'cW', ':<C-U>Git commit --fixup=reword:<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cva', ':<C-U>tab Git commit -v --amend<CR>', '<silent>', ft)
|
||||
exe s:Map('n', 'cvc', ':<C-U>tab Git commit -v<CR>', '<silent>', ft)
|
||||
exe s:Map('n', 'cRa', ':<C-U>Git commit --reset-author --amend<CR>', '<silent>', ft)
|
||||
@@ -7926,7 +7940,8 @@ function! s:MapGitOps(is_ftplugin) abort
|
||||
exe s:Map('n', 'cF', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --fixup=<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cs', ':<C-U>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cS', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cA', ':<C-U>Git commit --edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cn', ':<C-U>Git commit --edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
|
||||
exe s:Map('n', 'cA', ':<C-U>echoerr "Use cn"<CR>', '<silent><unique>', ft)
|
||||
exe s:Map('n', 'c?', ':<C-U>help fugitive_c<CR>', '<silent>', ft)
|
||||
|
||||
exe s:Map('n', 'cr<Space>', ':Git revert<Space>', '', ft)
|
||||
@@ -8045,8 +8060,8 @@ function! fugitive#MapJumps(...) abort
|
||||
|
||||
call s:Map('n', '.', ":<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>")
|
||||
call s:Map('x', '.', ":<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>")
|
||||
call s:Map('n', 'g?', ":<C-U>help fugitive-map<CR>", '<silent>')
|
||||
call s:Map('n', '<F1>', ":<C-U>help fugitive-map<CR>", '<silent>')
|
||||
call s:Map('n', 'g?', ":<C-U>help fugitive-maps<CR>", '<silent>')
|
||||
call s:Map('n', '<F1>', ":<C-U>help fugitive-maps<CR>", '<silent>')
|
||||
endif
|
||||
|
||||
let old_browsex = maparg('<Plug>NetrwBrowseX', 'n')
|
||||
|
||||
@@ -465,15 +465,18 @@ Commit maps ~
|
||||
|
||||
cc Create a commit.
|
||||
|
||||
cvc Create a commit with -v.
|
||||
|
||||
ca Amend the last commit and edit the message.
|
||||
|
||||
cva Amend the last commit with -v.
|
||||
|
||||
ce Amend the last commit without editing the message.
|
||||
|
||||
cw Reword the last commit.
|
||||
|
||||
cvc Create a commit with -v.
|
||||
|
||||
cva Amend the last commit with -v
|
||||
cW Create an `amend!` commit that rewords the commit
|
||||
under the cursor.
|
||||
|
||||
cf Create a `fixup!` commit for the commit under the
|
||||
cursor.
|
||||
@@ -487,8 +490,8 @@ cs Create a `squash!` commit for the commit under the
|
||||
cS Create a `squash!` commit for the commit under the
|
||||
cursor and immediately rebase it.
|
||||
|
||||
cA Create a `squash!` commit for the commit under the
|
||||
cursor and edit the message.
|
||||
cn Create a `squash!` commit for the commit under the
|
||||
(formerly cA) cursor and edit the message.
|
||||
|
||||
c<Space> Populate command line with ":Git commit ".
|
||||
|
||||
|
||||
Reference in New Issue
Block a user