Nano Text Editor and $TERM

The nano text editor is installed in the house network but seldom used. Usually mcedit is used when editing text files outside a desktop environment.

Nano will not launch inside a KDE Konsole terminal window. The error is Error opening terminal: xterm-256color.

Searching the web found no useful explanation for the error. The presumption then is nano does not support 256 colors.

The failure also occurs with the Xfce terminal but not with TDE Konsole. The latter environment does not modify the $TERM environment variable. Nano launches as expected in a TDE Konsole terminal session.

The default KDE Konsole sets the session environment with the following:


    TERM=xterm-256color
    COLORTERM=truecolor
    

KDE Konsole could be reconfigured but that seems like a sledge hammer approach only to fix the nano text editor. The solution in the house network was to create an alias:

alias nano='if [ “$(echo $TERM” | grep 256")” != "" ]; then TERM_ORIG=$TERM; TERM=xterm; fi; nano; TERM=$TERM_ORIG'

Posted: Category: Usability Tagged: General

Next: Cron Jobs on the First Saturday of the Month

Previous: Dictionary Translations