From 35d7590354129c342077174acc04c9b941df1e04 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 4 Aug 2019 01:15:35 -0400 Subject: [PATCH] Provide s/u mappings on commits I need to figure out the big picture push story before I can document the push maps. --- autoload/fugitive.vim | 28 ++++++++++++++++++++++++---- doc/fugitive.txt | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2ecaed4..291b953 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3047,7 +3047,7 @@ function! s:DoToggleHeadHeader(value) abort call search('\C^index$', 'wc') endfunction -function! s:DoToggleUnpushedHeading(heading) abort +function! s:DoStageUnpushedHeading(heading) abort let remote = matchstr(a:heading, 'to \zs[^/]\+\ze/') if empty(remote) let remote = '.' @@ -3056,7 +3056,11 @@ function! s:DoToggleUnpushedHeading(heading) abort call feedkeys(':Gpush ' . remote . ' ' . 'HEAD:' . branch) endfunction -function! s:DoToggleUnpushed(record) abort +function! s:DoToggleUnpushedHeading(heading) abort + return s:DoStageUnpushedHeading(a:heading) +endfunction + +function! s:DoStageUnpushed(record) abort let remote = matchstr(a:record.heading, 'to \zs[^/]\+\ze/') if empty(remote) let remote = '.' @@ -3065,12 +3069,28 @@ function! s:DoToggleUnpushed(record) abort call feedkeys(':Gpush ' . remote . ' ' . a:record.commit . ':' . branch) endfunction -function! s:DoToggleUnpulledHeading(heading) abort +function! s:DoToggleUnpushed(record) abort + return s:DoStageUnpushed(a:record) +endfunction + +function! s:DoUnstageUnpulledHeading(heading) abort call feedkeys(':Grebase') endfunction +function! s:DoToggleUnpulledHeading(heading) abort + call s:DoUnstageUnpulledHeading(a:heading) +endfunction + +function! s:DoUnstageUnpulled(record) abort + call feedkeys(':Grebase ' . a:record.commit . '^') +endfunction + function! s:DoToggleUnpulled(record) abort - call feedkeys(':Grebase ' . a:record.commit) + call s:DoUnstageUnpulled(a:record) +endfunction + +function! s:DoUnstageUnpushed(record) abort + call s:DoUnstageUnpulled(a:record) endfunction function! s:DoToggleStagedHeading(...) abort diff --git a/doc/fugitive.txt b/doc/fugitive.txt index dada282..3d2157b 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -483,7 +483,7 @@ cz? Show this help. Rebase mappings ~ ri Perform an interactive rebase. Uses ancestor of - commit under cursor as upstream if available. +u commit under cursor as upstream if available. rf Perform an autosquash rebase without editing the todo list. Uses ancestor of commit under cursor as