fdd76fc5 |
1 | # turns on bash autocompletion |
2 | if [ -f /etc/profile.d/bash_completion.sh ]; then |
3 | . /etc/profile.d/bash_completion.sh |
4 | fi |
5 | |
9f331f7a |
6 | # sets buttons on wacom tablet |
7 | if [ -f ~/.local/share/wacomsetter.sh ]; then |
8 | . ~/.local/share/wacomsetter.sh |
9 | fi |
10 | |
fdd76fc5 |
11 | user_color=32m |
12 | if [ ${UID} -eq 0 ] |
13 | then |
14 | user_color=31m |
15 | fi |
16 | |
3f56b6e0 |
17 | bash_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 |
55 | export PROMPT_COMMAND=bash_prompt |
56 | |
57 | # turns on git prompt |
58 | if [ -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 |
66 | fi |
fdd76fc5 |
67 | |
68 | alias su="su -" |
69 | alias ls="ls --color -lh" |
70 | alias cp="cp -v" |
71 | alias rm="rm -v" |
72 | alias mv="mv -v" |
73 | alias chmod="chmod -v" |
74 | alias chown="chown -v" |
75 | alias apropos="wtf is" |
76 | alias free="free -m" |
77 | alias df="df -h" |
78 | alias du="du -sh" |
79 | alias diff='diff --color=auto' |
80 | alias grep='grep --color=auto' |
3f56b6e0 |
81 | alias path='(IFS=:;ls -1d $PATH | nl)' |
82 | alias hf='history|grep' |
83 | |
84 | # history as big as possible!! |
85 | HISTSIZE=1000000 |
86 | HISTFILESIZE=2000000 |
87 | HISTIGNORE='hf *' |
88 | # unix.stackexchange.com/a/18443 |
89 | # history: erase duplicates... |
90 | HISTCONTROL=ignoreboth:erasedups |
91 | shopt -s histappend |
92 | |
fdd76fc5 |
93 | |
94 | |
9f331f7a |
95 | export PATH=~/.platformio/penv/bin:~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH |
fdd76fc5 |
96 | export INTEL_BATCH=1 |
97 | export QT_QPA_PLATFORMTHEME="lxqt" |
98 | export QT_STYLE_OVERRIDE="kvantum-dark" |
99 | export XDG_DATA_DIRS="/usr/local/share/:/usr/share/" |
100 | |
101 | # Tailoring LESS |
102 | alias more='less' |
103 | export LESS='-R' |
104 | export LESSOPEN='|~/.lessfilter %s' |
105 | export PAGER=less |
106 | export SVN_EDITOR=vim |
107 | export LESSCHARSET='latin1' |
108 | |
109 | man() { |
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 |
120 | export SUDO_ASKPASS=/usr/bin/lxsudo |
121 | |
9f331f7a |
122 | # password store directory |
123 | export PASSWORD_STORE_DIR=/home/danix/Programming/GIT/password_store/ |
124 | |
fdd76fc5 |
125 | # logdate appends a date to a script output |
126 | logdate() { |
127 | while IFS= read -r line; do |
128 | echo "$(date +"%F_%R.%S") $line" |
129 | done |
130 | } |
131 | |
132 | unset GPG_AGENT_INFO |
133 | unset SSH_AGENT_PID |
134 | if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then |
6a1cebe5 |
135 | export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" |
fdd76fc5 |
136 | fi |
6a1cebe5 |
137 | export GPG_TTY=$(tty) |
fdd76fc5 |
138 | if [ -x "$(which gpg-connect-agent)" ]; then |
6a1cebe5 |
139 | gpg-connect-agent updatestartuptty /bye > /dev/null |
fdd76fc5 |
140 | fi |
141 | |
3f56b6e0 |
142 | mount-fs () { |
143 | ( echo Filesystem Mountpoint Fstype; |
144 | mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}' |
145 | ) | column -t |
146 | } |