mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 12:33:47 -05:00
Stop early when file is in .git directory.
This commit is contained in:
@@ -9,8 +9,14 @@ function! gitgutter#utility#warn(message)
|
||||
let v:warningmsg = a:message
|
||||
endfunction
|
||||
|
||||
" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't.
|
||||
" This function does not and should not make any system calls.
|
||||
function! gitgutter#utility#is_active()
|
||||
return g:gitgutter_enabled && gitgutter#utility#exists_file()
|
||||
return g:gitgutter_enabled && gitgutter#utility#exists_file() && gitgutter#utility#not_git_dir()
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#not_git_dir()
|
||||
return gitgutter#utility#full_path_to_directory_of_file() !~ '\.git\([/\\].*\)\?$'
|
||||
endfunction
|
||||
|
||||
" A replacement for the built-in `shellescape(arg)`.
|
||||
@@ -51,6 +57,10 @@ function! gitgutter#utility#extension()
|
||||
return fnamemodify(s:file, ':e')
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#full_path_to_directory_of_file()
|
||||
return fnamemodify(s:file, ':p:h')
|
||||
endfunction
|
||||
|
||||
function! gitgutter#utility#directory_of_file()
|
||||
return fnamemodify(s:file, ':h')
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user