2 Commits

Author SHA1 Message Date
KSR-Yasuda
a7a79e95b5 Merge 4767a6caa8 into 174230d6a7 2024-12-30 01:34:35 +00:00
yasuda
4767a6caa8 Allow ++curwin option to come later 2024-08-07 14:47:50 +09:00
2 changed files with 29 additions and 45 deletions

View File

@@ -4,6 +4,11 @@
" The functions contained within this file are for internal use only. For the
" official API, see the commented functions in plugin/fugitive.vim.
if exists('g:autoloaded_fugitive')
finish
endif
let g:autoloaded_fugitive = 1
" Section: Utility
function! s:function(name) abort
@@ -2066,8 +2071,6 @@ function! s:Expand(rev, ...) abort
endif
elseif s:Slash(a:rev) =~# '^\a\a\+://'
let file = substitute(a:rev, '\\\@<!\%(#\a\|%\x\x\)', '\\&', 'g')
elseif a:rev =~# '^:[!#%$]'
let file = ':0' . a:rev
else
let file = a:rev
endif
@@ -2694,7 +2697,7 @@ function! s:MapStatus() abort
call s:MapMotion('gP', "exe <SID>StageJump(v:count, 'Unpulled')")
call s:MapMotion('gr', "exe <SID>StageJump(v:count, 'Rebasing')")
call s:Map('n', 'C', ":echoerr 'fugitive: C has been removed in favor of cc'<CR>", '<silent><unique>')
call s:Map('n', 'a', ":echoerr 'fugitive: a has been removed in favor of s'<CR>", '<silent><unique>')
call s:Map('n', 'a', ":<C-U>execute <SID>Do('Toggle',0)<CR>", '<silent>')
call s:Map('n', 'i', ":<C-U>execute <SID>NextExpandedHunk(v:count1)<CR>", '<silent>')
call s:Map('n', "=", ":<C-U>execute <SID>StageInline('toggle',line('.'),v:count)<CR>", '<silent>')
call s:Map('n', "<", ":<C-U>execute <SID>StageInline('hide', line('.'),v:count)<CR>", '<silent>')
@@ -2937,34 +2940,20 @@ function! s:StatusRender(stat) abort
endif
let sequencing = []
try
let sequencer_todo = reverse(readfile(fugitive#Find('.git/sequencer/todo', dir)))
catch
endtry
if exists('sequencer_todo')
for line in sequencer_todo
if filereadable(fugitive#Find('.git/sequencer/todo', dir))
for line in reverse(readfile(fugitive#Find('.git/sequencer/todo', dir)))
let match = matchlist(line, '^\(\l\+\)\s\+\(\x\{4,\}\)\s\+\(.*\)')
if len(match) && match[1] !~# 'exec\|merge\|label'
call add(sequencing, {'type': 'Rebase', 'status': get(s:rebase_abbrevs, match[1], match[1]), 'commit': match[2], 'subject': match[3]})
endif
endfor
else
try
let merge_msg = get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')
catch
endtry
endif
if exists('merge_msg')
elseif filereadable(fugitive#Find('.git/MERGE_MSG', dir))
if filereadable(fugitive#Find('.git/CHERRY_PICK_HEAD', dir))
let pick_head = fugitive#Execute(['rev-parse', '--short', 'CHERRY_PICK_HEAD', '--'], dir).stdout[0]
if !empty(pick_head)
call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': merge_msg})
endif
call add(sequencing, {'type': 'Rebase', 'status': 'pick', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')})
elseif filereadable(fugitive#Find('.git/REVERT_HEAD', dir))
let pick_head = fugitive#Execute(['rev-parse', '--short', 'REVERT_HEAD', '--'], dir).stdout[0]
if !empty(pick_head)
call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': merge_msg})
endif
call add(sequencing, {'type': 'Rebase', 'status': 'revert', 'commit': pick_head, 'subject': get(readfile(fugitive#Find('.git/MERGE_MSG', dir)), 0, '')})
endif
endif
@@ -2987,7 +2976,7 @@ function! s:StatusRender(stat) abort
endif
call s:AddSection(to, 'Rebasing ' . rebasing_head, rebasing)
call s:AddSection(to, get(get(sequencing, 0, {}), 'status', '') ==# 'revert' ? 'Reverting' : 'Cherry Picking', sequencing)
call s:AddSection(to, get(get(sequencing, 0, {}), 'tous', '') ==# 'revert' ? 'Reverting' : 'Cherry Picking', sequencing)
call s:AddSection(to, 'Untracked', untracked)
call s:AddDiffSection(to, stat, 'Unstaged', unstaged)
call s:AddDiffSection(to, stat, 'Staged', staged)
@@ -3802,14 +3791,17 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort
exe s:DirCheck(dir)
endif
let config = copy(fugitive#Config(dir))
let curwin = a:arg =~# '^++curwin\>' || !a:line2
let [args, after] = s:SplitExpandChain(substitute(a:arg, '^++curwin\>\s*', '', ''), s:Tree(dir))
let curwin = !a:line2
let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir))
let flags = []
let pager = -1
let explicit_pathspec_option = 0
let did_expand_alias = 0
while len(args)
if args[0] ==# '-c' && len(args) > 1
if args[0] ==# '++curwin'
let curwin = curwin || v:true
call remove(args, 0)
elseif args[0] ==# '-c' && len(args) > 1
call extend(flags, remove(args, 0, 1))
elseif args[0] =~# '^-p$\|^--paginate$'
let pager = 2
@@ -5202,7 +5194,7 @@ function! s:DoToggleHeadHeader(value) abort
endfunction
function! s:DoToggleHelpHeader(value) abort
exe 'help fugitive-maps'
exe 'help fugitive-map'
endfunction
function! s:DoStagePushHeader(value) abort
@@ -7446,12 +7438,9 @@ function! s:BrowserOpen(url, mods, echo_copy) abort
else
if !exists('g:loaded_netrw')
runtime! autoload/netrw.vim
runtime! autoload/netrw/os.vim
endif
if exists('*netrw#Open')
return 'echo '.string(url).'|' . mods . 'call netrw#Open('.string(url).')'
elseif exists('*netrw#os#Open')
return 'echo '.string(url).'|' . mods . 'call netrw#os#Open('.string(url).')'
elseif exists('*netrw#BrowseX')
return 'echo '.string(url).'|' . mods . 'call netrw#BrowseX('.string(url).', 0)'
elseif exists('*netrw#NetrwBrowseX')
@@ -7931,7 +7920,6 @@ 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)
@@ -7941,8 +7929,7 @@ 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', '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', 'cA', ':<C-U>Git commit --edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'c?', ':<C-U>help fugitive_c<CR>', '<silent>', ft)
exe s:Map('n', 'cr<Space>', ':Git revert<Space>', '', ft)
@@ -8044,8 +8031,8 @@ function! fugitive#MapJumps(...) abort
call s:MapMotion(']]', 'exe <SID>NextSection(v:count1)')
call s:MapMotion('[]', 'exe <SID>PreviousSectionEnd(v:count1)')
call s:MapMotion('][', 'exe <SID>NextSectionEnd(v:count1)')
call s:Map('no', '*', '<SID>PatchSearchExpr(0)', '<expr>')
call s:Map('no', '#', '<SID>PatchSearchExpr(1)', '<expr>')
call s:Map('nxo', '*', '<SID>PatchSearchExpr(0)', '<expr>')
call s:Map('nxo', '#', '<SID>PatchSearchExpr(1)', '<expr>')
endif
call s:Map('n', 'S', ':<C-U>echoerr "Use gO"<CR>', '<silent><unique>')
call s:Map('n', 'dq', ":<C-U>call fugitive#DiffClose()<CR>", '<silent>')
@@ -8061,8 +8048,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-maps<CR>", '<silent>')
call s:Map('n', '<F1>', ":<C-U>help fugitive-maps<CR>", '<silent>')
call s:Map('n', 'g?', ":<C-U>help fugitive-map<CR>", '<silent>')
call s:Map('n', '<F1>', ":<C-U>help fugitive-map<CR>", '<silent>')
endif
let old_browsex = maparg('<Plug>NetrwBrowseX', 'n')

View File

@@ -465,18 +465,15 @@ 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.
cW Create an `amend!` commit that rewords the commit
under the cursor.
cvc Create a commit with -v.
cva Amend the last commit with -v
cf Create a `fixup!` commit for the commit under the
cursor.
@@ -490,8 +487,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.
cn Create a `squash!` commit for the commit under the
(formerly cA) cursor and edit the message.
cA Create a `squash!` commit for the commit under the
cursor and edit the message.
c<Space> Populate command line with ":Git commit ".