modificato: i3/config
[my-dotfiles.git] / bashrc
1 export GIT_PS1_SHOWCOLORHINTS=true
2 export GIT_PS1_SHOWUNTRACKEDFILES=true
3 export GIT_PS1_SHOWDIRTYSTATE=true
4 export GIT_PS1_SHOWSTASHSTATE=true
5
6 # turns on bash autocompletion
7 if [ -f /etc/profile.d/bash_completion.sh ]; then
8 . /etc/profile.d/bash_completion.sh
9 fi
10
11 user_color=32m
12 if [ ${UID} -eq 0 ]
13 then
14 user_color=31m
15 fi
16
17 bash_prompt() {
18 local NONE="\[\033[0m\]" # unsets color to term's fg color
19
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
29
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\]"
39
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\]"
49
50 local UC=$EMG # user's color
51 [ $UID -eq "0" ] && UC=$EMR # root's color
52
53 PS1="${UC}\u ${NONE}@ ${EMB}\h ${NONE}{ ${M}\d ${NONE}} ${G}[ ${NONE}\w ${G}] ${NONE}\n\# ${UC}\\$> ${NONE}"
54 }
55 bash_prompt
56
57 alias su="su -"
58 alias ls="ls --color -lh"
59 alias cp="cp -v"
60 alias rm="rm -v"
61 alias mv="mv -v"
62 alias chmod="chmod -v"
63 alias chown="chown -v"
64 alias apropos="wtf is"
65 alias free="free -m"
66 alias df="df -h"
67 alias du="du -sh"
68 alias diff='diff --color=auto'
69 alias grep='grep --color=auto'
70 alias path='(IFS=:;ls -1d $PATH | nl)'
71 alias hf='history|grep'
72
73 # history as big as possible!!
74 HISTSIZE=1000000
75 HISTFILESIZE=2000000
76 HISTIGNORE='hf *'
77 # unix.stackexchange.com/a/18443
78 # history: erase duplicates...
79 HISTCONTROL=ignoreboth:erasedups
80 shopt -s histappend
81
82
83
84 export PATH=~/.local/bin:~/bin:$PATH
85 export INTEL_BATCH=1
86 export QT_QPA_PLATFORMTHEME="lxqt"
87 export QT_STYLE_OVERRIDE="kvantum-dark"
88 export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
89
90 # Tailoring LESS
91 alias more='less'
92 export LESS='-R'
93 export LESSOPEN='|~/.lessfilter %s'
94 export PAGER=less
95 export SVN_EDITOR=vim
96 export LESSCHARSET='latin1'
97
98 man() {
99 LESS_TERMCAP_md=$'\e[01;31m' \
100 LESS_TERMCAP_me=$'\e[0m' \
101 LESS_TERMCAP_se=$'\e[0m' \
102 LESS_TERMCAP_so=$'\e[01;44;33m' \
103 LESS_TERMCAP_ue=$'\e[0m' \
104 LESS_TERMCAP_us=$'\e[01;32m' \
105 command man "$@"
106 }
107
108 # sudo password helper
109 export SUDO_ASKPASS=/usr/bin/lxsudo
110
111 # logdate appends a date to a script output
112 logdate() {
113 while IFS= read -r line; do
114 echo "$(date +"%F_%R.%S") $line"
115 done
116 }
117
118 unset GPG_AGENT_INFO
119 unset SSH_AGENT_PID
120 if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
121 export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
122 fi
123 GPG_TTY=$(tty)
124 export GPG_TTY
125 if [ -x "$(which gpg-connect-agent)" ]; then
126 gpg-connect-agent updatestartuptty /bye >& /dev/null
127 fi
128
129 mount-fs () {
130 ( echo Filesystem Mountpoint Fstype;
131 mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}'
132 ) | column -t
133 }
134