Donnerstag, 9. Oktober 2014

Emacs with 256 colors in Screen and PuTTY

In the past I used X11 forwarding mainly to get the right colors in Emacs. But it is also possible to get them in PuTTY and Screen. By this it is possible to install the emacs-nox package and remove all X11 libraries. To get this working PuTTYs default terminal type has to be changed from xterm to xterm-256color and screen must use this terminal, too. This is the PuTTY option for the color mode.

And this is for the terminal type.

And this is what you need to add to the .screenrc file in your HOME directory.

term xterm-256color

If you want to have something useful in PuTTY's scroll back buffer, you can also add the following line.

termcapinfo xterm-256color ti@:te@

Now you can start Emacs and it looks almost the same as in X11, but it uses much less bandwidth and needs a lot less packages.

And Screen provides virtual terminals, which make it easy to switch between different programs.

If you have a problem with the End key not going to the end of the line in Emacs, the following definition in the .emacs file will fix the problem.

(define-key global-map [select] 'end-of-line)

The Gnome Terminal requires the TERM variable to be set to xterm-256color.

TERM=xterm-256color ssh ...

Then it shows also 256 colors.

It is possible to permanently change the TERM variable by setting a custom command in the Gnome Terminal profile.

Keine Kommentare: