diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2008-10-29 03:50:18 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2008-10-29 03:50:18 +0100 |
commit | 0cfdb493f045e7c533328617427a7416783c28b5 (patch) | |
tree | cc9a1a43343cef6550357eab1e25a1923dae627b /bashrc/common | |
parent | 4e4fb8d5d790d2cc6eabab95aaea4b81225ca164 (diff) | |
download | dotfiles-0cfdb493f045e7c533328617427a7416783c28b5.tar.gz dotfiles-0cfdb493f045e7c533328617427a7416783c28b5.tar.xz dotfiles-0cfdb493f045e7c533328617427a7416783c28b5.zip |
added bashrc configdir
added git config
Diffstat (limited to 'bashrc/common')
-rw-r--r-- | bashrc/common/alias.sh | 29 | ||||
-rw-r--r-- | bashrc/common/bashcomp.sh | 20 | ||||
-rw-r--r-- | bashrc/common/color.sh | 42 | ||||
-rw-r--r-- | bashrc/common/dircolors.sh | 4 | ||||
-rw-r--r-- | bashrc/common/env.sh | 5 | ||||
-rw-r--r-- | bashrc/common/locale.sh | 5 | ||||
-rw-r--r-- | bashrc/common/pager.sh | 13 | ||||
-rw-r--r-- | bashrc/common/shopt.sh | 23 |
8 files changed, 141 insertions, 0 deletions
diff --git a/bashrc/common/alias.sh b/bashrc/common/alias.sh new file mode 100644 index 0000000..03df556 --- /dev/null +++ b/bashrc/common/alias.sh @@ -0,0 +1,29 @@ +# command aliases + +# ls helpers +alias ll="ls -l" +alias la="ls -la" +alias l="ls -lh" + +# cd helpers +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." + +# make default what should be default +alias sudo="sudo -H" + +# mkdir + chdir +mkcd() { + mkdir -p $1 && cd $1 +} + +# create tarball of one directory +mktar() { + [[ -z "$1" ]] && return 1 + tar cjvf "${1%%/}.tar.bz2" "${1%%/}/" +} + +# rar -> unrar +alias rar=unrar + diff --git a/bashrc/common/bashcomp.sh b/bashrc/common/bashcomp.sh new file mode 100644 index 0000000..48d83fa --- /dev/null +++ b/bashrc/common/bashcomp.sh @@ -0,0 +1,20 @@ +# bash completion + +bmajor=${BASH_VERSION%%.*} +bminor=${BASH_VERSION#*.} +bminor=${bminor//[^0-9]*} + +if [[ ${bmajor} -eq 2 && ${bminor} -gt 4 ]] || [[ ${bmajor} -gt 2 ]]; then + [[ -f /etc/bash_completion ]] && source /etc/bash_completion + + if [[ -d ~/.bash_completion.d ]]; then + for i in ~/.bash_completion.d/*; do + [[ -f ${i} ]] && source ${i} + done + fi +fi + +unset bmajor bminor + +export COMP_WORDBREAKS=${COMP_WORDBREAKS/:/} +export FIGNORE=".o:~" diff --git a/bashrc/common/color.sh b/bashrc/common/color.sh new file mode 100644 index 0000000..ca62988 --- /dev/null +++ b/bashrc/common/color.sh @@ -0,0 +1,42 @@ +# color code definitions + +# print ugly color codes +coco() { + [[ -z "$1" ]] && echo -ne "\033[0m" || echo -ne "\033[${1}m" +} + +# name all colors to get rid of hieroglyphics +color() { + case $1 in + black) coco '0;30' ;; + dgray) coco '1;30' ;; + red) coco '0;31' ;; + lred) coco '1;31' ;; + green) coco '0;32' ;; + lgreen) coco '1;32' ;; + brown) coco '0;33' ;; + yellow) coco '1;33' ;; + blue) coco '0;34' ;; + lblue) coco '1;34' ;; + purple) coco '0;35' ;; + lpurple) coco '1;35' ;; + cyan) coco '0;36' ;; + lcyan) coco '1;36' ;; + lgray) coco '0;37' ;; + white) coco '1;37' ;; + *) coco '0' ;; + esac +} + +pcolor() { + echo -ne "\[$(color $@)\]" +} + +colors() { + local l="black dgray red lred green lgreen brown yellow blue" + local l="${l} lblue purple lpurple cyan lcyan lgray white" + + for i in $l; do + echo "$i = $(color $i)$i$(color)" + done +} diff --git a/bashrc/common/dircolors.sh b/bashrc/common/dircolors.sh new file mode 100644 index 0000000..f26a163 --- /dev/null +++ b/bashrc/common/dircolors.sh @@ -0,0 +1,4 @@ +# colored output for ls +if hash dircolors; then + eval $(dircolors -b) +fi diff --git a/bashrc/common/env.sh b/bashrc/common/env.sh new file mode 100644 index 0000000..e02e6ad --- /dev/null +++ b/bashrc/common/env.sh @@ -0,0 +1,5 @@ +# force sane editor +export EDITOR=/usr/bin/nano + +# set timezone if needed +[[ -z "$TZ" ]] && export TZ=Europe/Berlin diff --git a/bashrc/common/locale.sh b/bashrc/common/locale.sh new file mode 100644 index 0000000..97c3f17 --- /dev/null +++ b/bashrc/common/locale.sh @@ -0,0 +1,5 @@ +# find a usuable locale + +eval unset ${!LC_*} LANG +export LANG="en_US.UTF-8" +export LC_COLLATE="C" diff --git a/bashrc/common/pager.sh b/bashrc/common/pager.sh new file mode 100644 index 0000000..a92031e --- /dev/null +++ b/bashrc/common/pager.sh @@ -0,0 +1,13 @@ +# pager options + +# use less by default ... +if hash less; then + export PAGER=less + export LESS="-R --ignore-case --long-prompt" +fi + +# but user most, if available +if hash most; then + export PAGER=most + export MANPAGER=most +fi diff --git a/bashrc/common/shopt.sh b/bashrc/common/shopt.sh new file mode 100644 index 0000000..07a796a --- /dev/null +++ b/bashrc/common/shopt.sh @@ -0,0 +1,23 @@ +# bash configuration + +# basic search path for chdir +export CDPATH=".:~" + +# keep size of history small ... +export HISTCONTROL="ignoreboth:erasedups" + +# ... but keep a lot of history +export HISTFILESIZE=5000 +export HISTSIZE=5000 + +# save timestamp in history +export HISTTIMEFORMAT="%+ " + +# check window size after each command +shopt -s checkwinsize + +# save multi-line command as one line +shopt -s cmdhist + +# append history +shopt -s histappend |