Skip to content
Charles Chiu edited this page Nov 17, 2022 · 9 revisions

ERROR: Locale does not support UTF 8. Unicode characters may not display correctly.

To fix above error, put below lines in your ~/.bashrc.

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Reference

Set nvim as default editor

If you want to use Neovim for some (or all) of the editor alternatives, use the following commands:

sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 60
sudo update-alternatives --config vi
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 60
sudo update-alternatives --config vim
sudo update-alternatives --install /usr/bin/editor editor /usr/bin/nvim 60
sudo update-alternatives --config editor

or

In .bashrc:

alias vim='nvim'
export EDITOR='nvim'

※ NOTE: However, some special interfaces, like view for nvim -R, are not supported. See neovim/#1646 & neovim/#2008 for more info.

Check special characters in terminal emulators

Check your value of $TERM via: echo $TERM.

In some terminal emulators like Alacritty, $TERM should be alacritty. If it's Kitty, it will be xterm-kitty. ※ NOTE: Some terminal emulators like Alacritty, only have full special character support on macOS/Linux. If you run it on Windows, it might have some issues, ref.

  • Strikethrough:
printf "\e[9mstrikethrough\e[0m"

Results:

圖片

  • Undercurl:
printf '\e[4:3mUnderlined\n'

Results:

圖片

  • Underline, Double underline, Undercurl, Underdot, Underdash:
printf "\x1b[58:2::255:0:0m\x1b[4:1msingle\n\x1b[4:2mdouble\n\x1b[4:3mcurly\n\x1b[4:4mdotted\n\x1b[4:5mdashed\n\x1b[0m\n"

Results:

Check special characters in Tmux:

Check your value of $TERM via: echo $TERM.

Most of the time it should be xterm-256color or tmux-256color. If it's screen-256color, then most of the special characters won't display properly.

Recommendation: add this alias to your .bashrc/.zshrc: alias tmux="TERM=tmux-256color /path/to/tmux -f ~/path/to/tmux.conf"

Also add below lines to your tmux.conf:

# Set true color
set -g default-terminal "tmux-256color"
set -sa terminal-overrides ",*-256col*:RGB"

# Strikethrough & Undercurl
set -as terminal-overrides ',xterm*:smxx=\E[9m' # strikethrough
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # undercurl colours - needs tmux-3.0