Cross Platform Terminal

Please note: This article is only available in English.
After years I have finally found a great cross-platform terminal solution.

Since years I try to find a setup that allows me to move between Linux, Windows, and eventually MacOS without having to change tools. Years ago I settled for Sublime Text (2 then 3) as the editor solution (even though I mostly prefer VS Code these days). Nevertheless, while the IDE experience was covered, a proper cross-platform terminal was still missing.

I great relief was the introduction of WSL (Windows Subsystem for Linux). Finally, I could just focus on the *nix part for my CLI experience. Still, using something like cmder on Windows, Terminal on MacOS, and the standard command line on, e.g., Ubuntu, left me with duplicated configuration and differences in behavior (e.g., copying / pasting).

I think two years ago (but maybe even longer) that changed with the introduction of Hyper - another Electron-based app. Having a x-plat UI technology underneath makes it possible to be reused on different platforms. However, with Hyper (and many of its successors) I never got warm. It always felt quite strange to me.

I guess 3 months ago I discovered another Electron-based solution called Terminus. This is a wonderful solution that just seems to work. Best of all, it has support for WSL out of the box. This means, that I do not have to fiddle with some configuration to get WSL working on Windows. I just install this solution, potentially change some of the preset hotkeys (or reuse any configuration that I already created) and I'm good to go.

As for Git I changed a few bits (independent of Terminus).

My .bashrc (on MacOS) looks like:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
    source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
    source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
fi
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '


# source /usr/local/git/contrib/completion/git-completion.bash
# GIT_PS1_SHOWDIRTYSTATE=true
# export PS1='[\u@mbp \w$(__git_ps1)]\$ '

In order to also work with Terminus, which of course, uses login shells instead of interactive ones I also changed my .bash_profile:

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

The difference between an interactive shell and a login shell is simply explained: A login shell creates a new shell session (with a new user login - as the name suggests), while the interactive shell can be thought of as an (interactive, i.e., standard REPL) shell session within a shell session. Hence login shell could be said "parent shell", while an interactive shell could be considered a "child shell".

Created .

References

Sharing is caring!