1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2025-10-17 19:41:01 +00:00

Initial commit

This commit is contained in:
Holger Just 2010-08-03 16:13:15 +02:00
commit 41c8261914
8 changed files with 1884 additions and 0 deletions

4
.bash_profile Normal file
View File

@ -0,0 +1,4 @@
# include .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

268
.bashrc Executable file
View File

@ -0,0 +1,268 @@
if [ -f /etc/bashrc ]; then . /etc/bashrc; fi
# Function to resolve soft links
function delink()
{
f=$1
while [ -h "$f" ]; do
ls=`ls -ld "$f"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then f="$link"
else f=`dirname "$f"`/"$link"
fi
done
echo $f
}
# General Settings
export DOTFILES=$(dirname `delink ~/.bashrc` )
export PATH="/usr/local/sbin:/usr/local/bin:/Developer/usr/bin:/usr/sbin:/usr/bin:$PATH:/opt/bin:/opt/local/bin:."
export PATH="$HOME/bin:$DOTFILES/bin:$PATH"
export PWD_LENGTH=50
set -o notify
shopt -s cdspell >/dev/null 2>&1
shopt -s checkwinsize >/dev/null 2>&1
shopt -s dotglob >/dev/null 2>&1
shopt -s extglob >/dev/null 2>&1
shopt -s hostcomplete >/dev/null 2>&1
shopt -s interactive_comments >/dev/null 2>&1
shopt -u mailwarn >/dev/null 2>&1
shopt -s no_empty_cmd_completion >/dev/null 2>&1
bind Space:magic-space
# Bash History
export HISTIGNORE="&:ls:ll:la:l.:pwd:exit:clear"
export HISTCONTROL=ignoreboth
shopt -s histappend >/dev/null 2>&1
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
export PG_DATA=/usr/local/var/postgres
# Ruby Settings
export RUBY_VERSION=1.8.7
export RUBYOPT=-rubygems
if [[ -s $HOME/.rvm/scripts/rvm ]] ; then
source $HOME/.rvm/scripts/rvm ;
fi
# Fix Ruby version
if [[ !`which install_ruby 2>/dev/null` ]] && [[ `which ruby 2>/dev/null` ]]; then
export RUBY_VERSION=$(ruby --version | sed -e "s/^ruby \(.\..\..\).*$/\1/")
fi
# Disable XON/XOFF flow control (^s/^q).
stty -ixon
# SSH specific config.
if [ -n "$SSH_CLIENT" ]; then
# show host only if this is an ssh session
ps1_host="\[\033[01;32m\]\h"
fi
USER_NAME="Holger Just"
USER_EMAIL="web@meine-er.de"
# Setting up git.
if [ -f ~/.gitconfig ]; then
if [ "$(git config --global user.name)" != "$USER_NAME" ]; then
echo "WARNING: git's user.name is $(git config --global user.name)"
fi
if [ "$(git config --global user.email)" != "$USER_EMAIL" ]; then
echo "WARNING: git's user.email is $(git config --global user.email)"
fi
fi
. $DOTFILES/.git_completion
# OS specific config.
case `uname` in
Darwin)
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"
if [ $(which mate) ]; then
export EDITOR="mate"
export SVN_EDITOR="mate -wl1"
fi
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; return 0; }
alias ls='ls -G'
for p in /usr/local/*/bin /usr/*/bin; do
export PATH=$p:$PATH
done
unset p
gitx() { open -a GitX $@; }
pdfman() { man -t $1 | open -a /Applications/Preview.app -f; }
# Bash completion
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
;;
Linux)
PATH=$PATH:/var/lib/gems/1.8/bin:/var/lib/gems/1.9/bin
alias ls='ls --color=auto'
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
;;
SunOS)
stty istrip
export PATH=/opt/csw/bin:/opt/sfw/bin:$PATH:/etc
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# home key
bind '"\e[1~":beginning-of-line'
# del key
bind '"\e[3~":delete-char'
# end key
bind '"\e[4~":end-of-line'
# pgup key
bind '"\e[5~":history-search-forward'
# pgdn key
bind '"\e[6~":history-search-backward'
;;
*) echo "OS unknown to bashrc." ;;
esac
# setting up editor
[[ -z "$EDITOR" ]] && EDITOR="nano"
[[ -z "$SVN_EDITOR" ]] && SVN_EDITOR="$EDITOR"
git config --global --replace-all core.editor "$SVN_EDITOR"
# Don't show user name if it's me. make root red.
case $USER in
hjust) ;;
*)
case $UID in
0) ps1_user="\[\033[01;31m\]\u" ;;
*) ps1_user="\[\033[01;32m\]\u" ;;
esac
esac
ps1_host='\h'
ps1_ruby='$(rvm-prompt)'
. $HOME/bin/bash_vcs.sh
ps1_vcs='$(__prompt_command)'
#ps1_ruby=' \[\033[33m\]$(rvm-prompt)\[\033[00m\]'
ps1_ruby=""
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
PS1="${debian_chroot:+($debian_chroot)}"
# Short PWD, if it's to long.
short_pwd() {
FIXED_PWD=$(echo $PWD | sed "s:^$HOME:~:g")
if [ ${#FIXED_PWD} -gt $(($PWD_LENGTH)) ]; then
echo "${FIXED_PWD:0:$((4))}...${FIXED_PWD:$((${#PWD}-$PWD_LENGTH+7)):$(($PWD_LENGTH-7))}"
else
echo "$FIXED_PWD"
fi
}
#ps1_pwd='$(short_pwd)'
ps1_pwd='\[\033[1;30m\]\W\[\033[00m\]'
# Building $PS1.
if [ -n "$ps1_user" ] && [ -n "$ps1_host" ]; then ps1_user="$ps1_user@"; fi
PS1="$ps1_user$ps1_host"
if [ "$PS1" != "" ]; then PS1="$PS1\[\033[01;30m\]:\[\033[00m\]"; fi
export PS1="$PS1$ps1_pwd$ps1_vcs$ps1_ruby \$ "
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# If this is an xterm set the title to user@host:dir.
case "$TERM" in
xterm*|rxvt*) export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' ;;
*) ;;
esac
# Enable color support. Don't add ls here, it behaves different on Darwin/BSD.
if [ -x /usr/bin/dircolors ]; then eval "`dircolors -b`"; fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Some more aliases.
alias ll='ls -Alh'
alias la='ls -A'
alias l='ls -CF'
alias l.="ls -d .*"
alias pdflatex='pdflatex -shell-escape'
alias vi='vim'
alias screen='screen -U'
alias use='rvm use'
alias gems='gem list | less'
alias less='less -R'
alias gsvn='git svn'
alias gdiff='git diff'
alias st='git st'
alias log='git lg'
alias ciam='git ci -am'
alias ss="script/server -b 127.0.0.1"
alias sc="script/console"
alias ssh="ssh -A"
# shorthands - i do this a lot
ruby_version() { if [ -z $1 ]; then echo $RUBY_VERSION; else RUBY_VERSION=$1; fi; }
# if cat is called on a directory, call ls instead
cat() {
if [ $# = 1 ] && [ -d $1 ]; then
ls $1
else
`which cat` "$@"
fi
}
# directory for project
d() {
for dir in $HOME/workspace/$1 $HOME/$1 $1 $RUBY_PATH/$RUBY_VERSION/lib/ruby/gems/*/gems/$1-*; do
if [ -d $dir ]; then
echo $dir
break
fi
done
unset dir
}
# do stuff with project
with_project() {
target=$(d $1)
if [ $target ]; then
echo $2 $target
$2 $target
else
echo "unknown project"
fi
unset target
}
# cd to project
c() { with_project $1 cd; }
# open project in editor
e() { with_project $1 $EDITOR; }
# Enable programmable completion features.
if [ -f /etc/bash_completion ]; then . /etc/bash_completion; fi
if [ -f ~/.tabtab.bash ]; then . ~/.tabtab.bash; fi
set show-all-if-ambiguous on
# Clean up.
unset ps1_user ps1_host ps1_vcs ps_ruby ps1_pwd ps1_ruby script this dir bin

1421
.git_completion Normal file

File diff suppressed because it is too large Load Diff

25
.gitconfig Normal file
View File

@ -0,0 +1,25 @@
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset %Cblue(%aN)%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
chp = cherry-pick
st = status
co = checkout
merge = merge --no-ff
pull = pull --no-ff
ci = checkin
[user]
name = Holger Just
email = "web@meine-er.de"
[color]
branch = auto
diff = auto
grep = auto
interactive = auto
ui = auto
[help]
autocorrect = 1
[push]
default = matching
[core]
autocrlf = false
editor = mate -wl1

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/.vim/sessions
.gemrc

44
.global_gitignore Normal file
View File

@ -0,0 +1,44 @@
pkg
nbproject
*~
*.rbc
*.pyc
*.log
*.gem
*.db
*.sqlite3
*.bak
*.orig
*.rej
*.swo
*.swp
*.tmproj
*.a
*.bundle
*.dSYM
*.dylib
*.la
*.lo
*.o
*.so
.*.d
.\#*
.dotest
.gdb_history
.glimpse*
.hg
.hgignore
.yardoc
COMMIT
TAGS
.svn
autom4te.cache
code-cache
coverage
tmp
build
dist
setuptools-*
.sass-cache
.DS_Store
.rvmrc

33
Rakefile Normal file
View File

@ -0,0 +1,33 @@
desc "installs everything"
task :install => "install:all"
namespace :install do
def install name, *files
desc "installs #{name} configuration"
task(name) do
Dir[*files].collect do |file|
full = File.join Dir.pwd, file
Dir.chdir ENV["HOME"] do
mkdir_p File.dirname(file)
sh "rm #{file}" if (File.exist? file and File.directory? full)
sh "ln -sf #{full} #{file}"
end
end
end
task :all => name
end
install :irb, ".irbrc", ".config/irb/*.rb"
install :dot, ".bash_profile", ".bashrc", ".gemrc", ".vimrc", ".vim", ".gitignore", ".gitconfig"
install :bin, "bin/*"
desc "installs the custom texmf folder"
task :texmf do
system "git submodule init && git submodule update"
install :texmf_folder, "texmf"
Rake::Task[:texmf_folder].invoke
end
task :all => :texmf
end

87
bin/bash_vcs.sh Executable file
View File

@ -0,0 +1,87 @@
# I use this in my .bashrc to have nice VCS stuff.
# Tim Felgentreff (09/20/01): Simplify for speedup, use the git-completion script for git
_bold=$(tput bold)
_normal=$(tput sgr0)
__prompt_command() {
if [ -z $NOPROMPT ]; then
local vcs base_dir sub_dir ref last_command
sub_dir() {
local sub_dir
sub_dir=$(stat --printf="%n" "${PWD}")
sub_dir=${sub_dir#$1}
echo ${sub_dir#/}
}
git_dir() {
ref=`__git_ps1`
if [ -z $ref ]; then return 1; fi
vcs="git"
alias pull="git pull"
alias commit="git commit -v -a"
alias push="commit ; git push"
alias revert="git checkout"
}
svn_dir() {
[ -d ".svn" ] || return 1
ref=$(svn info "$base_dir" | awk '/^URL/ { sub(".*/","",$0); r=$0 } /^Revision/ { sub("[^0-9]*","",$0); print $0 }')
# this is too slow...
#if [ -n $(svn status -q) ]; then
# ref="\e[0;31m$ref\e[m"
#fi
ref="[$ref]"
vcs="svn"
alias pull="svn up"
alias commit="svn commit"
alias push="svn ci"
alias revert="svn revert"
}
cvs_dir() {
[ -d "CVS" ] || return 1
vcs="cvs"
alias pull="cvs update"
alias commit="cvs commit"
alias push="cvs commit"
}
bzr_dir() {
base_dir=$(bzr root 2>/dev/null) || return 1
ref=$(bzr revno 2>/dev/null)
vcs="bzr"
alias pull="bzr pull"
alias commit="bzr commit"
alias push="bzr push"
alias revert="bzr revert"
}
git_dir || svn_dir || cvs_dir
if [ -n "$vcs" ]; then
alias st="$vcs status"
alias d="$vcs diff"
alias up="pull"
alias cdb="cd $base_dir"
__vcs_ref="$vcs:$ref"
echo " $__vcs_ref"
fi
fi
}
#export PROMPT_COMMAND=__prompt_command
# Show the currently running command in the terminal title:
# http://www.davidpashley.com/articles/xterm-titles-with-bash.html
#if [ -z "$TM_SUPPORT_PATH"]; then
#case $TERM in
# rxvt|*term|xterm-color)
# trap 'echo -e "\e]1;$working_on>$BASH_COMMAND<\007\c"' DEBUG
# ;;
#esac
#fi