7

I use the fish shell. I'm trying to run vim inside tmux with the solarized theme, but the colors are broken unless I run:

set -lx TERM screen-256color-bce;

before running tmux attach.

It's annoying having to run this every day, so I want to set the TERM variable permanently. However, fish seems to ignore when I set this particular variable with set -U:

$ set -U foo bar; echo $foo
foo bar
$ set -U TERM screen-256color-bce; echo $TERM
TERM xterm
$ set -lx TERM screen-256color-bce; echo $TERM
TERM screen-256color-bce

I even tried putting set -lx TERM screen-256color-bce in ~/.config/fish/config.fish, but a new fish (initiated outside tmux) always has TERM set to xterm.

sjy
  • 207
  • 2
  • 8
  • Since this question was just upvoted, I should mention that I reported this as an [issue on GitHub](https://github.com/fish-shell/fish-shell/issues/806). It is known, and now documented, behaviour. – sjy Sep 07 '15 at 11:39

3 Answers3

3
set -gx TERM screen-256color-bce;

I had the exact same problem as you. replace the "l" with "g" as g means global.

Brian Yeh
  • 131
  • 4
2

You can set it from the terminal using

set -Ux TERM screen-256color-bce

You don't need to put it in your config file this way.

  • -U if for Universal
  • -g is for Global
  • -x if for eXport
rayfranco
  • 121
  • 2
  • I'm not sure if this was the case at the beginning of last year, but it is not the case anymore. The problem is TERM is set as a global variable (`g`), meaning it ignores a universal (`U`) TERM variable. – trysis Mar 16 '17 at 15:38
0

This seems to be what you are looking for:

https://wiki.archlinux.org/index.php/Tmux#Setting_the_correct_term

lsd
  • 1,653
  • 10
  • 8
  • 1
    That page describes what I'm trying to do (set `TERM` to `screen-256color-bce`), but it doesn't explain why I can only set this variable locally in the fish shell. – sjy Jan 18 '13 at 04:07
  • 1
    set -g default-terminal "screen-256color" – lsd Jan 18 '13 at 12:52
  • I have never used fish shell, so I may not be much help. Try some debugging, but some echo statements just before the set and after, make sure they are run, and print the value of TERm right after it is set.... if the debug statements don't print, it is possible the script isn't being run. – lsd Jan 18 '13 at 13:02