mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 20:13:46 -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
|
let v:warningmsg = a:message
|
||||||
endfunction
|
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()
|
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
|
endfunction
|
||||||
|
|
||||||
" A replacement for the built-in `shellescape(arg)`.
|
" A replacement for the built-in `shellescape(arg)`.
|
||||||
@@ -51,6 +57,10 @@ function! gitgutter#utility#extension()
|
|||||||
return fnamemodify(s:file, ':e')
|
return fnamemodify(s:file, ':e')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! gitgutter#utility#full_path_to_directory_of_file()
|
||||||
|
return fnamemodify(s:file, ':p:h')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! gitgutter#utility#directory_of_file()
|
function! gitgutter#utility#directory_of_file()
|
||||||
return fnamemodify(s:file, ':h')
|
return fnamemodify(s:file, ':h')
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user