joppot

コピペで絶対動く。説明を妥協しない

ソフトウェア

Fix emacs powerline character gets corruption(mojibake) on Mac standard terminal or iTerm2

投稿日:


Abstract

Hello everyone it’s me candle.
In this time I will show you how to fix emacs powerline character corruption(mojibake).

I am referring to this site.
https://griffio.github.io/utils/2016/01/26/Spacemacs-OSX-Term/
I will explain both iterm2 and mac standard terminal.

In my case I launch the Emacs with iterm2, the arrow of powerline gets garbled.

Let’s fix.

Precondition

You use emacs
Your emacs was installed powerline.
You use emacs with iTerm2 or mac standard terminal.



Install the font supporting powerline

The fundamental problem of this character corruption arises from the thing that the character of unicode used by powerline doesn’t contain the font in your terminal.

Let’s install necessary fonts.

There is a font supporting to powerline in github.
https://github.com/powerline/fonts

We clone this repository. The place is ok anywhere.
I clone it to Desktop.

cd ~/Desktop/
git clone https://github.com/powerline/fonts.git



Installation of font

You may want to install all fonts, but the font file is big, so we would like to install only one.
You can check the kind of fonts from this github page.

https://github.com/powerline/fonts/blob/master/samples/All.md

Anyway let’s install one.
Hmm we will install “SourceCodePro”.

Execute install.sh in the cloned fonts folder.
If you pass the font name to the first argument, you can install only the font of your choice.

cd ~/Desktop/fonts
./install.sh "Source Code Powerline Regular"

Installation of font is finish.

Font configuration

I explain how to setup each
Since the font settings are different for the software, I will explain each.

Setup font in Iterm2

Launch Iterm2 and select “preferences…” from “iTerm2” of the top menu.
Choose “Profiles” and select the tab of “Text”.

Choose “Change Font” of “Non-ASCII Font” in the red range of the below image.
And you select the “Source code pro for powerline” we installed before.

Non-ASCII Font is a type of font other than standard characters.
powerline’s corruption character uses the font which is specified here.

If you want to use the “Source Code Pro for Powerline” font as a whole of iTerm2, you also change the “Font” of the blue range please.


iTerm2 setting is finish

Mac standard terminal font configuration

Launch the terminal, select the “Terminal” at the top of menu and next “Preferences…”.
Choose the “Change…” in the “Text” tab in the “Profiles”

Mac standard terminal can not make only special characters powerline font like iTerm2.
You use the same font in the whole of terminal.

You choose the “Source Code Pro for Powerline”

Font configuration is over.

Checking

iLaunch Emacs with iTerm2


Ok it seems to be good.

Launch Emacs with mac standard terminal.

Also it is ok.

Conclusion

Now you can have a beautiful powerline life.

スポンサードリンク

If you think this article is good, share it please

-ソフトウェア
-

執筆者:


comment

Your email address will not be published. Required fields are marked *

関連記事

Atom imports React component using import-js 2.2.0

Abstract Hello everybody it’s me candle. In this time we will import the component path into the file using import-js and Atom automatically. React recommends to write one component in one file, when development becomes to be big, the number of component increase. If you use 10 components with one Container, you need to write 10 import statements. import-js helps us from such troublesome work. Precondition Already exist React web environment I recommend you use the react project created by create-react-app command which I wrote the before article. Atom was installed in your computer.

Develop React in emacs in rjsx-mode

English 日本語 Abstract Hello everyone this is candle. In this time I would like to introduce rjsx-mode of major-mode for react development of emacs. The development of “react” has been tried and errored between emacs users, such as using web-mode or js2-jsx-mode of js2-mode. Also I had been used js2-jsx-mode before rjsx-mode. Since rjsx-mode is an extension of js2-mode, users of js2-mode can use it without discomfort. rjsx-mode has auto complete function of jsx. it’s fantastic. Precondition You use emacs You use melpa or el-get

How to prevent preview from scrolling back to top in Atom’s Markdown

English 日本語 Abstract Hello everyone, it’s candle. Atom has a markdown preview function from the beginning. When markdown’s sentence becomes long, every time you edit it, the preview back to the top. And, you have to scroll every time to check. It is so tough, we will put a plug-in that will automatically adjust the preview. Premise Atom has been installed

How to add extension to Ungoogled chromium

English 日本語 Abstract Hello everybody, It’s candle. I don’t use Google Chrome so much because I am firefox user, but sometimes I need to use Chrome for extensions. Google Chrome is slow, and there are some personal information protection is loose. Detail is here. https://github.com/Eloston/ungoogled-chromium So, I use ungoogled chromium. The problem of ungoogle chromium is that is not easy to install extensions. In this article, I’ll show you how to install plugins. This article is according to the under link. https://github.com/Eloston/ungoogled-chromium/blob/master/FAQ.md Premise Ungoogled chromium has been installed

In emacs on iTerm2, resolve you can’t enter symbol key binding such as C-; C-: C-> C-< C-. C-,

Abstract Hello eveyone it’s me candle. This time I will show you how to solve the problem that you can’t use symbol keybind on your iTerm2 emacs. Basically, emacs on iTerm2 can’t use key binding of control + symbol. The detail thing is written in this article. (japanese) http://memo.sugyan.com/entry/20120224/1330051378 Acouding to the article Apparently it seems that the range of ASCII that ctrl key can control is decided. This post referred to the below linked article. I tried how to setup symbol key binding a few years ago and I was frustrated. But I solved it by that. it was …


I work in the venture company as a CTO. I start to write program in University, first I learned java, C++ and PHP. In the company, I'm developing web services by Rails. I do like to automation.