mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
Use capitalized names for official functions
The distinction between "Fugitive" and "fugitive#" functions is whether it will live in the plugin or autoload file, once the separation finally comes to pass.
This commit is contained in:
@@ -160,6 +160,10 @@ function! fugitive#is_git_dir(path) abort
|
||||
\ getftype(path.'commondir') ==# 'file')
|
||||
endfunction
|
||||
|
||||
function! FugitiveIsGitDir(path) abort
|
||||
return fugitive#is_git_dir(a:path)
|
||||
endfunction
|
||||
|
||||
function! fugitive#extract_git_dir(path) abort
|
||||
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
||||
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
||||
@@ -213,6 +217,10 @@ function! fugitive#extract_git_dir(path) abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! FugitiveExtractGitDir(path) abort
|
||||
return fugitive#extract_git_dir(a:path)
|
||||
endfunction
|
||||
|
||||
function! fugitive#detect(path) abort
|
||||
if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$')
|
||||
unlet b:git_dir
|
||||
@@ -261,6 +269,10 @@ function! fugitive#detect(path) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! FugitiveDetect(path) abort
|
||||
return fugitive#detect(a:path)
|
||||
endfunction
|
||||
|
||||
augroup fugitive
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('%:p'))
|
||||
@@ -296,6 +308,10 @@ function! fugitive#repo(...) abort
|
||||
return call('s:repo', a:000)
|
||||
endfunction
|
||||
|
||||
function fugitive#Repo(...) abort
|
||||
return call('s:repo', a:000)
|
||||
endfunction
|
||||
|
||||
function! s:repo_dir(...) dict abort
|
||||
return join([self.git_dir]+a:000,'/')
|
||||
endfunction
|
||||
@@ -555,6 +571,10 @@ function! fugitive#buffer(...) abort
|
||||
return s:buffer(a:0 ? a:1 : '%')
|
||||
endfunction
|
||||
|
||||
function! fugitive#Buffer(...) abort
|
||||
return s:buffer(a:0 ? a:1 : '%')
|
||||
endfunction
|
||||
|
||||
function! s:buffer_getvar(var) dict abort
|
||||
return getbufvar(self['#'],a:var)
|
||||
endfunction
|
||||
@@ -850,6 +870,10 @@ function! fugitive#reload_status() abort
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! fugitive#ReloadStatus() abort
|
||||
return fugitive#reload_status()
|
||||
endfunction
|
||||
|
||||
function! s:stage_info(lnum) abort
|
||||
let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||
let lnum = a:lnum
|
||||
@@ -3080,6 +3104,10 @@ function! fugitive#cfile() abort
|
||||
return pre . s:fnameescape(fugitive#repo().translate(results[0]))
|
||||
endfunction
|
||||
|
||||
function! fugitive#Cfile() abort
|
||||
return fugitive#cfile()
|
||||
endfunction
|
||||
|
||||
" Section: Statusline
|
||||
|
||||
function! s:repo_head_ref() dict abort
|
||||
@@ -3107,6 +3135,14 @@ function! fugitive#statusline(...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! fugitive#Statusline(...) abort
|
||||
return fugitive#statusline()
|
||||
endfunction
|
||||
|
||||
function! FugitiveStatusline(...) abort
|
||||
return fugitive#statusline()
|
||||
endfunction
|
||||
|
||||
function! fugitive#head(...) abort
|
||||
if !exists('b:git_dir')
|
||||
return ''
|
||||
@@ -3115,6 +3151,10 @@ function! fugitive#head(...) abort
|
||||
return s:repo().head(a:0 ? a:1 : 0)
|
||||
endfunction
|
||||
|
||||
function! FugitiveHead(...) abort
|
||||
return fugitive#head(a:0 ? a:1 : 0)
|
||||
endfunction
|
||||
|
||||
augroup fugitive_statusline
|
||||
autocmd!
|
||||
autocmd User Flags call Hoist('buffer', function('fugitive#statusline'))
|
||||
@@ -3165,10 +3205,14 @@ function! fugitive#foldtext() abort
|
||||
return foldtext()
|
||||
endfunction
|
||||
|
||||
function! fugitive#Foldtext() abort
|
||||
return fugitive#foldtext()
|
||||
endfunction
|
||||
|
||||
augroup fugitive_foldtext
|
||||
autocmd!
|
||||
autocmd User Fugitive
|
||||
\ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' |
|
||||
\ set foldtext=fugitive#foldtext() |
|
||||
\ set foldtext=fugitive#Foldtext() |
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
Reference in New Issue
Block a user