my shell prompt
A thread was recently promoted on nixers to show your shell prompt, so I’ll share some features of mine. I usually use bash with Emacs shell-mode, so I get vim bindings for free via evil, with the mode indicator being the cursor (’|’ vs ’█’). I usually use ’♥’ as a prompt character, but for the sake of this post I’ll use ’$’, as the heart can look wildly different depending on your font setup.
Errors and background processes:
$ false
! vim temp.txt
[1]+ Stopped vim temp.txt
$! true
$$ fg
vim temp
$
git stuff:
$ cd $(mktemp -d)
$ git init
Initialized empty Git repository in /tmp/tmp.enlQwywyEv/.git/
$ touch readme.md
? $ git checkout -b new_branch
Switched to a new branch 'new_branch'
(new_branch|?) $ git add readme.md
(new_branch|+) $ echo 'edit' >> readme.md
(new_branch|+*) $ git commit -m "initial"
[new_branch (root-commit) 3ff638e] initial
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 readme.md
(new_branch) $ git checkout -b master; git reset --hard
Switched to a new branch 'master'
HEAD is now at 3ff638e initial
$
non-standard environment detection (checks capital variables):
$ PYTHONPATH="$HOME/something/stateful"
E $ envv
PYTHONPATH=/home/neeasade/something/stateful
E $ unset PYTHONPATH
$
ssh hostname:
$ ssh super.cool.vps
trouw $ logout
$
and a hack that tells Emacs where the shell is (including tramp information – this is normally used in the prompt, I’m just showing it out here):
$ ssh super.cool.vps
trouw $ tell_emacs_shell_location
+Pr0mPT+/ssh:neeasade@192.0.2.0:/home/neeasade+
trouw $ logout
$
Source is here: ~/.sh.d/style