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