Vim-devicons: extra space for file but not for folder?

Created on 30 Oct 2017  路  10Comments  路  Source: ryanoasis/vim-devicons

First thank you for the hard work on developing this plugin.

There are an extra space after file icon but not folder icon,
which I don't want.
It happens in neovim macvim and vim,
Is There an easy way for me to fix it?

Imgur
Terminal: iTerm2 3.1.4
Platform: 10.12.6
Font: FuraCode Nerd Font
vimrc:

call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'
call plug#end()
map <C-n> :NERDTreeToggle<CR>
let g:WebDevIconsOS = 'Darwin'
let g:WebDevIconsNerdTreeAfterGlyphPadding = ''
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:webdevicons_conceal_nerdtree_brackets = 0

vim version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 20 2017 23:44:52)
MacOS X (unix) version
Included patches: 1-1200
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminal
++builtin_terms  +fork()          +multi_lang      +terminfo
+byte_offset     -gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
+clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        +perl            +user_commands
+cmdline_hist    +keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       -python          +viminfo
+cscope          +lispindent      +python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xpm
+eval            +mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +syntax          -xterm_save
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framework CoreFoundation  -lruby.2.4.2 -lobjc

Most helpful comment

@ryanoasis no problem :)
Thanks for the advice, now it seems to be behaving properly. And thanks for pointing me to the nerdtree file, that's why I couldn't find anywhere in devicons those brackets :p

Regarding the symbol next to the folder, I guess I'll find a way to let nerdtree-git-plugin be aware of the g:WebDevIconsUnicodeGlyphDoubleWidth = 1 variable, somehow.

All 10 comments

@soulomoon

First thank you for the hard work on developing this plugin.

Thanks I really appreciate that :smile:


Also sorry for the delayed response, I have been busy with Nerd Fonts

I will look at your issue when I get a chance but seems we still have some off-by-one issue between folders and other glyphs depending on the configuration :blush:

This probably won't matter but you could try messing with g:WebDevIconsUnicodeGlyphDoubleWidth setting :man_shrugging:

I just noticed this issue after posting mine #225.
@soulomoon you can get rid of that extra space by setting appendArtifactFix = 0

@slabua thank you for the solution, it works, now the extra white space is gone, I have to modify it in the source code of the plugin, instead of just appending a line in vimrc

We should probably go ahead and make it configurable. Thanks for the follow ups

Hi, I have encountered a redraw issue after this commit.
Apparently, when opening a folder, hence creating a new row right below the folder itself, not the whole line is rendered, but just the new content appearing inside the folder in object.

I attach two pictures, the one with the red theme from a working snapshot at commit 8db0e63, whilst the other with the green theme is the one showing the issue after commit 40040ba:

There also seems to be an issue with the icon in front of the folder.
Would it be possible to have the artifact fix separate for folders and files, perhaps?

peek 2018-03-11 00-19
Working situation ^

peek 2018-03-11 00-12
Note that the artifact showing next to the denite file, and the license file as well, is not an opening square bracket, it is the remaining of the markdown icon from the file listed below.

Hint: I tried to set "g:webdevicons_conceal_nerdtree_brackets = 0" and the issue disappears because more space around the icon is rendered.
If it's possible to select a custom character for opening and closing bracket instead, it would be sufficient to set an empty or space character.
This would be, of course, just a workaround for the issue mentioned above and not the solution to the real glitch.

@slabua Thanks for the gifs :+1:

You can mostly return the logic to how it was prior now with ~let g:DevIconsAppendArtifactFix = 1~ let g:DevIconsEnableNERDTreeRedraw = 1

if it's possible to select a custom character for opening and closing bracket instead

To do so properly not without a PR to NERDTree https://github.com/scrooloose/nerdtree/blob/509122df20e200b50e887c32cb7d92b19171a4ab/lib/nerdtree/flag_set.vim#L55 we just make use of the flagSet class to set devicon flags and use conceal to hide the brackets :smile:

@ryanoasis no problem :)
Thanks for the advice, now it seems to be behaving properly. And thanks for pointing me to the nerdtree file, that's why I couldn't find anywhere in devicons those brackets :p

Regarding the symbol next to the folder, I guess I'll find a way to let nerdtree-git-plugin be aware of the g:WebDevIconsUnicodeGlyphDoubleWidth = 1 variable, somehow.

Cool. Glad that worked for you.

Hmm the issue is the 'x' symbols distance to the folder name? I was actually considering removing that glyphdoublewidth option since we now have padding for before and after the glyph you can set. I need to think about it more

@ryanoasis yes, that x symbol is double width, but whilst the other double width symbols next to the file names are correctly handled, those related to the git plugin are not.
I could set either a different symbol or a double width symbol followed by a space, but that would disrupt the syntax highlight for the symbol itself.
I'm not sure actually whether this issue is related to vim-devicons or nerdtree-git-plugin, or maybe even the main nerdtree.

Was this page helpful?
0 / 5 - 0 ratings