Search code examples
macosunicodefishiterm2

Fish Shell Fix Emoji Spacing iTerm2 MacOS


In iTerm2 using fish shell 2.7.1 emojis do not display properly

With Unicode 9 widths turned on in iTerm, emojis are wack

enter image description here With Right Hand Prompt enter image description here Without Right Hand Prompt enter image description here

Without Unicode 9 widths, emojis are smushed.

How can I fix this?

enter image description here


Solution

  • This is due to an outdated wc-width function in fish for determining how much space each character gets. This supposedly will be fixed in fish 3. If you want emojis to work properly in fish 2.x.x:

    1. Build source from GitHub AND instead of cmake .. do cmake -DINCLUDED_WCWIDTH=OFF ... This will use your system's wc-width function, which should be better when using MacOS.

    2. Add set -g fish_emoji_width 2 to ~/.config/config.fish. This will make emojis by default have a width of 2, which should fix spacing issues.

    This issue is explained in-detail here.