From 755554bb3c44944f70f4b2048acf0c69261782ac Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 18 Feb 2019 15:04:31 -0500 Subject: [PATCH] Sort untracked files before unstaged files --- autoload/fugitive.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 83dfb0f..0e6cedb 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -1408,7 +1408,7 @@ function! fugitive#BufReadStatus() abort endif let b:fugitive_status = {'Staged': {}, 'Unstaged': {}} - let [staged, unstaged] = [[], []] + let [staged, unstaged, untracked] = [[], [], []] let i = 0 while i < len(output) let line = output[i] @@ -1426,11 +1426,15 @@ function! fugitive#BufReadStatus() abort call add(staged, {'type': 'File', 'status': line[0], 'filename': files}) let b:fugitive_status['Staged'][files] = line[0] endif - if line[1] !~# '[ !#]' + if line[1] =~# '?' + call add(untracked, {'type': 'File', 'status': line[1], 'filename': files}) + let b:fugitive_status['Unstaged'][files] = line[1] + elseif line[1] !~# '[ !#]' call add(unstaged, {'type': 'File', 'status': line[1], 'filename': files}) let b:fugitive_status['Unstaged'][files] = line[1] endif endwhile + let unstaged = extend(untracked, unstaged) for dict in staged let b:fugitive_status['Staged'][dict.filename] = dict.status