mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 07:13:52 -05:00
Remove Git dir checks on FileType events
In order for these checks to work, :filetype on must be invoked *after* Fugitive is loaded. Otherwise, the FileType event triggers before FugitiveDetect() is called. These file types are used almost exclusively inside of Git repositories, and in the rare case they are not, we're not doing anything particularly intrusive, so dropping the conditional should have little practical impact. An exception is fugitive#MapJumps(), which is designed to be used exclusively with historical buffers, the status buffer, and captured :Git output, so let's lock it down to those particular workflows.
This commit is contained in:
@@ -2273,7 +2273,10 @@ function! s:TempReadPost(file) abort
|
||||
if has_key(s:temp_files, s:cpath(a:file))
|
||||
let dict = s:temp_files[s:cpath(a:file)]
|
||||
setlocal nobuflisted
|
||||
if has_key(dict, 'filetype') && dict.filetype !=# &l:filetype
|
||||
if get(dict, 'filetype', '') ==# 'git'
|
||||
call fugitive#MapJumps()
|
||||
endif
|
||||
if has_key(dict, 'filetype')
|
||||
let &l:filetype = dict.filetype
|
||||
endif
|
||||
setlocal foldmarker=<<<<<<<,>>>>>>>
|
||||
@@ -6117,6 +6120,9 @@ endfunction
|
||||
|
||||
function! s:StatusCfile(...) abort
|
||||
let tree = s:Tree()
|
||||
if empty(tree)
|
||||
return ['']
|
||||
endif
|
||||
let lead = s:cpath(tree, getcwd()) ? './' : tree . '/'
|
||||
let info = s:StageInfo()
|
||||
let line = getline('.')
|
||||
@@ -6146,6 +6152,9 @@ endfunction
|
||||
|
||||
function! s:MessageCfile(...) abort
|
||||
let tree = s:Tree()
|
||||
if empty(tree)
|
||||
return ''
|
||||
endif
|
||||
let lead = s:cpath(tree, getcwd()) ? './' : tree . '/'
|
||||
if getline('.') =~# '^.\=\trenamed:.* -> '
|
||||
return lead . matchstr(getline('.'),' -> \zs.*')
|
||||
@@ -6172,6 +6181,9 @@ function! fugitive#MessageCfile() abort
|
||||
endfunction
|
||||
|
||||
function! s:cfile() abort
|
||||
if empty(FugitiveGitDir())
|
||||
return []
|
||||
endif
|
||||
try
|
||||
let myhash = s:DirRev(@%)[1]
|
||||
if len(myhash)
|
||||
|
||||
Reference in New Issue
Block a user