Skip to content

Commit 81ca632

Browse files
committed
Allow hiding icons
Can now use the `g:dirvish_git_show_icons` variable to hide icons: ```vimL let g:dirvish_git_show_icons = 0 ```
1 parent 423bbb5 commit 81ca632

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,12 @@ colorscheme gruvbox
8686
hi DirvishGitModified guifg=#0000FF
8787
```
8888

89+
Icons are shown by default, to hide the icons and only show the Git status with
90+
colors, add this to your vimrc:
91+
92+
```vimL
93+
let g:dirvish_git_show_icons = 0
94+
```
95+
8996
## Thanks to:
9097
* [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin)

plugin/dirvish_git.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ endif
44
let g:loaded_dirvish_git = 1
55

66
let g:dirvish_git_show_ignored = get(g:, 'dirvish_git_show_ignored', 0)
7+
let g:dirvish_git_show_icons = get(g:, 'dirvish_git_show_icons', 1)
78

89
if !exists('g:dirvish_git_indicators')
910
let g:dirvish_git_indicators = {
@@ -147,9 +148,15 @@ function! s:highlight_file(dir, file_name, us, them, is_directory) abort
147148
let l:dir_rgx = escape(printf('%s\(%s%s\)\@=', a:dir, s:sep, a:file_name), s:escape_chars)
148149
let l:slash_rgx = escape(printf('\(%s\)\@<=%s\(%s\)\@=', a:dir, s:sep, a:file_name), s:escape_chars)
149150

150-
silent exe 'syn match DirvishGitDir "'.l:dir_rgx.'" conceal cchar='.s:get_indicator(a:us, a:them)
151+
" Check if icons should be shown
152+
let l:conceal_char = g:dirvish_git_show_icons
153+
\ ? ' cchar=' .. s:get_indicator(a:us, a:them)
154+
\ : ''
155+
let l:conceal_last_folder_char = g:dirvish_git_show_icons ? ' cchar= ' : ''
156+
157+
silent exe 'syn match DirvishGitDir "'.l:dir_rgx.'" conceal' .. l:conceal_char
151158
silent exe 'syn match '.s:get_highlight_group(a:us, a:them, a:is_directory).' "'.l:file_rgx.'" contains=DirvishGitSlash'
152-
silent exe 'syn match DirvishGitSlash "'.l:slash_rgx.'" conceal cchar= contained'
159+
silent exe 'syn match DirvishGitSlash "'.l:slash_rgx.'" conceal contained' .. l:conceal_last_folder_char
153160
endfunction
154161

155162
function! s:setup_highlighting() abort

0 commit comments

Comments
 (0)