From 786d7a74ed74ffb94c99ff93461d532b949ee7b1 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Mon, 24 Jun 2019 08:47:54 -0500 Subject: [PATCH] Set a filetype only if unset or wrong It's possible that vim's built-in will notice the comment lines and set a filetype of `conf`. This makes using `setfiletype` impractical since `setfiletype` does not override an already set file type. --- plugin/rhubarb.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/rhubarb.vim b/plugin/rhubarb.vim index 2ba3b4c..69cb286 100644 --- a/plugin/rhubarb.vim +++ b/plugin/rhubarb.vim @@ -44,7 +44,10 @@ augroup rhubarb \ if expand('%') ==# '' && &previewwindow && pumvisible() && getbufvar('#', '&omnifunc') ==# 'rhubarb#omnifunc' | \ setlocal nolist linebreak filetype=markdown | \ endif - autocmd BufNewFile,BufRead *.git/{PULLREQ_EDIT,ISSUE_EDIT,RELEASE_EDIT}MSG set ft=gitcommit + autocmd BufNewFile,BufRead *.git/{PULLREQ_EDIT,ISSUE_EDIT,RELEASE_EDIT}MSG + \ if &ft ==# '' || &ft ==# 'conf' | + \ set ft=gitcommit + \ endif augroup END if !exists('g:fugitive_browse_handlers')