5 Commits

Author SHA1 Message Date
KSR-Yasuda
3aded68f08 Merge 4767a6caa8 into d74a7cff4c 2025-01-24 11:30:46 +01:00
Tim Pope
d74a7cff4c Add cW map as commit --fixup=reword:
References: https://github.com/tpope/vim-fugitive/pull/2369
2025-01-20 01:35:07 -05:00
Tim Pope
f4e8453ce7 Replace cA map with cn
Following Magit's lead.

References: https://github.com/tpope/vim-fugitive/pull/2369
2025-01-20 01:35:07 -05:00
Tim Pope
de42a732ee Fix help tag for g?
References: https://github.com/tpope/vim-fugitive/issues/2320
2025-01-20 01:21:42 -05:00
yasuda
4767a6caa8 Allow ++curwin option to come later 2024-08-07 14:47:50 +09:00
2 changed files with 20 additions and 12 deletions

View File

@@ -3791,14 +3791,17 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort
exe s:DirCheck(dir) exe s:DirCheck(dir)
endif endif
let config = copy(fugitive#Config(dir)) let config = copy(fugitive#Config(dir))
let curwin = a:arg =~# '^++curwin\>' || !a:line2 let curwin = !a:line2
let [args, after] = s:SplitExpandChain(substitute(a:arg, '^++curwin\>\s*', '', ''), s:Tree(dir)) let [args, after] = s:SplitExpandChain(a:arg, s:Tree(dir))
let flags = [] let flags = []
let pager = -1 let pager = -1
let explicit_pathspec_option = 0 let explicit_pathspec_option = 0
let did_expand_alias = 0 let did_expand_alias = 0
while len(args) 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)) call extend(flags, remove(args, 0, 1))
elseif args[0] =~# '^-p$\|^--paginate$' elseif args[0] =~# '^-p$\|^--paginate$'
let pager = 2 let pager = 2
@@ -5191,7 +5194,7 @@ function! s:DoToggleHeadHeader(value) abort
endfunction endfunction
function! s:DoToggleHelpHeader(value) abort function! s:DoToggleHelpHeader(value) abort
exe 'help fugitive-map' exe 'help fugitive-maps'
endfunction endfunction
function! s:DoStagePushHeader(value) abort function! s:DoStagePushHeader(value) abort
@@ -7917,6 +7920,7 @@ function! s:MapGitOps(is_ftplugin) abort
exe s:Map('n', 'cc', ':<C-U>Git commit<CR>', '<silent>', ft) 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', '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 --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', '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', '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) exe s:Map('n', 'cRa', ':<C-U>Git commit --reset-author --amend<CR>', '<silent>', ft)
@@ -7926,7 +7930,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', '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>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', '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', 'c?', ':<C-U>help fugitive_c<CR>', '<silent>', ft)
exe s:Map('n', 'cr<Space>', ':Git revert<Space>', '', ft) exe s:Map('n', 'cr<Space>', ':Git revert<Space>', '', ft)
@@ -8045,8 +8050,8 @@ function! fugitive#MapJumps(...) abort
call s:Map('n', '.', ":<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>") 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('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', 'g?', ":<C-U>help fugitive-maps<CR>", '<silent>')
call s:Map('n', '<F1>', ":<C-U>help fugitive-map<CR>", '<silent>') call s:Map('n', '<F1>', ":<C-U>help fugitive-maps<CR>", '<silent>')
endif endif
let old_browsex = maparg('<Plug>NetrwBrowseX', 'n') let old_browsex = maparg('<Plug>NetrwBrowseX', 'n')

View File

@@ -465,15 +465,18 @@ Commit maps ~
cc Create a commit. cc Create a commit.
cvc Create a commit with -v.
ca Amend the last commit and edit the message. 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. ce Amend the last commit without editing the message.
cw Reword the last commit. cw Reword the last commit.
cvc Create a commit with -v. cW Create an `amend!` commit that rewords the commit
under the cursor.
cva Amend the last commit with -v
cf Create a `fixup!` commit for the commit under the cf Create a `fixup!` commit for the commit under the
cursor. 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 cS Create a `squash!` commit for the commit under the
cursor and immediately rebase it. cursor and immediately rebase it.
cA Create a `squash!` commit for the commit under the cn Create a `squash!` commit for the commit under the
cursor and edit the message. (formerly cA) cursor and edit the message.
c<Space> Populate command line with ":Git commit ". c<Space> Populate command line with ":Git commit ".