motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 511e32114bc68cc8fa959d44dda429f1016874bc (tree)
parent 0cc3beeae9b46c947b663779f8fa2eb2de23a7c0
Author: Tim Pope <code@tpope.net>
Date:   Tue,  6 Aug 2019 15:39:01 -0400

Swap gu and gU

Diffstat:
Mautoload/fugitive.vim | 14++++++++++----
Mdoc/fugitive.txt | 5+++--
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -1821,8 +1821,8 @@ function! fugitive#BufReadStatus() abort exe "nnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>Do('Unstage',0)<CR>" exe "xnoremap <buffer> <silent>" nowait "u :<C-U>execute <SID>Do('Unstage',1)<CR>" nnoremap <buffer> <silent> U :exe <SID>EchoExec('reset', '-q')<CR> - call s:MapEx('gu', "exe <SID>StageJump(v:count, 'Unstaged')") - call s:MapEx('gU', "exe <SID>StageJump(v:count, 'Untracked')") + call s:MapEx('gu', "exe <SID>StageJump(v:count, 'Untracked', 'Unstaged')") + call s:MapEx('gU', "exe <SID>StageJump(v:count, 'Unstaged', 'Untracked')") call s:MapEx('gs', "exe <SID>StageJump(v:count, 'Staged')") call s:MapEx('gp', "exe <SID>StageJump(v:count, 'Unpushed')") call s:MapEx('gP', "exe <SID>StageJump(v:count, 'Unpulled')") @@ -2248,13 +2248,19 @@ function! s:StatusCommand(line1, line2, range, count, bang, mods, reg, arg, args endfunction function! s:StageJump(offset, section, ...) abort - let line = search('^' . a:section, 'nw') + let line = search('^\%(' . a:section . '\)', 'nw') + if !line && a:0 + let line = search('^\%(' . a:1 . '\)', 'nw') + endif if line exe line if a:offset for i in range(a:offset) call search(s:file_pattern . '\|^$') - if empty(line('.')) + if empty(getline('.')) && a:0 && getline(line('.') + 1) =~# '^\%(' . a:1 . '\)' + call search(s:file_pattern . '\|^$') + endif + if empty(getline('.')) return '' endif endfor diff --git a/doc/fugitive.txt b/doc/fugitive.txt @@ -377,10 +377,11 @@ i Jump to the next file or hunk, expanding inline diffs ][ Jump [count] section ends forward. *fugitive_gu* -gu Jump to file [count] in the "Unstaged" section. +gu Jump to file [count] in the "Untracked" or "Unstaged" + section. *fugitive_gU* -gU Jump to file [count] in the "Untracked" section. +gU Jump to file [count] in the "Unstaged" section. *fugitive_gs* gs Jump to file [count] in the "Staged" section.