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 6d011f1ea513a2d3e332d9393ddd41738018bcb1 (tree)
parent 726fdf1c94a739cb5a989da599703344021cd9cd
Author: Tim Pope <code@tpope.net>
Date:   Sun,  5 Jan 2020 00:36:36 -0500

Improve :Gclog window title

Diffstat:
Mautoload/fugitive.vim | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -3953,32 +3953,36 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort endif if a:line1 == 0 && a:count let path = fugitive#Path(bufname(a:count), '/', dir) + let titlepre = ':0,' . a:count elseif a:count >= 0 let path = fugitive#Path(@%, '/', dir) + let titlepre = a:count == 0 ? ':0,' . bufnr('') : ':' else - let path = '' + let titlepre = ':' + let path = '' endif let range = '' - let extra = [] + let extra_args = [] + let extra_paths = [] let state = {'context': 'init', 'child_found': 0, 'queue': [], 'follow': 0} if path =~# '^/\.git\%(/\|$\)\|^$' let path = '' elseif a:line1 == 0 let range = "0," . (a:count ? a:count : bufnr('')) - let extra = ['.' . path] + let extra_paths = ['.' . path] if (empty(paths) || paths ==# ['--']) && !s:HasOpt(args, '--no-follow') let state.follow = 1 if !s:HasOpt(args, '--follow') - call insert(args, '--follow') + call insert(extra_args, '--follow') endif if !s:HasOpt(args, '--summary') - call insert(args, '--summary') + call insert(extra_args, '--summary') let state.ignore_summary = 1 endif endif elseif a:count > 0 if !s:HasOpt(args, '--merges', '--no-merges') - call insert(args, '--no-merges') + call insert(extra_args, '--no-merges') endif call add(args, '-L' . a:line1 . ',' . a:count . ':' . path[1:-1]) endif @@ -3988,7 +3992,7 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort call add(args, owner) endif endif - if empty(extra) + if empty(extra_paths) let path = '' endif if s:HasOpt(args, '-g', '--walk-reflogs') @@ -4004,10 +4008,10 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort endif call extend(cmd, \ ['--no-color', '--no-ext-diff', '--pretty=format:fugitive ' . format] + - \ args + paths + extra) + \ args + extra_args + paths + extra_paths) let state.target = path - let title = (listnr < 0 ? ':Gclog ' : ':Gllog ') . s:fnameescape(args + paths) - if empty(paths + extra) && empty(a:type) && len(s:Relative('/')) + let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths) + if empty(paths + extra_paths) && empty(a:type) && len(s:Relative('/')) let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after endif return s:QuickfixStream(listnr, title, s:UserCommandList(dir) + cmd, !a:bang, s:function('s:LogParse'), state, dir) . after