1
0
Fork 0
mirror of https://github.com/kastdeur/dotfiles.git synced 2024-12-22 09:13:33 +01:00

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 if [ -n $RETVAL ]; then
PS1+="$(retval ${RETVAL})" PS1+="$(retval ${RETVAL})"
fi fi
### Add amount of jobs ###
if true; then
PS1+="$(jobscount)"
fi
### Add Git Status ### ### Add Git Status ###
if [[ $(command -v git) ]]; then if [[ $(command -v git) ]]; then
PS1+="$(git_status) " PS1+="$(git_status) "
@ -73,6 +79,7 @@ function __prompt_command() {
'fatserf') PS1+="${Pur}\H${RCol}";; 'fatserf') PS1+="${Pur}\H${RCol}";;
'lilo'*) PS1+="${BWhi}\H${RCol}";; 'lilo'*) PS1+="${BWhi}\H${RCol}";;
'hg'*) PS1+="${BRed}\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}";; *) PS1+="${Blu}${On_Whi}\H${RCol}";;
esac esac
else else
@ -118,7 +125,14 @@ function retval() {
fi fi
fi fi
echo "${PS1} " 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() { function git_status() {
@ -134,7 +148,7 @@ function git_status() {
## Check if more than 60 minutes since last ## Check if more than 60 minutes since last
if [ "${TIME}" -gt "3600" ]; then if [ "${TIME}" -gt "3600" ]; then
git fetch 2>/dev/null git fetch 2>/dev/null
PS1+=' +' PS1+='+ '
## Refresh var ## Refresh var
local GStat="$(git status --porcelain -b 2>/dev/null | tr '\n' ':')" local GStat="$(git status --porcelain -b 2>/dev/null | tr '\n' ':')"
fi fi
@ -162,7 +176,7 @@ function git_status() {
fi fi
### End Branch ### }}} ### End Branch ### }}}
PS1+=" ${GitCol}[$GBra]${RCol}" # Add result to prompt PS1+="${GitCol}[$GBra]${RCol}" # Add result to prompt
### Find Commit Status ### {{{ ### Find Commit Status ### {{{
## Test Modified and Untracked for "0" ## Test Modified and Untracked for "0"

View file

@ -1,3 +1,13 @@
# ~/.bash_profile
[ -z "$DOTFILES" ] && source "$HOME/.profile" [ -z "$DOTFILES" ] && source "$HOME/.profile"
[ -r "$HOME/.bash_profile.local" ] && source "$HOME/.bash_profile.local" [ -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: ['~'] - clean: ['~']
- link: - link:
~/.bashrc: bash/bashrc ~/.bashrc: bash/rc
~/.bash_profile: bash/profile
~/.gitconfig: git/gitconfig ~/.gitconfig: git/gitconfig
~/.gitignore_global: git/gitignore_global ~/.gitignore_global: git/gitignore_global
~/.ncmpcpp/config: ncmpcpp/config ~/.ncmpcpp/config: ncmpcpp/config

View file

View file

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