added wacom setup script, invoked by bashrc
[my-dotfiles.git] / bashrc
CommitLineData
fdd76fc5 1# turns on bash autocompletion
2if [ -f /etc/profile.d/bash_completion.sh ]; then
3 . /etc/profile.d/bash_completion.sh
4fi
5
9f331f7a 6# sets buttons on wacom tablet
7if [ -f ~/.local/share/wacomsetter.sh ]; then
8 . ~/.local/share/wacomsetter.sh
9fi
10
fdd76fc5 11user_color=32m
12if [ ${UID} -eq 0 ]
13then
14 user_color=31m
15fi
16
3f56b6e0 17bash_prompt() {
18 local NONE="\[\033[0m\]" # unsets color to term's fg color
9f331f7a 19
3f56b6e0 20 # regular colors
21 local K="\[\033[0;30m\]" # black
22 local R="\[\033[0;31m\]" # red
23 local G="\[\033[0;32m\]" # green
24 local Y="\[\033[0;33m\]" # yellow
25 local B="\[\033[0;34m\]" # blue
26 local M="\[\033[0;35m\]" # magenta
27 local C="\[\033[0;36m\]" # cyan
28 local W="\[\033[0;37m\]" # white
9f331f7a 29
3f56b6e0 30 # emphasized (bolded) colors
31 local EMK="\[\033[1;30m\]"
32 local EMR="\[\033[1;31m\]"
33 local EMG="\[\033[1;32m\]"
34 local EMY="\[\033[1;33m\]"
35 local EMB="\[\033[1;34m\]"
36 local EMM="\[\033[1;35m\]"
37 local EMC="\[\033[1;36m\]"
38 local EMW="\[\033[1;37m\]"
9f331f7a 39
3f56b6e0 40 # background colors
41 local BGK="\[\033[40m\]"
42 local BGR="\[\033[41m\]"
43 local BGG="\[\033[42m\]"
44 local BGY="\[\033[43m\]"
45 local BGB="\[\033[44m\]"
46 local BGM="\[\033[45m\]"
47 local BGC="\[\033[46m\]"
48 local BGW="\[\033[47m\]"
9f331f7a 49
6a1cebe5 50 local UC=$EMG
51 [ $UID -eq "0" ] && UC=$EMR
9f331f7a 52
6a1cebe5 53 PS1="${UC}\u ${NONE}@ ${EMB}\h ${NONE}{ ${M}\d ${NONE}} ${W}${BGG}[ \w ]${NONE}\n\#$(__git_ps1) ${UC}\\$> ${NONE}"
3f56b6e0 54}
6a1cebe5 55export PROMPT_COMMAND=bash_prompt
56
57# turns on git prompt
58if [ -f /home/danix/.git-prompt.sh ]; then
59 GIT_PS1_SHOWDIRTYSTATE=true
60 GIT_PS1_SHOWSTASHSTATE=true
61 GIT_PS1_SHOWUNTRACKEDFILES=true
62 GIT_PS1_SHOWUPSTREAM="auto"
63 GIT_PS1_HIDE_IF_PWD_IGNORED=true
64 GIT_PS1_SHOWCOLORHINTS=true
65 . /home/danix/.git-prompt.sh
66fi
fdd76fc5 67
68alias su="su -"
69alias ls="ls --color -lh"
70alias cp="cp -v"
71alias rm="rm -v"
72alias mv="mv -v"
73alias chmod="chmod -v"
74alias chown="chown -v"
75alias apropos="wtf is"
76alias free="free -m"
77alias df="df -h"
78alias du="du -sh"
79alias diff='diff --color=auto'
80alias grep='grep --color=auto'
3f56b6e0 81alias path='(IFS=:;ls -1d $PATH | nl)'
82alias hf='history|grep'
83
84# history as big as possible!!
85HISTSIZE=1000000
86HISTFILESIZE=2000000
87HISTIGNORE='hf *'
88# unix.stackexchange.com/a/18443
89# history: erase duplicates...
90HISTCONTROL=ignoreboth:erasedups
91shopt -s histappend
92
fdd76fc5 93
94
9f331f7a 95export PATH=~/.platformio/penv/bin:~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH
fdd76fc5 96export INTEL_BATCH=1
97export QT_QPA_PLATFORMTHEME="lxqt"
98export QT_STYLE_OVERRIDE="kvantum-dark"
99export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
100
101# Tailoring LESS
102alias more='less'
103export LESS='-R'
104export LESSOPEN='|~/.lessfilter %s'
105export PAGER=less
106export SVN_EDITOR=vim
107export LESSCHARSET='latin1'
108
109man() {
110 LESS_TERMCAP_md=$'\e[01;31m' \
111 LESS_TERMCAP_me=$'\e[0m' \
112 LESS_TERMCAP_se=$'\e[0m' \
113 LESS_TERMCAP_so=$'\e[01;44;33m' \
114 LESS_TERMCAP_ue=$'\e[0m' \
115 LESS_TERMCAP_us=$'\e[01;32m' \
116 command man "$@"
117}
118
119# sudo password helper
120export SUDO_ASKPASS=/usr/bin/lxsudo
121
9f331f7a 122# password store directory
123export PASSWORD_STORE_DIR=/home/danix/Programming/GIT/password_store/
124
fdd76fc5 125# logdate appends a date to a script output
126logdate() {
127 while IFS= read -r line; do
128 echo "$(date +"%F_%R.%S") $line"
129 done
130}
131
132unset GPG_AGENT_INFO
133unset SSH_AGENT_PID
134if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
6a1cebe5 135 export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fdd76fc5 136fi
6a1cebe5 137export GPG_TTY=$(tty)
fdd76fc5 138if [ -x "$(which gpg-connect-agent)" ]; then
6a1cebe5 139 gpg-connect-agent updatestartuptty /bye > /dev/null
fdd76fc5 140fi
141
3f56b6e0 142mount-fs () {
143 ( echo Filesystem Mountpoint Fstype;
144 mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}'
145 ) | column -t
146}