167 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			167 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|  | # -*-shell-script-*- | ||
|  | # | ||
|  | # default bash config | ||
|  | 
 | ||
|  | # do not use the config if not in a terminal | ||
|  | if test -z "$PS1"; then | ||
|  |     return | ||
|  | fi | ||
|  | 
 | ||
|  | # and do not use it if in no interactive terminal | ||
|  | if test "$TERM" = "dumb"; then | ||
|  |   export PS1='$ ' | ||
|  |   return | ||
|  | fi | ||
|  | 
 | ||
|  | inputrc="$HOME/.inputrc" | ||
|  | 
 | ||
|  | # create helper configs, if requested. that way I don't have to copy | ||
|  | # around multiple files if I enter a new system | ||
|  | createcfgs() { | ||
|  |     if ! test -f $inputrc; then | ||
|  |         if ! test -w $HOME; then | ||
|  |             inputrc="/tmp/.inputrc_tom" | ||
|  |         fi | ||
|  |         cat << EOF > $inputrc | ||
|  | # toms readline config | ||
|  | set show-all-if-ambiguous on | ||
|  | set meta-flag on | ||
|  | set input-meta on | ||
|  | set convert-meta on | ||
|  | set output-meta on | ||
|  | 
 | ||
|  | # C-a blocked by screen, so use these also | ||
|  | Meta-a: beginning-of-line | ||
|  | 
 | ||
|  | # alt-left | ||
|  | "\e[1;3C": forward-word | ||
|  | # ctrl-right | ||
|  | "\e[1;5C": forward-word | ||
|  | # alt-left, vnc | ||
|  | "\e\e[C": forward-word | ||
|  | 
 | ||
|  | # alt-right | ||
|  | "\e[1;3D": backward-word | ||
|  | # ctrl-left | ||
|  | "\e[1;5D": backward-word | ||
|  | # alt-left, vnc | ||
|  | "\e\e[D": backward-word | ||
|  | 
 | ||
|  | # alt-down | ||
|  | "\e[1;3B": beginning-of-line | ||
|  | # alt-down, vnc | ||
|  | "\e\e[A": beginning-of-line | ||
|  | 
 | ||
|  | # alt-up | ||
|  | "\e[1;3A": end-of-line | ||
|  | # alt-up, vnc | ||
|  | "\e\e[B": end-of-line | ||
|  | 
 | ||
|  | EOF | ||
|  |     fi | ||
|  | } | ||
|  | 
 | ||
|  | # stay with en, but support umlauts and the other bastards | ||
|  | export LC_COLLATE="en_US.UTF-8" | ||
|  | export LC_CTYPE="de_DE.UTF-8" | ||
|  | export LC_MONETARY="de_DE.UTF-8" | ||
|  | export LC_NUMERIC="de_DE.UTF-8" | ||
|  | export LC_TIME="de_DE.UTF-8" | ||
|  | export LC_PAPER="de_DE.UTF-8" | ||
|  | export LANG="en_US.UTF-8" | ||
|  | export LC_LANG="en_US.UTF-8" | ||
|  | export LC_ALL="en_US.UTF-8" | ||
|  | export LANGUAGE="en_US.UTF-8" | ||
|  | export GDM_LANG="en_US.UTF-8" | ||
|  | 
 | ||
|  | # generate customized support configs | ||
|  | createcfgs | ||
|  | INPUTRC="$inputrc" | ||
|  | 
 | ||
|  | 
 | ||
|  | # global aliases | ||
|  | alias dir='ls -l' | ||
|  | alias ll='ls -l' | ||
|  | alias la='ls -la' | ||
|  | alias l='ls -alF' | ||
|  | alias ls-l='ls -l' | ||
|  | alias lt='ls -ltr' | ||
|  | alias o='less' | ||
|  | alias ..='cd ..' | ||
|  | alias ...='cd ../..' | ||
|  | alias ....='cd ../../..' | ||
|  | alias .....='cd ../../../..' | ||
|  | alias rd=rmdir | ||
|  | alias md='mkdir -p' | ||
|  | alias which='type -p' | ||
|  | alias less='less -i -P "?f%f:Standard input. %lb / %L ?e(END):>"' | ||
|  | alias les='less' | ||
|  | alias grip='egrep -i' | ||
|  | alias lc="tr '[A-Z]' '[a-z]'" | ||
|  | alias uc="tr '[a-z]' '[A-Z]'" | ||
|  | alias table="column -t" | ||
|  | alias gethttp="fetch -n --no-verify-peer --no-verify-hostname" | ||
|  | 
 | ||
|  | 
 | ||
|  | PROMPT_COMMAND="PS1='\[\033]0;\u@$host:\w\007\] | ||
|  | --- [\w] --- | ||
|  | \u@$host: $CURSOR '" | ||
|  | 
 | ||
|  | # customize path | ||
|  | for dir in $HOME/bin $HOME/.cabal/bin $HOME/perl5/perlbrew/bin /usr/local/bin /usr/local/sbin /usr/sbin; do | ||
|  |     if test -d $dir; then | ||
|  |         PATH=$PATH:$dir | ||
|  |     fi | ||
|  | done | ||
|  | export PATH | ||
|  | 
 | ||
|  | # global env vars | ||
|  | EDITOR=vim | ||
|  | 
 | ||
|  | # history options | ||
|  | HISTFILESIZE=1000000 | ||
|  | HISTSIZE=1000000 | ||
|  | HISTCONTROL=ignoreboth | ||
|  | HISTIGNORE='ls:bg:fg:history' | ||
|  | HISTTIMEFORMAT='%F %T ' | ||
|  | 
 | ||
|  | export EDITOR PROMPT_COMMAND PATH LESSCHARSET GREP_OPTIONS HISTFILE HISTFILESIZE HISTSIZE HISTCONTROL HISTIGNORE HISTTIMEFORMAT INPUTRC | ||
|  | 
 | ||
|  | # better override | ||
|  | umask 0027 | ||
|  | 
 | ||
|  | # completion? | ||
|  | bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} | ||
|  | if [ "$PS1" ] && [ $bmajor -eq 2 ] && [ $bminor '>' 04 ] \ | ||
|  |        && [ -f ~/.completion ]; then # interactive shell | ||
|  |     # Source completion code | ||
|  |     source ~/.completion | ||
|  | fi | ||
|  | 
 | ||
|  | # bash options | ||
|  | shopt -s cdable_vars checkhash checkwinsize histappend cmdhist | ||
|  | 
 | ||
|  | # perl brew installed? | ||
|  | if test -d ~/perl5; then | ||
|  |     source ~/perl5/perlbrew/etc/bashrc | ||
|  | fi | ||
|  | 
 | ||
|  | # python? | ||
|  | if test -e ~/.pythonrc; then | ||
|  |     export PYTHONSTARTUP=~/.pythonrc | ||
|  | fi | ||
|  | 
 | ||
|  | # any local specific config? | ||
|  | if test -e ~/.bashrc-local; then | ||
|  |     source  ~/.bashrc-local | ||
|  | fi | ||
|  | 
 | ||
|  | # rust? | ||
|  | if test -e /usr/local/rust/cargo/env; then | ||
|  |     source /usr/local/rust/cargo/env | ||
|  |     export RUSTUP_HOME=/usr/local/rust/rustup | ||
|  |     export CARGO_HOME=/usr/local/rust/cargo | ||
|  | fi | ||
|  | 
 | ||
|  | 
 |