Jobs in ps1, renamed bashrc to bash/rc

This commit is contained in:
Eric Teunis de Boone 2016-10-11 23:18:39 +02:00
parent da8ef4041a
commit 8fc77963e6
6 changed files with 32 additions and 7 deletions

View File

@ -51,6 +51,12 @@ function __prompt_command() {
if [ -n $RETVAL ]; then
PS1+="$(retval ${RETVAL})"
fi
### Add amount of jobs ###
if true; then
PS1+="$(jobscount)"
fi
### Add Git Status ###
if [[ $(command -v git) ]]; then
PS1+="$(git_status) "
@ -73,6 +79,7 @@ function __prompt_command() {
'fatserf') PS1+="${Pur}\H${RCol}";;
'lilo'*) PS1+="${BWhi}\H${RCol}";;
'hg'*) PS1+="${BRed}\H${RCol}";;
'gouda'|'bunnik'|'houten'|'zandberg'|'bussum') PS1+="${Gre}${On_Whi}HEF:${Blu}${On_Whi}\H${RCol}";;
*) PS1+="${Blu}${On_Whi}\H${RCol}";;
esac
else
@ -121,6 +128,13 @@ function retval() {
echo "${PS1}"
}
### count jobs
function jobscount() {
local stopped=$(jobs -sp | wc -l)
local running=$(jobs -rp | wc -l)
((running+stopped)) && echo -n "${IYel}${running}${RCol}|${Yel}${stopped}${RCol}"
}
function git_status() {
### Determine Git Status
local PS1

View File

@ -1,3 +1,13 @@
# ~/.bash_profile
[ -z "$DOTFILES" ] && source "$HOME/.profile"
[ -r "$HOME/.bash_profile.local" ] && source "$HOME/.bash_profile.local"
if shopt -q login_shell
then
# This is a bash login shell
LOGINHISTORY=~/.login.history
LOGINSTRING="$(date) ${USER}@${HOSTNAME}"
echo $LOGINSTRING > $LOGINHISTORY
fi

View File

@ -6,7 +6,8 @@
- clean: ['~']
- link:
~/.bashrc: bash/bashrc
~/.bashrc: bash/rc
~/.bash_profile: bash/profile
~/.gitconfig: git/gitconfig
~/.gitignore_global: git/gitignore_global
~/.ncmpcpp/config: ncmpcpp/config

View File

View File

@ -30,7 +30,7 @@ then
fi
# Source Bashrc if BASH
if [ "$BASH" ] && [ -f $DOTFILES/bash/bashrc ]
if [ "$BASH" ] && [ -f $DOTFILES/bash/rc ]
then
source $DOTFILES/bash/bashrc
source $DOTFILES/bash/rc
fi