问题
I'm using Windows Subsystem for Linux (WSL 2) with Oh My Zsh to pimp my bash, but I can't make the Ubuntu terminal render the Powerline fonts properly. Any idea on how to set up WSL to work with these fonts?
回答1:
I was installing the fonts in the Ubuntu system, but it is Windows that is rendering the characters from the terminal, so I should install the fonts on Windows (facepalm).
I followed this blog post to install the Powerline fonts on Windows, and then I had to change the font in the settings of the WSL terminal:
I selected the font DejaVu Sans Mono for Powerline, which works well with the robbyrussell theme of Oh My Zsh, but there are other options.
Running the same command now rendered the characters as expected:
The shell command I used to test the Powerline fonts came from this GitHub gist.
回答2:
If you are running a Debian or Ubuntu a package available to install the Powerline Fonts with the following command:
sudo apt-get install fonts-powerline
otherwise you can do
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
cd ..
rm -rf fonts
来源:https://stackoverflow.com/questions/63148517/how-to-install-powerline-fonts-on-wsl