mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-16 23:43:42 -05:00
call fugitive#head only once
This commit is contained in:
12
README.md
12
README.md
@@ -483,7 +483,11 @@ endfunction
|
|||||||
Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline)
|
Oops! We forgot the cool mark for the branch component! (work with the patched font for vim-powerline)
|
||||||
```vim
|
```vim
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return exists('*fugitive#head') && strlen(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
if exists("*fugitive#head")
|
||||||
|
let _ = fugitive#head()
|
||||||
|
return strlen(_) ? '⭠ '._ : ''
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
```
|
```
|
||||||

|

|
||||||
@@ -543,7 +547,11 @@ function! MyFilename()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') && strlen(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
if &ft !~? 'vimfiler\|gundo' && exists("*fugitive#head")
|
||||||
|
let _ = fugitive#head()
|
||||||
|
return strlen(_) ? '⭠ '._ : ''
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! MyFileformat()
|
function! MyFileformat()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Version: 0.0
|
|||||||
Author: itchyny (https://github.com/itchyny)
|
Author: itchyny (https://github.com/itchyny)
|
||||||
License: MIT License
|
License: MIT License
|
||||||
Repository: https://github.com/itchyny/lightline.vim
|
Repository: https://github.com/itchyny/lightline.vim
|
||||||
Last Change: 2013/08/28 10:58:47.
|
Last Change: 2013/08/29 14:44:34.
|
||||||
|
|
||||||
CONTENTS *lightline-contents*
|
CONTENTS *lightline-contents*
|
||||||
|
|
||||||
@@ -198,7 +198,11 @@ nice.
|
|||||||
return &readonly ? '' : ''
|
return &readonly ? '' : ''
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return exists("*fugitive#head") && strlen(fugitive#head()) ? ''.fugitive#head() : ''
|
if exists("*fugitive#head")
|
||||||
|
let _ = fugitive#head()
|
||||||
|
return strlen(_) ? ''._ : ''
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
If you have installed the patched font for |vim-powerline|, following settings
|
If you have installed the patched font for |vim-powerline|, following settings
|
||||||
@@ -219,7 +223,11 @@ look nice.
|
|||||||
return &readonly ? '⭤' : ''
|
return &readonly ? '⭤' : ''
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return exists("*fugitive#head") && strlen(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
if exists("*fugitive#head")
|
||||||
|
let _ = fugitive#head()
|
||||||
|
return strlen(_) ? '⭠ '._ : ''
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
|
|
||||||
@@ -346,7 +354,10 @@ A nice example for non-patched font users.
|
|||||||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return &ft !~? 'vimfiler' && exists("*fugitive#head") && strlen(fugitive#head()) ? fugitive#head() : ''
|
if &ft !~? 'vimfiler' && exists("*fugitive#head")
|
||||||
|
return fugitive#head()
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
A nice example for |vim-powerline| font users:
|
A nice example for |vim-powerline| font users:
|
||||||
@@ -378,7 +389,11 @@ A nice example for |vim-powerline| font users:
|
|||||||
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
\ ('' != MyModified() ? ' ' . MyModified() : '')
|
||||||
endfunction
|
endfunction
|
||||||
function! MyFugitive()
|
function! MyFugitive()
|
||||||
return &ft !~? 'vimfiler' && exists("*fugitive#head") && strlen(fugitive#head()) ? '⭠ '.fugitive#head() : ''
|
if &ft !~? 'vimfiler' && exists("*fugitive#head")
|
||||||
|
let _ = fugitive#head()
|
||||||
|
return strlen(_) ? '⭠ '._ : ''
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user