You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
3.0 KiB
Bash

11 years ago
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth
# never truncate bash history file
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# always write a history line
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
11 years ago
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color)
color_prompt=yes
;;
xterm-kitty)
# the kitty docs recommend not changing the TERM value, so, we'll try
# that until it breaks.
color_prompt=yes
;;
11 years ago
esac
# uncomment for a colored prompt, if the terminal has the capability
11 years ago
force_color_prompt=yes
export PS1="\[\e[0;32m\]\u@\h[\j] \w: \[\e[m\]"
export EDITOR=vim
case $( uname -s ) in
Darwin)
alias ls="ls -G"
;;
Linux)
# for some reason I find this welcome string more annoying on Linux
;;
*)
echo "No platform-specific bash settings are enabled."
;;
esac
alias tree="tree -C"
alias ls="ls --color=auto"
11 years ago
if [ -f "$HOME/.localrc" ]; then
echo "Using machine-specific settings from "$HOME/.localrc""
11 years ago
source "$HOME/.localrc"
fi
alias randompass="python -c \"import string, random; print ''.join(random.sample(string.letters+string.digits, 8))\""
if [ -d "$HOME/.dotfiles" ]; then
alias dotfiles="$HOME/.dotfiles/install.sh"
fi
# if kitty is installed, register its completions
if command -v kitty &> /dev/null
then
# This is a little annoying but the version of Bash on MacOS is so old that
# it doesn't have process substitution
KITTY_COMPLETION_FILE=$(mktemp)
kitty + complete setup bash > "$KITTY_COMPLETION_FILE"
source "$KITTY_COMPLETION_FILE"
rm "$KITTY_COMPLETION_FILE"
unset KITTY_COMPLETION_FILE
fi
# sometimes I just put binary files in a bin dir in my home directory. Is this
# gross? I dunno. What are you, some kind of cop?
if [ -d "$HOME/bin" ]; then
export PATH="$PATH:$HOME/bin"
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$PATH:$HOME/.local/bin"
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$PATH:$HOME/.local/bin"
fi
# add the Go bindir to the path if we have the standard Go install dir
if [ -d /usr/local/go ]; then
export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin
fi
2 years ago
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [[ -f "$HOME/.cargo/env" ]]; then
. "$HOME/.cargo/env"
fi
if [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi