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.
This commit is contained in:
Matt Rogers
2019-06-24 08:47:54 -05:00
committed by Tim Pope
parent 70713ca031
commit 786d7a74ed

View File

@@ -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')