diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index c89c39a..3e6bd62 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -458,6 +458,12 @@ function! s:TreeChomp(...) abort throw 'fugitive: error running `' . cmd . '`: ' . out endfunction +function! s:EchoExec(...) abort + echo call('s:ChompError', a:000)[0] + call fugitive#ReloadStatus(-1, 1) + return 'checktime' +endfunction + function! fugitive#Head(...) abort let dir = a:0 > 1 ? a:2 : s:Dir() if empty(dir) || !filereadable(fugitive#Find('.git/HEAD', dir)) @@ -1791,6 +1797,7 @@ function! fugitive#BufReadStatus() abort exe "xnoremap " nowait "s :execute Do('Stage',1)" exe "nnoremap " nowait "u :execute Do('Unstage',0)" exe "xnoremap " nowait "u :execute Do('Unstage',1)" + nnoremap U :exe EchoExec('reset', '-q') nnoremap gu :exe StageJump(v:count, 'Unstaged') nnoremap gU :exe StageJump(v:count, 'Untracked') nnoremap gs :exe StageJump(v:count, 'Staged') @@ -1819,7 +1826,6 @@ function! fugitive#BufReadStatus() abort endif exe 'nnoremap ' s:nowait "gq :if bufnr('$') == 1quitelsebdeleteendif" nnoremap R :echohl WarningMsgecho 'Reloading is automatic. Use :e to force'echohl NONE - nnoremap U :echoerr 'Changed to X' nnoremap g :echoerr 'Changed to X' xnoremap g :echoerr 'Changed to X' nnoremap X :execute StageDelete(line('.'),v:count) diff --git a/doc/fugitive.txt b/doc/fugitive.txt index 02e0d34..b02ba1e 100644 --- a/doc/fugitive.txt +++ b/doc/fugitive.txt @@ -249,6 +249,9 @@ u Unstage (reset) the file or hunk under the cursor. *fugitive_-* - Stage or unstage the file or hunk under the cursor. + *fugitive_U* +U Unstage everything. + *fugitive_X* X Discard the change under the cursor. This uses `checkout` or `clean` under the hood. A command is