mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-14 22:33: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')
|
\ getftype(path.'commondir') ==# 'file')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! FugitiveIsGitDir(path) abort
|
||||||
|
return fugitive#is_git_dir(a:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fugitive#extract_git_dir(path) abort
|
function! fugitive#extract_git_dir(path) abort
|
||||||
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
if s:shellslash(a:path) =~# '^fugitive://.*//'
|
||||||
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
|
||||||
@@ -213,6 +217,10 @@ function! fugitive#extract_git_dir(path) abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! FugitiveExtractGitDir(path) abort
|
||||||
|
return fugitive#extract_git_dir(a:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fugitive#detect(path) abort
|
function! fugitive#detect(path) abort
|
||||||
if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$')
|
if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$')
|
||||||
unlet b:git_dir
|
unlet b:git_dir
|
||||||
@@ -261,6 +269,10 @@ function! fugitive#detect(path) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! FugitiveDetect(path) abort
|
||||||
|
return fugitive#detect(a:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
augroup fugitive
|
augroup fugitive
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('%:p'))
|
autocmd BufNewFile,BufReadPost * call fugitive#detect(expand('%:p'))
|
||||||
@@ -296,6 +308,10 @@ function! fugitive#repo(...) abort
|
|||||||
return call('s:repo', a:000)
|
return call('s:repo', a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function fugitive#Repo(...) abort
|
||||||
|
return call('s:repo', a:000)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:repo_dir(...) dict abort
|
function! s:repo_dir(...) dict abort
|
||||||
return join([self.git_dir]+a:000,'/')
|
return join([self.git_dir]+a:000,'/')
|
||||||
endfunction
|
endfunction
|
||||||
@@ -555,6 +571,10 @@ function! fugitive#buffer(...) abort
|
|||||||
return s:buffer(a:0 ? a:1 : '%')
|
return s:buffer(a:0 ? a:1 : '%')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#Buffer(...) abort
|
||||||
|
return s:buffer(a:0 ? a:1 : '%')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:buffer_getvar(var) dict abort
|
function! s:buffer_getvar(var) dict abort
|
||||||
return getbufvar(self['#'],a:var)
|
return getbufvar(self['#'],a:var)
|
||||||
endfunction
|
endfunction
|
||||||
@@ -850,6 +870,10 @@ function! fugitive#reload_status() abort
|
|||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#ReloadStatus() abort
|
||||||
|
return fugitive#reload_status()
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:stage_info(lnum) abort
|
function! s:stage_info(lnum) abort
|
||||||
let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
let filename = matchstr(getline(a:lnum),'^#\t\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
|
||||||
let lnum = a:lnum
|
let lnum = a:lnum
|
||||||
@@ -3080,6 +3104,10 @@ function! fugitive#cfile() abort
|
|||||||
return pre . s:fnameescape(fugitive#repo().translate(results[0]))
|
return pre . s:fnameescape(fugitive#repo().translate(results[0]))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#Cfile() abort
|
||||||
|
return fugitive#cfile()
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Section: Statusline
|
" Section: Statusline
|
||||||
|
|
||||||
function! s:repo_head_ref() dict abort
|
function! s:repo_head_ref() dict abort
|
||||||
@@ -3107,6 +3135,14 @@ function! fugitive#statusline(...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#Statusline(...) abort
|
||||||
|
return fugitive#statusline()
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! FugitiveStatusline(...) abort
|
||||||
|
return fugitive#statusline()
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fugitive#head(...) abort
|
function! fugitive#head(...) abort
|
||||||
if !exists('b:git_dir')
|
if !exists('b:git_dir')
|
||||||
return ''
|
return ''
|
||||||
@@ -3115,6 +3151,10 @@ function! fugitive#head(...) abort
|
|||||||
return s:repo().head(a:0 ? a:1 : 0)
|
return s:repo().head(a:0 ? a:1 : 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! FugitiveHead(...) abort
|
||||||
|
return fugitive#head(a:0 ? a:1 : 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
augroup fugitive_statusline
|
augroup fugitive_statusline
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User Flags call Hoist('buffer', function('fugitive#statusline'))
|
autocmd User Flags call Hoist('buffer', function('fugitive#statusline'))
|
||||||
@@ -3165,10 +3205,14 @@ function! fugitive#foldtext() abort
|
|||||||
return foldtext()
|
return foldtext()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! fugitive#Foldtext() abort
|
||||||
|
return fugitive#foldtext()
|
||||||
|
endfunction
|
||||||
|
|
||||||
augroup fugitive_foldtext
|
augroup fugitive_foldtext
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User Fugitive
|
autocmd User Fugitive
|
||||||
\ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' |
|
\ if &filetype =~# '^git\%(commit\)\=$' && &foldtext ==# 'foldtext()' |
|
||||||
\ set foldtext=fugitive#foldtext() |
|
\ set foldtext=fugitive#Foldtext() |
|
||||||
\ endif
|
\ endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|||||||
Reference in New Issue
Block a user