From b92de0138d66c54be818f87138750fe5b680355a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 22 Jul 2019 14:34:54 -0400 Subject: [PATCH] Provide rudimentary stash mappings --- autoload/fugitive.vim | 11 ++++++++++- doc/fugitive.txt | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c8b8578..18cc924 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -487,7 +487,7 @@ function! fugitive#RevParse(rev, ...) abort if !exec_error && hash =~# '^\x\{40,\}$' return hash endif - call s:throw('rev-parse '.a:rev.': '.hash) + throw 'vim-fugitive: rev-parse '.a:rev.': '.hash endfunction function! s:ConfigTimestamps(dir, dict) abort @@ -4898,6 +4898,15 @@ function! fugitive#MapJumps(...) abort nnoremap cA :Gcommit --edit --squash==SquashArgument() nnoremap c? :help fugitive_c + nnoremap cz :G stash + nnoremap cz :G stash + nnoremap cza :exe EchoExec(['stash', 'apply', '--quiet', 'stash@{' . v:count . '}']) + nnoremap czp :exe EchoExec(['stash', 'pop', '--quiet', 'stash@{' . v:count . '}']) + nnoremap czv :exe 'Gedit' fugitive#RevParse('stash@{' . v:count . '}') + nnoremap czw :exe EchoExec(['stash', '--keep-index'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : [])) + nnoremap czz :exe EchoExec(['stash'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : [])) + nnoremap cz? :help fugitive_cz + nnoremap r- :Grebase - nnoremap r :Grebase nnoremap r :Grebase diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 357cd6c..6437902 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -384,6 +384,21 @@ cA Create a `squash!` commit for the commit under the c? Show this help. + *fugitive_cz* +Stash mappings ~ + +czz Push stash. Pass a [count] of 1 to add + `--include-untracked` or 2 to add `--all`. + +czw Push stash of worktree. Like `czz` with + `--include-index`. + +cza Apply topmost stash, or stash@{count}. + +czp Pop topmost stash, or stash@{count}. + +cz? Show this help. + *fugitive_r* Rebase mappings ~