ryanoasis / vim-devicons

Adds file type icons to Vim plugins such as: NERDTree, vim-airline, CtrlP, unite, Denite, lightline, vim-startify and many more
MIT License
5.61k stars 263 forks source link

icons in NERDtree can be only shown half. #133

Open d0u9 opened 8 years ago

d0u9 commented 8 years ago

A picture is worth a thousand words:

https://github.com/d0u9/test_repository/blob/master/pics/20151219-0.png?raw=true

There are dots shield half part of each icon in NERDtree.

Also, the space between icons and characters seems to wide...

PS: I use neovim and iTerm2 in OSX 10.11.2

ryanoasis commented 8 years ago

For the dots try:

autocmd FileType nerdtree setlocal nolist

For spacing you can adjust with:

let g:WebDevIconsNerdTreeAfterGlyphPadding = '  '
d0u9 commented 8 years ago

@ryanoasis Works! Thank you!

ryanoasis commented 8 years ago

Hey no problem. Maybe I should consider setting this in the plugin by default

code-geeker commented 8 years ago

Hi ryanoasis , I'm in trouble with configuration. Alt text

Version: Alt text It seems to occupy only one character bit.

Regards, PengJun

ryanoasis commented 8 years ago

I will try to test your vimrc, I think I found it on GitHub but could you post a link to the latest one?

In the meantime, are you using latest version of NerdTree and devicons?

Can you tell me which font you are using?

Is this macvim (gui) or vim on terminal?

code-geeker commented 8 years ago

Hi ryanoasis, Thanks for your reply I just pushed the latest .vimrc file

Yes,they are both latest version.

This is the font: alt test

It is macvim(gui)

I suspect that the differing versions of macvim cause it. It works well on version 7.4-77 but doesn't work on 7.4-101 (https://github.com/macvim-dev/macvim/releases/tag/snapshot-101)

alt test

Regards, PengJun

code-geeker commented 8 years ago

BTW, It works well on vim on termina Alt text

ryanoasis commented 8 years ago

@code-geeker Sorry for the delayed response. I am looking into this issue.

BTW for the terminal vim you showed can you give the output of :version there as well?

code-geeker commented 8 years ago

@ryanoasis Thanks for your response. Alt text

code-geeker commented 8 years ago

It goes like this in the MacVim. img

ryanoasis commented 8 years ago

Thanks. I will try to do some more digging

lisposter commented 8 years ago

same issue as @code-geeker

MacVim snapshot-104

set guifont=Meslo\ LG\ M\ Regular\ for\ Powerline\ Nerd\ Font\ Complete:h12

works well in terminal, even in neovim

ryanoasis commented 8 years ago

Sorry I still haven't had a chance to look into this, however @xusiyuan841028 has shared some info in the Gitter Chat that might be of some help to some of you. ¯(ツ)

https://github.com/macvim-dev/macvim/blob/0e954ac375d78d86cfd41377440c7f5977ae8924/src/screen.c#L8068-L8070

Some other references from searching (unsure if completely related):

https://github.com/macvim-dev/macvim/issues/267

https://github.com/vim/vim/issues/732

https://github.com/rogual/neovim-dot-app/issues/240

lerrua commented 8 years ago

Hey guys,

I'm using last macvim version (in homebrew) and last version for devicons and I have the same issue here: screen shot 2016-06-13 at 2 10 42 pm

An yes, I tried this code, but no success.

autocmd FileType nerdtree setlocal nolist
let g:WebDevIconsNerdTreeAfterGlyphPadding = '  '

The half icons bug happens with tabs also screen shot 2016-06-13 at 2 14 55 pm

lerrua commented 8 years ago

So, this can fix the issue set ambiwidth=double BUT breaks airline status line. Damm...

ryanoasis commented 8 years ago

