Skip to content

Latest commit

 

History

History
114 lines (95 loc) · 4.13 KB

README.org

File metadata and controls

114 lines (95 loc) · 4.13 KB

os/tty

Table of Contents

Description

This module configures Emacs for use in the terminal, by providing:

  • System clipboard integration (through an external clipboard program or OSC-52 escape codes in supported terminals).
  • Cursor-shape changing across evil states (requires a terminal that supports it).
  • Mouse support in the terminal.

Maintainers

This module has no dedicated maintainers.

Module Flags

  • +osc Instead of piping your kill ring through external programs, like xclip or pbcopy, have Emacs emit OSC-52 escape codes instead, allowing Emacs to communicate with your clipboard through your terminal, even across SSH connections or Tmux. However, this requires a supported terminal.

Plugins

Prerequisites

This module has no hard prerequisites, but in order for its features to work you need:

  • For system clipboard integration:
    • A supported clipboard program, such as:
      • Linux: xclip, xsel, or wl-clibpoard (Wayland)
      • macOS: pbcopy and pbpaste (included with macOS)
      • Windows: getclip and putclip (cygwin)
    • (If +osc is enabled) A terminal that supports OSC 52 escape codes, such as: xterm (unix), iTerm2 (macOS), alacritty (cross platform), kitty (macOS, linux), mintty (Windows), hterm (javascript), st (unix), mlterm (cross platform)
  • For cursor shape changing in the terminal you need A terminal that supports VT’s DECSCUSR sequence, such as: Gnome Terminal, xterm, iTerm (macOS), Konsole, or mintty (Windows). Terminal.app (macOS) is supported too, but requires SIMBL and MouseTerm Plus to work.

Configuration

True-color and italic support

This advice only applies to Emacs 26.x. True color support is built into 27.1+ and newer.

(credit goes to the spacemacs wiki for this information)

Create a xterm-24bit.terminfo file with the following contents:

xterm-24bit|xterm with 24-bit direct color mode,
   use=xterm-256color,
   sitm=\E[3m,
   ritm=\E[23m,
   setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
   setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

WARNING: Make sure you have a newline at end of file otherwise you will get errors!

Execute the following command on the command line:

tic -x -o ~/.terminfo xterm-24bit.terminfo

Now set your $TERM variable to xterm-24bit:

export TERM=xterm-24bit

SSH might break if your remote machine does not have the same setup, you can work around this with the following alias.

alias ssh="TERM=xterm-256color ssh"

If you use tmux, you need to make sure you installed a version with truecolor support, then add the following lines to your `.tmux.conf`:

set -g default-terminal "xterm-24bit"
set -g terminal-overrides ',xterm-24bit:Tc'

Also, make sure you have utf8 language variables if you want all characters to display correctly. For example:

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

Troubleshooting