logo

dotfiles

My dotfiles, one branch per machine, rebased on base git clone https://hacktivis.me/git/dotfiles.git
commit: 22b420df21634a6e2881bcf3bb75ad5599dd579b
parent d774b8db6eae063845934368b9a90820ed4d036c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  3 May 2021 13:24:08 +0200

.common.sh: Add № of jobs to PS1

Diffstat:

M.common.sh12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/.common.sh b/.common.sh @@ -59,13 +59,21 @@ case $(hostname) in *) host_ansi="31" ;; esac +jobs_pp() { + job_count="$(jobs | wc -l)" + + if [[ "${job_count}" != "0" ]]; then + echo -n "${job_count}⏾" + fi +} + case $SHELL in *ksh*) # hack derived from ksh88(1), works in mksh, doesn't works in bash - export PS1=' $?$(date +w%wT%T)${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' + export PS1=' $(jobs_pp)$?$(date +w%wT%T)${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' ;; *bash*) - export PS1='\[\e[47;30m\]$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] ' + export PS1='\[\e[47;30m\]$(jobs_pp)$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] ' ;; *) # Don't even try escape codes, and so no powerline-style