mirror of
https://github.com/pcvolkmer/vim-fugistate.git
synced 2025-04-19 15:26:50 +00:00
Add label configuration for git dir status
This commit is contained in:
parent
b47b8091da
commit
0037cb5c6f
12
README.md
12
README.md
@ -14,7 +14,7 @@ It will show something like `main.c [ M]` for modified file `main.c`.
|
|||||||
:echo FugiStateGitDir()
|
:echo FugiStateGitDir()
|
||||||
```
|
```
|
||||||
|
|
||||||
This will show changes, new and unversioned files, e.g. `1 change, 2 new, 3 unversioned`.
|
This will show changes, new and unversioned files, e.g. `1 changed, 2 new, 3 unversioned`.
|
||||||
|
|
||||||
For example, to show the filename with git status using [lightline.vim](https://github.com/itchyny/lightline.vim),
|
For example, to show the filename with git status using [lightline.vim](https://github.com/itchyny/lightline.vim),
|
||||||
configure as follows.
|
configure as follows.
|
||||||
@ -37,5 +37,15 @@ The plugin provides `g:fugistate_expand_filename` to modify the value the filena
|
|||||||
Default value is set to `'%:t'` and will show filename without path. Use available values like `'%:p'` for full path
|
Default value is set to `'%:t'` and will show filename without path. Use available values like `'%:p'` for full path
|
||||||
or `''` to use `@%` for directory/filename relative to current working directory.
|
or `''` to use `@%` for directory/filename relative to current working directory.
|
||||||
|
|
||||||
|
### Labels
|
||||||
|
|
||||||
|
If you want other labels than `changed`, `new` and `unversioned`, add this to your vim config.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
let g:fugistate_label_changed = '✹'
|
||||||
|
let g:fugistate_label_new = '✚'
|
||||||
|
let g:fugistate_label_unversioned = '★'
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
This software is released under the MIT License, see LICENSE.
|
This software is released under the MIT License, see LICENSE.
|
||||||
|
@ -53,20 +53,16 @@ function! fugistate#gitdir()
|
|||||||
|
|
||||||
let s:out = []
|
let s:out = []
|
||||||
|
|
||||||
if s:changed == 1
|
if s:changed > 0
|
||||||
call add(s:out, "1 change")
|
call add(s:out, s:changed . " " . g:fugistate_label_changed)
|
||||||
endif
|
|
||||||
|
|
||||||
if s:changed > 1
|
|
||||||
call add(s:out, s:changed . " changes")
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:new > 0
|
if s:new > 0
|
||||||
call add(s:out, s:new . " new")
|
call add(s:out, s:new . " " . g:fugistate_label_new)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:unversioned > 0
|
if s:unversioned > 0
|
||||||
call add(s:out, s:unversioned . " unversioned")
|
call add(s:out, s:unversioned . " " . g:fugistate_label_unversioned)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return join(s:out, ', ')
|
return join(s:out, ', ')
|
||||||
|
@ -11,6 +11,18 @@ if ! exists('g:fugistate_expand_filename')
|
|||||||
let g:fugistate_expand_filename = '%:t'
|
let g:fugistate_expand_filename = '%:t'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ! exists('g:fugistate_label_changed')
|
||||||
|
let g:fugistate_label_changed = 'changed'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ! exists('g:fugistate_label_new')
|
||||||
|
let g:fugistate_label_new = 'new'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ! exists('g:fugistate_label_unversioned')
|
||||||
|
let g:fugistate_label_unversioned = 'unversioned'
|
||||||
|
endif
|
||||||
|
|
||||||
augroup FugiState
|
augroup FugiState
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufEnter,BufWritePost,FocusGained * :call fugistate#update()
|
autocmd BufEnter,BufWritePost,FocusGained * :call fugistate#update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user