clean up bash config
parent
1074406b66
commit
aabb888752
@ -1,43 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
|
||||
# Disable capslock
|
||||
if [[ -x `which setxkbmap` ]]; then
|
||||
if [[ `uname` == 'Linux' ]]; then
|
||||
if [[ -x $(which setxkbmap) ]]; then
|
||||
if [[ $(uname) == Linux ]]; then
|
||||
setxkbmap -option ctrl:nocaps
|
||||
fi
|
||||
fi
|
||||
|
||||
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
|
||||
export EDITOR='vim'
|
||||
|
||||
# don't put duplicate lines in the history. See bash(1) for more options
|
||||
# ... or force ignoredups and ignorespace
|
||||
export HISTCONTROL=ignoredups:erasedups:ignorespace
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# Use empty string for unlimited history
|
||||
export HISTSIZE=
|
||||
export HISTFILESIZE=
|
||||
export HISTTIMEFORMAT='%y-%m-%d %T λ '
|
||||
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
if [ "$TERM" == "xterm" ]; then
|
||||
export TERM=xterm-256color
|
||||
# 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)"
|
||||
fi
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
export BS_OS='osx'
|
||||
elif [[ $(uname) == 'Linux' ]]; then
|
||||
export BS_OS='linux'
|
||||
if [ "$TERM" == xterm ]; then
|
||||
export TERM=xterm-256color
|
||||
fi
|
||||
|
||||
export EDITOR='vim'
|
||||
|
||||
[[ -f ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh
|
||||
[[ -r $NVM_DIR/bash_completion ]] && source $NVM_DIR/bash_completion
|
||||
|
@ -1,53 +1,21 @@
|
||||
# If not running interactively, don't do anything
|
||||
[ -z "$PS1" ] && return
|
||||
|
||||
if [ -f ~/.bash/environment ]; then
|
||||
source ~/.bash/environment
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/path ]; then
|
||||
source ~/.bash/path
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/colors ]; then
|
||||
source ~/.bash/colors
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/functions ]; then
|
||||
source ~/.bash/functions
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/aliases ]; then
|
||||
source ~/.bash/aliases
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/git-flow-completion ]; then
|
||||
source ~/.bash/git-flow-completion
|
||||
fi
|
||||
|
||||
if [ -f ~/opt/bash/env ]; then
|
||||
source ~/opt/bash/env
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
source /etc/bash_completion
|
||||
fi
|
||||
|
||||
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
|
||||
source /opt/local/etc/profile.d/bash_completion.sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/bashrc ]; then
|
||||
source /etc/bashrc
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/prompt ]; then
|
||||
source ~/.bash/prompt
|
||||
fi
|
||||
|
||||
if [ -f ~/.bash/direnv-hook ]; then
|
||||
source ~/.bash/direnv-hook
|
||||
fi
|
||||
function source-file {
|
||||
file="$1"
|
||||
if [[ -f "$file" ]]; then
|
||||
. "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
source-file /etc/bash_completion
|
||||
source-file ~/.bash/colors
|
||||
source-file ~/.bash/aliases
|
||||
source-file ~/.bash/functions
|
||||
source-file ~/.bash/git-flow-completion
|
||||
source-file ~/.bash/path
|
||||
source-file ~/.bash/environment
|
||||
source-file ~/.bash/prompt
|
||||
source-file ~/opt/bash/env
|
||||
|
||||
unset -f source-file
|
||||
|
Loading…
Reference in New Issue