diff options
| author | Mehdi Sadeghi <mehdi@mehdix.org> | 2021-08-29 19:28:47 +0200 |
|---|---|---|
| committer | Mehdi Sadeghi <mehdi@mehdix.org> | 2021-08-29 19:28:47 +0200 |
| commit | eac660293c025232b7e45a392bbdf5b19af72331 (patch) | |
| tree | 51a87bc29f7ac1964e82a4a0a398a3a55f453390 | |
| parent | 887d5cdbc1b77578026845d6996a372b2ed991ee (diff) | |
Reorganize bash startup files and minor fixes.
- Move PATH exports to .env
- Move aliases to .env
- Avoid loading .env twice
- Load .bashrc only on login shell and bash only
| -rw-r--r-- | .bashrc | 26 | ||||
| -rw-r--r-- | .env | 18 | ||||
| -rw-r--r-- | .profile | 9 |
3 files changed, 32 insertions, 21 deletions
@@ -1,16 +1,17 @@ -[ -n "$ENV" ] && . "$ENV" || [ -e ~/.env ] && . ~/.env +# .bashrc +[ -n "$ENV" ] && . "$ENV" || ([ -e ~/.env ] && . ~/.env) -# Prompt for Bash -export PS1='\[\033[1;33m\]$(prompt)\[\033[0m\]' -export HISTCONTROL=ignoredups -export HISTIGNORE="gst:gl" -export HISTTIMEFORMAT="%F %R:%S " -export PROMPT_COMMAND="history -a;history -n" +PS1='\[\033[1;33m\]$(prompt)\[\033[0m\]' +HISTCONTROL=ignoreboth:erasedups +HISTIGNORE="gst" +# see man strftime +HISTTIMEFORMAT="%F " -# Verify before running history command -shopt -s histverify +# Uncomment this line and remove `histappend' to enable shared history. +# PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r;" +shopt -s histappend -# See Bash man +# See Bash manual _completion_loader() { # Completion files on Arch @@ -31,11 +32,8 @@ _direnv_hook() { trap - SIGINT; return $previous_exit_status; }; + if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" fi -alias gl='git pull' -alias gcm='git checkout master' -alias gco='git checkout' -alias gst='git status' @@ -1,3 +1,4 @@ +# .env PS1='$(prompt)' if [ -z "${SSH_AGENT_PID}" ]; then @@ -25,8 +26,25 @@ alias githome='git --git-dir ~/.githome --work-tree ~' alias ls='ls --color -A --group-directories-first --sort=extension' alias recent='ls -ltch' +alias gl='git pull' +alias gcm='git checkout master' +alias gco='git checkout' +alias gst='git status' # Use correct TTY for GPG Pinentry export GPG_TTY="$(tty)" gpg-connect-agent updatestartuptty /bye >/dev/null export TERM=xterm +export PATH=$HOME/.local/bin:$PATH +export PATH=$HOME/.local/bin/`hostname`:$PATH +export PATH=$HOME/.local/bin/`uname -m`:$PATH +export PATH=$HOME/.cargo/bin:$PATH +export GOPATH="$HOME/.local/share/go" +export PATH=$GOPATH/bin:$PATH +export PATH=$HOME/.local/bin:$PATH +export PATH=$HOME/.local/bin/`hostname`:$PATH +export PATH=$HOME/.local/bin/`uname -m`:$PATH +export PATH=$HOME/.cargo/bin:$PATH +export GOPATH="$HOME/.local/share/go" +export PATH=$GOPATH/bin:$PATH + @@ -1,3 +1,4 @@ +# .profile export ENV=~/.env export LANG=en_US.UTF-8 export LC_TIME=de_DE.UTF-8 @@ -5,12 +6,6 @@ export EDITOR=vim export TERM=xterm export HISTSIZE=65535 -export PATH=$HOME/.local/bin:$PATH -export PATH=$HOME/.local/bin/`hostname`:$PATH -export PATH=$HOME/.local/bin/`uname -m`:$PATH -export PATH=$HOME/.cargo/bin:$PATH -export GOPATH="$HOME/.local/share/go" -export PATH=$GOPATH/bin:$PATH export MAKEFLAGS=-j`lscpu | grep '^CPU(s):' | awk -F' ' '{ print $2 }'` export CFLAGS="-O2 -pipe -march=native" export CXXFLAGS="${CFLAGS}" @@ -19,4 +14,4 @@ export _JAVA_AWT_WM_NONREPARENTING=1 export GDK_BACKEND=wayland [ -e .config/$(hostname).profile ] && . .config/$(hostname).profile -[ $0 = bash ] || [ $0 = '-bash' ] && [ -f ~/.bashrc ] && . ~/.bashrc +[ -n $BASH_VERSION ] && shopt login_shell 2>&1 > /dev/null && [ -f ~/.bashrc ] && . ~/.bashrc |
