Skip to content

Shell integration is spuriously enabled with fish shell on 256-color tmux

Thanks for filing an issue! Please answer the questions below so I can help you.

  • iTerm2 version: 3.4.8
  • OS version: 11.4

com.googlecode.iterm2.plist

Detailed steps to reproduce the problem: 1. 2. Use fish(1) as your shell. 3. Use tmux(1) with set-option -g default-terminal "screen-256color" in your ~/.tmux.conf. 4. Install shell integration. 5. set -e ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX (just in case) 6. Start a tmux session.

What happened: Shell integration is enabled inside tmux. Triangles everywhere! (See: #3118.)

What should have happened: Shell integration should be disabled inside tmux.

It's this check at the top of ~/.iterm2_shell_integration.fish that's letting screen-256color through:

if begin; status --is-interactive; and not functions -q -- iterm2_status; and [ "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != screen ]; and [ "$TERM" != dumb ]; and [ "$TERM" != linux ]; end

I'm using this instead:

if begin
    status --is-interactive
    and not functions -q iterm2_status
    and test $TERM != dumb -a $TERM != linux
    and begin
        not string match -qr '^screen' $TERM
        or test -n $ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX
    end
end

It accounts for screen-256color and also looks a bit fishier.

I'd submit a merge request but I'm not set up to push to GitLab at the moment. I hope this is helpful.

Edited by Sam Hathaway