From 076c81c4eeb49118f0193469a9e41050eb1d1077 Mon Sep 17 00:00:00 2001 From: Lucius Hu Date: Wed, 20 Feb 2019 18:04:40 -0500 Subject: [PATCH] Add notes on getting sudo to preserve TERMINFO to the FAQ --- docs/faq.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/faq.rst b/docs/faq.rst index 8a0f14f8e..5722a7e3e 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -81,6 +81,19 @@ Shell providing the right terminfo path:: sudo … env TERMINFO=$HOME/.terminfo bash -i TERMINFO=/home/ORIGINALUSER/.terminfo exec bash -i +Alternatively, if you want to keep TERMINFO automatically whenever you run a ``sudo`` +command, you can edit the `/etc/sudoers.d/visudo` file by executing this shell command: + + sudo visudo + +Then add the following content: + + Defaults env_keep += "TERM TERMINFO" + +Save the file and from now on `sudo` will correctly identify `xterm-kitty`. +This is based on the trick provided [here](https://stackoverflow.com/a/8636711/5715571), +and has been tested on Clear Linux (27910). + If you have double width characters in your prompt, you may also need to explicitly set a UTF-8 locale, like::