The original issue from @d0u9 was actually a different problem (#84, #110) but we seem to now be using this issue in regards to a new (harder?) problem :stuck_out_tongue: ... so I am going to re-open this so there is less confusion and it's easier to find

@lerrua Hey yep sorry, still a serious issue.

Just wondering if anyone has been able to try @xusiyuan841028 suggested fix?

The cause of issue is that: https://github.com/macvim-dev/macvim/blob/0e954ac375d78d86cfd41377440c7f5977ae8924/src/screen.c#L8068-L8070

xusiyuan841028 commented 8 years ago

@ryanoasis

My fix https://github.com/xusiyuan841028/macvim/commit/27bcfd27d6c3500b6ca27c7387a19b5a8306df17

You can install my edge version by:

brew install --HEAD xusiyuan841028/macvim/macvim
ryanoasis commented 8 years ago

@xusiyuan841028 Thanks I just have not been able to test it out (I don't have access to a mac at the moment).

I was hoping someone else could verify/try the suggested fix

ryanoasis commented 8 years ago

Seems like possibly due to change https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30 ?

I really need to test on an updated version of vim. Will try this weekend

valerybugakov commented 8 years ago

@xusiyuan841028 I've tried your patched version, but still have half icons bug. What I did:

brew unlink macvim
brew install --HEAD xusiyuan841028/macvim/macvim
brew link --overwrite macvim

Is there anything else needed here?

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 14 2016 22:15:27) MacOS X (unix) version Included patches: 1-1816 Compiled by Homebrew

screen shot 2016-06-25 at 6 02 38 pm

ryanoasis commented 8 years ago

@valerybugakov Thanks for trying! I am not really sure if anything else is needed :worried:

valerybugakov commented 8 years ago

@ryanoasis oh, if there will be something I can do to help with this issue - tell me 😊 Awesome plugin and would be awesome to have it working properly on macvim!

xusiyuan841028 commented 8 years ago

@valerybugakov I have tested the fixed macvim in another macbook, and it is fine. The version info is as following:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 23 2016 09:53:11)
MacOS X (unix) version
Included patches: 1-1952

I find the message Compiled by Homebrew, so I don't think you really use my patched macvim. I suggest you uninstall macvim, and re-install my patched version.

brew uninstall macvim
brew cleanup
brew install --force xusiyuan841028/macvim/macvim --HEAD
valerybugakov commented 8 years ago

@xusiyuan841028 thanks for the info, will try again in an hour 👍

xusiyuan841028 commented 8 years ago

@valerybugakov please pay attention to compiled Jun 23 2016 09:53:11, I think the date should be the moment you install patched macvim. I will keep update my patched version until official version fixes the double-width char display issue. Everyone can use command brew uninstall macvim && brew install --force xusiyuan841028/macvim/macvim --HEAD to install the updated version.

valerybugakov commented 8 years ago

@xusiyuan841028 should my Included patches match yours?

$ mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 28 2016 19:00:38)
MacOS X (unix) version
Included patches: 1-1965

I still have the same result 😥 After installation I got a warning from brew that macvim wasn't linked properly and I did brew link --overwrite macvim. Is this ok or it can be a source of an issue?

valerybugakov commented 8 years ago

@xusiyuan841028 Is there something specific that will identify your build for 100%? (that I've installed it correctly and test plugin with it)

valerybugakov commented 8 years ago

@xusiyuan841028 also a strange thing, after that ctrlp stopped working for vim and macvim

xusiyuan841028 commented 8 years ago

@valerybugakov Could you give me your email? I wanna your compiled MacVim and send mine to you, in order to check whether the patched version is available. Or you can contact with me via my public email.

valerybugakov commented 8 years ago

@xusiyuan841028 sent you an email (skymk1@gmail.com)

keenwon commented 8 years ago

image

I solve this problem by this:

image

and my vimrc is: https://github.com/keenwon/vim

xusiyuan841028 commented 8 years ago

@keenwon The font rendering becomes ugly!

kristijanhusak commented 7 years ago

I'm having the same issue:

OS: Xubuntu 16.04 Vim version: 8

In terminal Vim everything looks fine: vim-ok

But in GVim it's cut in half: not-ok-gvim

I'm using Inconsolata font, specifically this one

KabbAmine commented 7 years ago

@kristijanhusak set ambiwidth=double should solve devicons problem, but all other unicode characters will look ugly (Try to write french characters: é,è...).

kristijanhusak commented 7 years ago

@KabbAmine that fixes the icons issue, but messes up my airline, and i have $ at end of each line. ambiwidth-double

KabbAmine commented 7 years ago

@kristijanhusak I know for airline, but the $ is from list/listchars options.

seemethere commented 7 years ago

Can confirm having this issue as well.

OS: macOS Sierra 10.12 Vim Version: MacVim VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 22 2016 21:04:38)

