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.

  • It should be treated as a bug, shouldn't it? – BrunoJCM Dec 29 '16 at 13:36
up vote 4 down vote accepted

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
  • 1
    This does not work once you log to another host with ssh as the TERM_PROGRAM variables is not defined anymore. Any idea? – anumi Jul 21 '16 at 13:13

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.