8000 GitHub - powerman/wcwidth-icons: Support fonts with double-width icons in xterm/rxvt-unicode/zsh/vim/…
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

powerman/wcwidth-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wcwidth-icons

Support fonts with double-width icons in xterm/rxvt-unicode/zsh/vim/…

If fonts with icons like Nerd Fonts are used with some terminals like rxvt-unicode then icons must have single-width (Nerd Fonts calls this "Mono" font, generated by Nerd Fonts Font Patcher with option --use-single-width-glyphs) to work correctly. This makes icons too small (about ¼ of normal size for most icons).

To fix this for most applications (like xterm/rxvt-unicode/zsh/…) which use libc function (like wcwidth(3) or wcswidth(3)) to get symbol width you can use provided library in LD_PRELOAD environment variable.

Some other applications may need extra configuration or a patch (see below).

With these fixes you should use Nerd Fonts with "Propo" font name suffix instead of "Mono".

Install

# Build libwcwidth-icons.so and copy it to /usr/lib/ by default.
sudo make install

Gentoo Linux

sudo layman -a powerman
sudo emerge wcwidth-icons

Usage

# Fix icon width for Nerd Fonts v3 (non-Mono variant).
export LD_PRELOAD=/usr/lib/libwcwidth-icons.so

Then run urxvt/xterm/zsh/… using font with double-width icons.

Other applications

Less

# Fix icon width for Nerd Fonts v3 (non-Mono variant).
export LESSUTFCHARDEF="23fb-23fe:w,2665:w,2b58:w,e000-e09f:w,e0a0-e0bf:p,e0c0-f8ff:w,f0001-fffff:w"

Vim

Add this to your Vim configuration:

" Fix icon width for Nerd Fonts v3 (non-Mono variant).
call setcellwidths([
\   [ 0x23fb, 0x23fe, 2 ],
\   [ 0x2665, 0x2665, 2 ],
\   [ 0x2b58, 0x2b58, 2 ],
\   [ 0xe000, 0xe09f, 2 ],
\   [ 0xe0c0, 0xf8ff, 2 ],
\   [ 0xf0001, 0xfffff, 2 ],
\ ])

Neovim

Add this to your Neovim configuration:

-- Fix icon width for Nerd Fonts v3 (non-Mono variant).
vim.fn.setcellwidths({
    { 0x23fb, 0x23fe, 2 },
    { 0x2665, 0x2665, 2 },
    { 0x2b58, 0x2b58, 2 },
    { 0xe000, 0xe09f, 2 },
    { 0xe0c0, 0xf8ff, 2 },
    { 0xf0001, 0xfffff, 2 },
})

About

Support fonts with double-width icons in xterm/rxvt-unicode/zsh/vim/…

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0