Detects whether the current shell is running under mosh or not.
It even works in a shell running inside tmux sessions, attached from a mosh session.
You can either source the script or execute it as a sub-shell.
if is_mosh; then
echo 'running under mosh'
else
echo 'It is not under mosh'
fi
Try is_mosh -v
or is_mosh --verbose
to see messages printed to stdout (mosh
or not mosh
).
NOTE: pstree
and tmux 2.1+ are required (#1).
mosh
is awesome, but doesn't support 24-bit true color.
I needed a way to detect and disable true color feature on mosh environments.
To see an example of vimrc to automatically turn on/off termguicolors, see my vimrc.
Please see a stackexchange thread for the discussion.
The MIT License (c) 2017-2020 Jongwook Choi (@wookayin)