From 5e5ce843ea923a01609695df486e21e91de16f47 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 24 Mar 2021 18:56:49 -0400 Subject: [PATCH] Automatically mkdir when editing .git/info/exclude --- autoload/fugitive.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 888d2b4..112d2f9 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3807,6 +3807,15 @@ function! s:StageIgnore(lnum1, lnum2, count) abort call extend(paths, info.relative) endfor call map(paths, '"/" . v:val') + if !a:0 + let dir = fugitive#Find('.git/info/') + if !isdirectory(dir) + try + call mkdir(dir) + catch + endtry + endif + endif exe 'Gsplit' (a:count ? '.gitignore' : '.git/info/exclude') let last = line('$') if last == 1 && empty(getline(1))