modificato: i3/config
[my-dotfiles.git] / bashrc
CommitLineData
fdd76fc5 1export GIT_PS1_SHOWCOLORHINTS=true
2export GIT_PS1_SHOWUNTRACKEDFILES=true
3export GIT_PS1_SHOWDIRTYSTATE=true
4export GIT_PS1_SHOWSTASHSTATE=true
5
6# turns on bash autocompletion
7if [ -f /etc/profile.d/bash_completion.sh ]; then
8 . /etc/profile.d/bash_completion.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
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}
55bash_prompt
fdd76fc5 56
57alias su="su -"
58alias ls="ls --color -lh"
59alias cp="cp -v"
60alias rm="rm -v"
61alias mv="mv -v"
62alias chmod="chmod -v"
63alias chown="chown -v"
64alias apropos="wtf is"
65alias free="free -m"
66alias df="df -h"
67alias du="du -sh"
68alias diff='diff --color=auto'
69alias grep='grep --color=auto'
3f56b6e0 70alias path='(IFS=:;ls -1d $PATH | nl)'
71alias hf='history|grep'
72
73# history as big as possible!!
74HISTSIZE=1000000
75HISTFILESIZE=2000000
76HISTIGNORE='hf *'
77# unix.stackexchange.com/a/18443
78# history: erase duplicates...
79HISTCONTROL=ignoreboth:erasedups
80shopt -s histappend
81
fdd76fc5 82
83
84export PATH=~/.local/bin:~/bin:$PATH
85export INTEL_BATCH=1
86export QT_QPA_PLATFORMTHEME="lxqt"
87export QT_STYLE_OVERRIDE="kvantum-dark"
88export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
89
90# Tailoring LESS
91alias more='less'
92export LESS='-R'
93export LESSOPEN='|~/.lessfilter %s'
94export PAGER=less
95export SVN_EDITOR=vim
96export LESSCHARSET='latin1'
97
98man() {
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
109export SUDO_ASKPASS=/usr/bin/lxsudo
110
111# logdate appends a date to a script output
112logdate() {
113 while IFS= read -r line; do
114 echo "$(date +"%F_%R.%S") $line"
115 done
116}
117
118unset GPG_AGENT_INFO
119unset SSH_AGENT_PID
120if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
121 export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh"
122fi
123GPG_TTY=$(tty)
124export GPG_TTY
125if [ -x "$(which gpg-connect-agent)" ]; then
126 gpg-connect-agent updatestartuptty /bye >& /dev/null
127fi
128
3f56b6e0 129mount-fs () {
130 ( echo Filesystem Mountpoint Fstype;
131 mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}'
132 ) | column -t
133}
134