screen shot 2016-11-22 at 9 12 01 pm
ryanoasis commented 7 years ago

Thanks all for the helpful details. I know this is a pretty important and critical bug for using this plugin on MacVim.

I've been busy on Nerd Fonts but even so not sure even if there is something specific I could do to contribute to solving this. That being said I will continue to try to look for and accept ideas on how to resolve :smile:

cmcginty commented 7 years ago

I use the UbuntuMono font, and there are actually two versions that conflict in the package. If you only install the all the .*Mono.ttf fonts then there is no clipping. The standard fonts must have larger icons that clip, FWIW.

If there is a way to get the non-Mono fonts working that would be nice to see though. 👍 :shipit:

xguerin commented 7 years ago

@xusiyuan841028 I can attest that your patch is working except for double width characters in the tabline. Any hope to see your fix merged into MacVim ?

dvakatsiienko commented 7 years ago

@keenwon solution (disable Use Core Text renderer) fixed half-size devicons issue for me in MacVim, but without this option checked MacVim started working much slower =(

felixsanz commented 7 years ago

Happens on my Linux box too, using nerd fonts.

Btw the problem is this: tiagofumo/vim-nerdtree-syntax-highlight

Without color, icons display fine

ActionScripted commented 7 years ago

Been having the same issue with MacVim. While Preferences > Advanced > Use Core Text Renderer being unchecked fixed NERDTree it lead to everything else looking awful. So I've decided to leave the renderer on.

I added this to my .vimrc and things are now working in MacVim as expected...at least for icons. The problem now is that it seems to apply these settings to ALL buffers and not just the NERDTree buffers. Perhaps someone can clean/fix this up a bit?

    augroup devicons_nerdtree
        autocmd FileType nerdtree setlocal list
        autocmd FileType nerdtree setlocal listchars=space:.
        autocmd FileType nerdtree setlocal nolist
        autocmd FileType nerdtree setlocal ambiwidth=double
    augroup END
xguerin commented 7 years ago

The issue with MacVim is related to the CoreText engine.

I spent some time looking at the code. Currently, the glyph processor does not take into account double-width glyphs when painting the glyphs on the GC. And since the glyph processor does not use a proper path to layout the glyphs (I believe this is required to keep the column-based layout) the second half of the double-width glyph is overwritten.

I toyed with the CoreText API and it should be fairly doable to recognize double-width glyph before painting them and then instruct the CoreText engine to skip the next glyphs. If I get anywhere with this approach I'll let you know.

felixsanz commented 7 years ago

This is NOT related to only mac. All platforms suffer it.

xguerin commented 7 years ago

Mileage may vary. My point is that it's not a font-related issue but rather a tool-related one. Double-glyphs fonts work like a charm on macOS+Vim+iTerm2. They also work like a charm on *nix+Vim+libvte. However, they don't work with MacVim or GTKx renderers.

felixsanz commented 7 years ago

It doesn't work on Linux+Neovim+st terminal.

Jeansen commented 7 years ago

if you use another terminal, like rxvt, it works fine. At least for me.

ryanoasis commented 7 years ago

@ActionScripted That's a very good idea :smile:

 autocmd FileType nerdtree setlocal ambiwidth=double

however it looks like ambiwidth is not something that has a local value as it will always apply globally

WillianGoncalves commented 7 years ago

I hope it helps: In my airline, after open GVIM, CTRL P and open a file, the icons appears like that: screenshot_1 Then, I switch to VISUAL mode and the icons appears correctly: screenshot_2

But if I open nerdtree, the icons back to initial state.