1
0

Importing stuff from the private repo.

This commit is contained in:
2020-10-28 08:34:01 +01:00
parent 2585416327
commit a0e67a0bce
5 changed files with 113 additions and 0 deletions

4
bashhacks/myenv.bash Normal file
View File

@@ -0,0 +1,4 @@
export PYTHONDONTWRITEBYTECODE=1
export CLICOLOR=1
export EDITOR=vim
export LC_ALL="en_US.UTF-8"

59
bashhacks/prompt.bash Normal file
View File

@@ -0,0 +1,59 @@
function _ps_name_and_server {
echo "`whoami`@`hostname -s`"
}
function _ps_git_branch_and_status {
_GIT_STATUS="`git status --porcelain 2>/dev/null`"
if [ $? -eq 0 ];then
_GIT_DIRTY=""
if [ "$_GIT_STATUS" != "" ];then
_GIT_DIRTY="*"
fi
_GIT_BRANCH="`git branch --no-color | grep '*' | cut -d ' ' -f 2`"
echo " $_GIT_BRANCH$_GIT_DIRTY"
else
echo ""
fi
}
function _ps_virtual_env {
if [ "$VIRTUAL_ENV" != "" ];then
echo " `basename $VIRTUAL_ENV`"
fi
}
function _ps_prompt {
# regular colors
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
# emphasized (bolded) colors
local BK="\[\033[1;30m\]"
local BR="\[\033[1;31m\]"
local BG="\[\033[1;32m\]"
local BY="\[\033[1;33m\]"
local BB="\[\033[1;34m\]"
local BM="\[\033[1;35m\]"
local BC="\[\033[1;36m\]"
local BW="\[\033[1;37m\]"
# reset
local RESET="\[\033[0;37m\]"
local HOST="$RESET@$BB\h"
if [ -z "$SSH_CONNECTION" ];then
HOST=""
fi
echo "$Y\u$HOST $BG\w$C$(_ps_virtual_env)$M$(_ps_git_branch_and_status) $Y\$$RESET "
}
PS1=$(_ps_prompt)
PROMPT_COMMAND='PS1=$(_ps_prompt)'

11
bashhacks/tmux.bash Normal file
View File

@@ -0,0 +1,11 @@
alias dtmux="direnv exec / tmux"
function tm {
if [ "$1" == "" ];then
_TM_SESSION="tmdefault"
else
_TM_SESSION=$1
fi
dtmux attach -t $_TM_SESSION 2>/dev/null || dtmux new -s $_TM_SESSION
}