Provide rudimentary stash mappings

This commit is contained in:
Tim Pope 2019-07-22 14:34:54 -04:00
parent d95cc5f8c2
commit b92de0138d
2 changed files with 25 additions and 1 deletions

View File

@ -487,7 +487,7 @@ function! fugitive#RevParse(rev, ...) abort
if !exec_error && hash =~# '^\x\{40,\}$' if !exec_error && hash =~# '^\x\{40,\}$'
return hash return hash
endif endif
call s:throw('rev-parse '.a:rev.': '.hash) throw 'vim-fugitive: rev-parse '.a:rev.': '.hash
endfunction endfunction
function! s:ConfigTimestamps(dir, dict) abort function! s:ConfigTimestamps(dir, dict) abort
@ -4898,6 +4898,15 @@ function! fugitive#MapJumps(...) abort
nnoremap <buffer> cA :<C-U>Gcommit --edit --squash=<C-R>=<SID>SquashArgument()<CR> nnoremap <buffer> cA :<C-U>Gcommit --edit --squash=<C-R>=<SID>SquashArgument()<CR>
nnoremap <buffer> <silent> c? :<C-U>help fugitive_c<CR> nnoremap <buffer> <silent> c? :<C-U>help fugitive_c<CR>
nnoremap <buffer> cz<Space> :G stash<Space>
nnoremap <buffer> cz<CR> :G stash<CR>
nnoremap <buffer> <silent> cza :<C-U>exe <SID>EchoExec(['stash', 'apply', '--quiet', 'stash@{' . v:count . '}'])<CR>
nnoremap <buffer> <silent> czp :<C-U>exe <SID>EchoExec(['stash', 'pop', '--quiet', 'stash@{' . v:count . '}'])<CR>
nnoremap <buffer> <silent> czv :<C-U>exe 'Gedit' fugitive#RevParse('stash@{' . v:count . '}')<CR>
nnoremap <buffer> <silent> czw :<C-U>exe <SID>EchoExec(['stash', '--keep-index'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : []))<CR>
nnoremap <buffer> <silent> czz :<C-U>exe <SID>EchoExec(['stash'] + (v:count > 1 ? ['--all'] : v:count ? ['--include-untracked'] : []))<CR>
nnoremap <buffer> <silent> cz? :<C-U>help fugitive_cz<CR>
nnoremap <buffer> r- :Grebase - nnoremap <buffer> r- :Grebase -
nnoremap <buffer> r<Space> :Grebase<Space> nnoremap <buffer> r<Space> :Grebase<Space>
nnoremap <buffer> r<CR> :Grebase<CR> nnoremap <buffer> r<CR> :Grebase<CR>

View File

@ -384,6 +384,21 @@ cA Create a `squash!` commit for the commit under the
c? Show this help. 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* *fugitive_r*
Rebase mappings ~ Rebase mappings ~