Configurability: parametrizable sha1 length
This commit is contained in:
parent
33663d7df2
commit
8c4bf37588
@ -84,6 +84,7 @@ endif
|
|||||||
|
|
||||||
" Fugitive special revisions. call '0' "staging" ?
|
" Fugitive special revisions. call '0' "staging" ?
|
||||||
let s:names = {'0': 'index', '1': 'ancestor', '2':'target', '3':'merged'}
|
let s:names = {'0': 'index', '1': 'ancestor', '2':'target', '3':'merged'}
|
||||||
|
let s:sha1size = get(g:, 'airline#extensions#branch#sha1_len', 7)
|
||||||
|
|
||||||
function! s:update_git_branch()
|
function! s:update_git_branch()
|
||||||
if !s:has_fugitive
|
if !s:has_fugitive
|
||||||
@ -91,7 +92,7 @@ function! s:update_git_branch()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let name = fugitive#head(7)
|
let name = fugitive#head(s:sha1size)
|
||||||
|
|
||||||
try
|
try
|
||||||
let commit = fugitive#buffer().commit()
|
let commit = fugitive#buffer().commit()
|
||||||
@ -103,7 +104,7 @@ function! s:update_git_branch()
|
|||||||
if ref !~ "^fatal: no tag exactly matches"
|
if ref !~ "^fatal: no tag exactly matches"
|
||||||
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
|
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
|
||||||
else
|
else
|
||||||
let name = commit[:6]."(".name.")"
|
let name = commit[0:s:sha1size-1]."(".name.")"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
catch
|
catch
|
||||||
|
@ -453,6 +453,9 @@ notexists symbol will be displayed after the branch name.
|
|||||||
return '[' . a:name . ']'
|
return '[' . a:name . ']'
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
|
* truncate sha1 commits at this number of characters >
|
||||||
|
let g:airline#extensions#branch#sha1_len = 10
|
||||||
|
<
|
||||||
------------------------------------- *airline-syntastic*
|
------------------------------------- *airline-syntastic*
|
||||||
syntastic <https://github.com/vim-syntastic/syntastic>
|
syntastic <https://github.com/vim-syntastic/syntastic>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user