doomemacs/modules/os/tty/README.org

114 lines
3.9 KiB
Org Mode
Raw Normal View History

#+TITLE: os/tty
#+DATE: August 7, 2020
#+SINCE: v3.0.0
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#configuration][Configuration]]
2020-08-08 03:06:26 -04:00
- [[#true-color-and-italic-support][True-color and italic support]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module configures Emacs for terminal usage.
+ System clipboard integration (through an external clipboard program or OSC-52
escape codes in supported terminals).
+ Fixes cursor-shape changing across evil states in terminal that support it.
+ Mouse support in the terminal.
** Maintainers
This module has no dedicated maintainers.
** Module Flags
+ =+osx= 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 to your clipboard through your terminal. This allows for clipboard
communication over SSH connections or tmux. However, this requires [[https://github.com/spudlyo/clipetty#terminals-that-support-osc-clipboard-operations][a supported
terminal]].
** Plugins
+ clipetty
+ evil-terminal-cursor-changer
+ xclip
* 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)
+ 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:
+ A terminal that supports VT's DECSCUSR sequence, such as:
Gnome Terminal, xterm, iTerm (macOS), Konsole, or mintty (Windows).
Terminal.app (macOS) is supported to, but requires [[http://www.culater.net/software/SIMBL/SIMBL.php][SIMBL]] and [[https://github.com/saitoha/mouseterm-plus/releases][MouseTerm]] Plus
to work.
* Configuration
** True-color and italic support
#+begin_quote
This advice only applies to Emacs 26.x. True color support is [[https://github.com/emacs-mirror/emacs/commit/7f6153d9563cfe7753083996f59eacc9f4c694df][built into 27.1+
and newer]].
#+end_quote
(credit goes to [[https://github.com/syl20bnr/spacemacs/wiki/Terminal][the spacemacs wiki]] for this information)
Create a =xterm-24bit.terminfo= file with the following contents:
#+BEGIN_SRC text
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,
#+END_SRC
#+begin_quote
WARNING: Make sure you have a newline at end of file otherwise you will get
errors!
#+end_quote
Execute the following command on the command line:
#+BEGIN_SRC sh
tic -x -o ~/.terminfo xterm-24bit.terminfo
#+END_SRC
Now set your ~$TERM~ variable to ~xterm-24bit~:
#+BEGIN_SRC sh
export TERM=xterm-24bit
#+END_SRC
SSH might break if your remote machine does not have the same setup, you can
work around this with the following alias.
#+BEGIN_SRC sh
alias ssh="TERM=xterm-256color ssh"
#+END_SRC
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`:
#+BEGIN_SRC conf
set -g default-terminal "xterm-24bit"
set -g terminal-overrides ',xterm-24bit:Tc'
#+END_SRC
Also, make sure you have utf8 language variables if you want all characters to
display correctly. For example:
#+BEGIN_SRC bash
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
#+END_SRC
* Troubleshooting
# Common issues and their solution, or places to look for help.