X-Git-Url: https://git.danix.xyz/?p=my-dotfiles.git;a=blobdiff_plain;f=bashrc;h=64257a2c460d618f9a224465f348ef594d548cf7;hp=f6a2be9b17a49660d587950b6c2624a827799bbb;hb=HEAD;hpb=3f56b6e0a6bbfcbb9e432d4547e0fdc4b8c9a710 diff --git a/bashrc b/bashrc index f6a2be9..6eade8a 100644 --- a/bashrc +++ b/bashrc @@ -1,8 +1,3 @@ -export GIT_PS1_SHOWCOLORHINTS=true -export GIT_PS1_SHOWUNTRACKEDFILES=true -export GIT_PS1_SHOWDIRTYSTATE=true -export GIT_PS1_SHOWSTASHSTATE=true - # turns on bash autocompletion if [ -f /etc/profile.d/bash_completion.sh ]; then . /etc/profile.d/bash_completion.sh @@ -16,7 +11,7 @@ fi bash_prompt() { local NONE="\[\033[0m\]" # unsets color to term's fg color - + # regular colors local K="\[\033[0;30m\]" # black local R="\[\033[0;31m\]" # red @@ -26,7 +21,7 @@ bash_prompt() { local M="\[\033[0;35m\]" # magenta local C="\[\033[0;36m\]" # cyan local W="\[\033[0;37m\]" # white - + # emphasized (bolded) colors local EMK="\[\033[1;30m\]" local EMR="\[\033[1;31m\]" @@ -36,7 +31,7 @@ bash_prompt() { local EMM="\[\033[1;35m\]" local EMC="\[\033[1;36m\]" local EMW="\[\033[1;37m\]" - + # background colors local BGK="\[\033[40m\]" local BGR="\[\033[41m\]" @@ -46,13 +41,25 @@ bash_prompt() { local BGM="\[\033[45m\]" local BGC="\[\033[46m\]" local BGW="\[\033[47m\]" - - local UC=$EMG # user's color - [ $UID -eq "0" ] && UC=$EMR # root's color - - PS1="${UC}\u ${NONE}@ ${EMB}\h ${NONE}{ ${M}\d ${NONE}} ${G}[ ${NONE}\w ${G}] ${NONE}\n\# ${UC}\\$> ${NONE}" + + local UC=$EMG + [ $UID -eq "0" ] && UC=$EMR + + PS1="${UC}\u ${NONE}@ ${EMB}\h ${NONE}{ ${M}\d ${NONE}} ${W}${BGY}${EMK}[ \w ]${NONE}\n\#$(__git_ps1) ${UC}\\$> ${NONE}" } -bash_prompt +export PROMPT_COMMAND=bash_prompt +printf "\033]0;%s@%s\007" "${LOGNAME}" "${HOSTNAME%%.*}" + +# turns on git prompt +if [ -f /home/danix/.git-prompt.sh ]; then + GIT_PS1_SHOWDIRTYSTATE=true + GIT_PS1_SHOWSTASHSTATE=true + GIT_PS1_SHOWUNTRACKEDFILES=true + GIT_PS1_SHOWUPSTREAM="auto" + GIT_PS1_HIDE_IF_PWD_IGNORED=true + GIT_PS1_SHOWCOLORHINTS=true + . /home/danix/.git-prompt.sh +fi alias su="su -" alias ls="ls --color -lh" @@ -68,12 +75,11 @@ alias du="du -sh" alias diff='diff --color=auto' alias grep='grep --color=auto' alias path='(IFS=:;ls -1d $PATH | nl)' -alias hf='history|grep' # history as big as possible!! HISTSIZE=1000000 HISTFILESIZE=2000000 -HISTIGNORE='hf *' +# HISTIGNORE='hf *' # unix.stackexchange.com/a/18443 # history: erase duplicates... HISTCONTROL=ignoreboth:erasedups @@ -81,19 +87,28 @@ shopt -s histappend -export PATH=~/.local/bin:~/bin:$PATH +#export PATH=~/.platformio/penv/bin:~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH +#export PATH=~/.config/composer/vendor/bin:~/.local/bin:~/bin:$PATH export INTEL_BATCH=1 export QT_QPA_PLATFORMTHEME="lxqt" export QT_STYLE_OVERRIDE="kvantum-dark" export XDG_DATA_DIRS="/usr/local/share/:/usr/share/" +export CM_LAUNCHER=rofi # Tailoring LESS +# If any syntax highlighters are available, use them. +# # pygmentize does more, but source-highlight is still good. +if command -v pygmentize > /dev/null 2>&1; then + export LESSCOLOURIZER="pygmentize -f terminal" +elif command -v source-highlight > /dev/null 2>&1; then + export LESSCOLOURIZER="source-highlight --failsafe --infer-lang -f esc --style-file=esc.style -i" +fi alias more='less' -export LESS='-R' +export LESS=' -R' export LESSOPEN='|~/.lessfilter %s' export PAGER=less export SVN_EDITOR=vim -export LESSCHARSET='latin1' +export LESSCHARSET='utf-8' man() { LESS_TERMCAP_md=$'\e[01;31m' \ @@ -108,22 +123,25 @@ man() { # sudo password helper export SUDO_ASKPASS=/usr/bin/lxsudo +# password store directory +export PASSWORD_STORE_DIR=/home/danix/Programming/GIT/password_store/ + # logdate appends a date to a script output logdate() { - while IFS= read -r line; do - echo "$(date +"%F_%R.%S") $line" - done + while IFS= read -r line; do + echo "$(date +"%F_%R.%S") $line" + done } +# start gpg-agent for ssh authentication as well as key management unset GPG_AGENT_INFO unset SSH_AGENT_PID if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh" + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi -GPG_TTY=$(tty) -export GPG_TTY +export GPG_TTY=$(tty) if [ -x "$(which gpg-connect-agent)" ]; then - gpg-connect-agent updatestartuptty /bye >& /dev/null + gpg-connect-agent updatestartuptty /bye > /dev/null fi mount-fs () { @@ -131,4 +149,3 @@ mount-fs () { mount | \grep -E '^[^[:lower:]_-]+' | awk '{print $1,$3,$5}' ) | column -t } -