This repository has been archived on 2021-04-14. You can view files and clone it, but cannot push or open issues/pull-requests.
bare-dotfiles/.bashrc

85 lines
2.4 KiB
Bash

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
if [ -d "/usr$HOME" ] ; then export HOME=/usr$HOME ; cd ; fi
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi
test -f /etc/bashrc && . /etc/bashrc || true
test -f /etc/bash.bashrc && . /etc/bash.bashrc || true
test -f /etc/bash_completion && . /etc/bash_completion || true
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
test -f $HOME/.cargo/env && . $HOME/.cargo/env || true
if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi
alias dotfiles='git --git-dir=$HOME/dotfiles.git/ --work-tree=$HOME'
EDITOR=vim; export EDITOR
PAGER=less; export PAGER
PATH=$PATH:$HOME/.local/bin:$HOME/bin
GIT_MERGE_AUTOEDIT=no
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# No locking on Ctrl-S
stty -ixon
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
##
## history: http://mywiki.wooledge.org/BashFAQ/088
##
# Big history
HISTFILESIZE=10000
HISTSIZE=10000
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
# history -a causes an immediate write of all new history lines
# (instead of upon shell exit)
PROMPT_COMMAND="history -a"
# histappend which causes all new history lines to be appended, and ensures
# that multiple logins do not overwrite each other's history
shopt -s histappend
function _update_ps1() {
PS1="$(powerline-rs --modules user,host,ssh,cwd,git,gitstage,root --shell bash $?)"
}
if [[ $(which powerline-rs 2>/dev/null) && "$TERM" != "linux" && "$TERM_PROGRAM" != "vscode" ]]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
else
PS1='[\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w$(__git_ps1 " (%s)")\[\033[00m\]]\$ '
fi
for i in $HOME/bin/*.bash ; do
. $i
done
if which lsd > /dev/null 2>&1 ; then
if [ "$TERM" = "xterm-256color" ] ; then
alias ls="lsd"
else
alias ls="lsd --icon=never"
fi
fi
# Set up direnv
eval "$(direnv hook bash)"