Fish terminal + iTerm, only run shell integration if terminal is iTerm

4

iTerm has a shell integration script that enables some fancy features, as in having the ability to scroll up to last prompt (in case if there was a lot of stdout i.e. when compiling some code). However if the terminal is not iTerm, that shell script fails and pollutes the prompt.

I'm trying to clean it up as in only run the shell integration if the terminal is iTerm.

Adnan Y

Posted 2016-05-03T20:44:07.917

Reputation: 191

It should be treated as a bug, shouldn't it? – BrunoJCM – 2016-12-29T13:36:41.940

Answers

4

Putting this in your ~/.config/fish/config.fish should do the trick

if test $TERM_PROGRAM = iTerm.app
    test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish
end

Adnan Y

Posted 2016-05-03T20:44:07.917

Reputation: 191

1This does not work once you log to another host with ssh as the TERM_PROGRAM variables is not defined anymore. Any idea? – anumi – 2016-07-21T13:13:21.483

0

Putting this in your ~/.config/fish/config.fish should do the trick and check for $TERM_PROGRAM having been set.

test -n "$TERM_PROGRAM"
and test $TERM_PROGRAM = iTerm.app
and test -e {$HOME}/.iterm2_shell_integration.fish
and source {$HOME}/.iterm2_shell_integration.fish

SkydiveMike

Posted 2016-05-03T20:44:07.917

Reputation: 51