mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 09:58:29 +08:00
add gina support for vim-airline's branch
add check gina in util.vim fix typo add gina check fix typo add gina.vim's url in doc fix typo delete v:version > 800 fix error
This commit is contained in:
parent
9f00b402c5
commit
f8e1f85fde
|
@ -255,6 +255,7 @@ function! airline#extensions#load()
|
|||
|
||||
if get(g:, 'airline#extensions#branch#enabled', 1) && (
|
||||
\ airline#util#has_fugitive() ||
|
||||
\ airline#util#has_gina() ||
|
||||
\ airline#util#has_lawrencium() ||
|
||||
\ airline#util#has_vcscommand() ||
|
||||
\ airline#util#has_custom_scm())
|
||||
|
|
|
@ -85,17 +85,26 @@ let s:names = {'0': 'index', '1': 'orig', '2':'fetch', '3':'merge'}
|
|||
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
||||
|
||||
function! s:update_git_branch()
|
||||
if !airline#util#has_fugitive()
|
||||
if !airline#util#has_fugitive() && !airline#util#has_gina()
|
||||
let s:vcs_config['git'].branch = ''
|
||||
return
|
||||
endif
|
||||
|
||||
let s:vcs_config['git'].branch = exists("*FugitiveHead") ?
|
||||
\ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
if airline#util#has_fugitive()
|
||||
let s:vcs_config['git'].branch = exists("*FugitiveHead") ?
|
||||
\ FugitiveHead(s:sha1size) : fugitive#head(s:sha1size)
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
else
|
||||
let g:gina#component#repo#commit_length = s:sha1size
|
||||
let s:vcs_config['git'].branch = gina#component#repo#branch()
|
||||
if s:vcs_config['git'].branch is# 'master' &&
|
||||
\ airline#util#winwidth() < 81
|
||||
" Shorten default a bit
|
||||
let s:vcs_config['git'].branch='mas'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -200,7 +209,7 @@ function! s:update_untracked()
|
|||
for vcs in keys(s:vcs_config)
|
||||
" only check, for git, if fugitive is installed
|
||||
" and for 'hg' if lawrencium is installed, else skip
|
||||
if vcs is# 'git' && !airline#util#has_fugitive()
|
||||
if vcs is# 'git' && (!airline#util#has_fugitive())
|
||||
continue
|
||||
elseif vcs is# 'mercurial' && !airline#util#has_lawrencium()
|
||||
continue
|
||||
|
|
|
@ -135,6 +135,14 @@ function! airline#util#has_fugitive()
|
|||
return s:has_fugitive
|
||||
endfunction
|
||||
|
||||
function! airline#util#has_gina()
|
||||
if !exists("s:has_gina")
|
||||
let s:has_gina = exists(':Gina')
|
||||
endif
|
||||
return s:has_gina
|
||||
endfunction
|
||||
|
||||
|
||||
function! airline#util#has_lawrencium()
|
||||
if !exists("s:has_lawrencium")
|
||||
let s:has_lawrencium = exists('*lawrencium#statusline')
|
||||
|
|
|
@ -474,6 +474,7 @@ vim-airline will display the branch-indicator together with the branch name
|
|||
in the statusline, if one of the following plugins is installed:
|
||||
|
||||
fugitive.vim <https://github.com/tpope/vim-fugitive>
|
||||
gina.vim <https://github.com/lambdalisue/gina.vim>
|
||||
lawrencium <https://bitbucket.org/ludovicchabant/vim-lawrencium>
|
||||
vcscommand <http://www.vim.org/scripts/script.php?script_id=90>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user