From f699a8761463273300eaff02875f07c832526a76 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 9 Aug 2012 15:37:56 +0200 Subject: [PATCH] refactoring --- bash_profile => bash/profile | 3 +-- bash_prompt => bash/prompt | 0 bashrc => bash/rc | 4 +-- ackrc => home/ackrc | 0 home/bash_profile | 1 + home/bashrc | 1 + inputrc => home/inputrc | 0 home/profile | 19 ++++++++++++++ screenrc => home/screenrc | 0 tmux.conf => home/tmux.conf | 0 home/zprofile | 1 + home/zshrc | 1 + profile | 49 ------------------------------------ setup.sh | 5 ++-- aliases => shell/aliases | 1 + shell/colors | 4 +++ shell/editor | 5 ++++ shell/homebrew | 12 +++++++++ shell/osx | 3 +++ shell/rbenv | 4 +++ shell/ssh | 6 +++++ shell/user | 3 +++ zprofile => zsh/profile | 0 zshrc => zsh/rc | 2 -- 24 files changed, 67 insertions(+), 57 deletions(-) rename bash_profile => bash/profile (94%) rename bash_prompt => bash/prompt (100%) rename bashrc => bash/rc (85%) rename ackrc => home/ackrc (100%) create mode 120000 home/bash_profile create mode 120000 home/bashrc rename inputrc => home/inputrc (100%) create mode 100644 home/profile rename screenrc => home/screenrc (100%) rename tmux.conf => home/tmux.conf (100%) create mode 120000 home/zprofile create mode 120000 home/zshrc delete mode 100644 profile rename aliases => shell/aliases (89%) create mode 100644 shell/colors create mode 100644 shell/editor create mode 100644 shell/homebrew create mode 100644 shell/osx create mode 100644 shell/rbenv create mode 100644 shell/ssh create mode 100644 shell/user rename zprofile => zsh/profile (100%) rename zshrc => zsh/rc (99%) diff --git a/bash_profile b/bash/profile similarity index 94% rename from bash_profile rename to bash/profile index 1194718..0992b07 100644 --- a/bash_profile +++ b/bash/profile @@ -1,8 +1,7 @@ ## bash_profile # handle .profile too -. .profile - +. ~/.profile # homebrew bash autocompletion if [ -f `brew --prefix`/etc/bash_completion ]; then diff --git a/bash_prompt b/bash/prompt similarity index 100% rename from bash_prompt rename to bash/prompt diff --git a/bashrc b/bash/rc similarity index 85% rename from bashrc rename to bash/rc index 1bcc610..e71e45a 100644 --- a/bashrc +++ b/bash/rc @@ -1,7 +1,7 @@ ## bashrc # set a nice prompt -source ~/.bash_prompt +source ~/.dotfiles/bash/prompt # ignore repeated, space-started, and casual commands export HISTIGNORE="&:[ ]*:l[sl]:[bf]g:exit" @@ -15,5 +15,5 @@ shopt -s cdspell # turn off bells set bell-style none -source ~/.aliases +#source ~/.aliases diff --git a/ackrc b/home/ackrc similarity index 100% rename from ackrc rename to home/ackrc diff --git a/home/bash_profile b/home/bash_profile new file mode 120000 index 0000000..7c73013 --- /dev/null +++ b/home/bash_profile @@ -0,0 +1 @@ +../bash/profile \ No newline at end of file diff --git a/home/bashrc b/home/bashrc new file mode 120000 index 0000000..f6e6fb7 --- /dev/null +++ b/home/bashrc @@ -0,0 +1 @@ +../bash/rc \ No newline at end of file diff --git a/inputrc b/home/inputrc similarity index 100% rename from inputrc rename to home/inputrc diff --git a/home/profile b/home/profile new file mode 100644 index 0000000..25bd478 --- /dev/null +++ b/home/profile @@ -0,0 +1,19 @@ +## .profile + +# utility functions + +path_append () { + PATH="$PATH:$1" +} + +path_prepend () { + PATH="$1:$PATH" +} + +# load all shell files +for file in ~/.dotfiles/shell/*; do + . $file +done + +export PATH +# vim: ft=sh diff --git a/screenrc b/home/screenrc similarity index 100% rename from screenrc rename to home/screenrc diff --git a/tmux.conf b/home/tmux.conf similarity index 100% rename from tmux.conf rename to home/tmux.conf diff --git a/home/zprofile b/home/zprofile new file mode 120000 index 0000000..e16b25d --- /dev/null +++ b/home/zprofile @@ -0,0 +1 @@ +../zsh/profile \ No newline at end of file diff --git a/home/zshrc b/home/zshrc new file mode 120000 index 0000000..0a3f762 --- /dev/null +++ b/home/zshrc @@ -0,0 +1 @@ +../zsh/rc \ No newline at end of file diff --git a/profile b/profile deleted file mode 100644 index 36eb4b2..0000000 --- a/profile +++ /dev/null @@ -1,49 +0,0 @@ -## .profile - -# set locale -#export LC_ALL="en_US.UTF-8" - -# mono paths -#export MANPATH=/Library/Frameworks/Mono.framework/Versions/Current/share/man:$MANPATH -#export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig:$PKG_CONFIG_PATH - -# user path -PATH=~/.local/bin:$PATH - -# python user path -PATH=~/Library/Python/2.7/bin:$PATH - -# local path -PATH=/usr/local/bin:/usr/local/sbin:$PATH - -# node.js path -NODE_PATH=/usr/local/lib/node -export NODE_PATH - -# rbenv -test -d "$HOME/.rbenv/bin" && PATH="$HOME/.rbenv/bin:$PATH" -which rbenv 2>&1 >/dev/null && eval "$(rbenv init -)" - -# homebrew python -test -d /usr/local/share/python3 && PATH="/usr/local/share/python3:$PATH" -test -d /usr/local/share/python && PATH="/usr/local/share/python:$PATH" - -export PATH - -# default editor -EDITOR=vim -VISUAL=vim -export EDITOR VISUAL - -# add some color -GREP_OPTIONS='--color=auto' -CLICOLOR=1; -export GREP_OPTIONS CLICOLOR - -# ssh keychain, if no agent set -if [ -z "$SSH_AUTH_SOCK" ]; then - if which keychain 2>&1 >/dev/null; then - eval $(keychain --eval --agents ssh -Q --quiet id_rsa) - fi -fi - diff --git a/setup.sh b/setup.sh index 6da010e..7bfc3ac 100755 --- a/setup.sh +++ b/setup.sh @@ -1,6 +1,7 @@ #!/bin/sh -for dotfile in *; do +for file in home/*; do + dotfile="$(basename "$file")" case "${dotfile}" in Makefile|*.md|LICENSE|setup.sh) # NOOP @@ -8,7 +9,7 @@ for dotfile in *; do *) # link the file with a leading dot echo "linking ${dotfile}" - ln -sf "$(pwd)/${dotfile}" "$HOME/.${dotfile}" + ln -sf "$(pwd)/${file}" "$HOME/.${dotfile}" ;; esac done diff --git a/aliases b/shell/aliases similarity index 89% rename from aliases rename to shell/aliases index af587e0..b4ce092 100644 --- a/aliases +++ b/shell/aliases @@ -10,4 +10,5 @@ case "$(uname)" in esac alias ll="ls -l" +alias tree="tree -C" diff --git a/shell/colors b/shell/colors new file mode 100644 index 0000000..e3d8acd --- /dev/null +++ b/shell/colors @@ -0,0 +1,4 @@ +# add some color +GREP_OPTIONS='--color=auto' +CLICOLOR=1; +export GREP_OPTIONS CLICOLOR diff --git a/shell/editor b/shell/editor new file mode 100644 index 0000000..a12f1b8 --- /dev/null +++ b/shell/editor @@ -0,0 +1,5 @@ + +# default editor +EDITOR=vim +VISUAL=vim +export EDITOR VISUAL diff --git a/shell/homebrew b/shell/homebrew new file mode 100644 index 0000000..7519c24 --- /dev/null +++ b/shell/homebrew @@ -0,0 +1,12 @@ +# local path +PATH=/usr/local/bin:/usr/local/sbin:$PATH + +# node.js path +NODE_PATH=/usr/local/lib/node +export NODE_PATH + +# python +test -d /usr/local/share/python3 && PATH="/usr/local/share/python3:$PATH" +test -d /usr/local/share/python && PATH="/usr/local/share/python:$PATH" + +export PATH diff --git a/shell/osx b/shell/osx new file mode 100644 index 0000000..40104f8 --- /dev/null +++ b/shell/osx @@ -0,0 +1,3 @@ +# OS X python user path +PATH=~/Library/Python/2.7/bin:$PATH +export PATH diff --git a/shell/rbenv b/shell/rbenv new file mode 100644 index 0000000..227f3f9 --- /dev/null +++ b/shell/rbenv @@ -0,0 +1,4 @@ +# rbenv +test -d "$HOME/.rbenv/bin" && PATH="$HOME/.rbenv/bin:$PATH" +which rbenv 2>&1 >/dev/null && eval "$(rbenv init -)" +export PATH diff --git a/shell/ssh b/shell/ssh new file mode 100644 index 0000000..d02d41d --- /dev/null +++ b/shell/ssh @@ -0,0 +1,6 @@ +# ssh keychain, if no agent set +if [ -z "$SSH_AUTH_SOCK" ]; then + if which keychain 2>&1 >/dev/null; then + eval $(keychain --eval --agents ssh -Q --quiet id_rsa) + fi +fi diff --git a/shell/user b/shell/user new file mode 100644 index 0000000..ee251f6 --- /dev/null +++ b/shell/user @@ -0,0 +1,3 @@ +# user path +PATH=~/.local/bin:$PATH +export PATH diff --git a/zprofile b/zsh/profile similarity index 100% rename from zprofile rename to zsh/profile diff --git a/zshrc b/zsh/rc similarity index 99% rename from zshrc rename to zsh/rc index 3aac335..0e69be1 100644 --- a/zshrc +++ b/zsh/rc @@ -139,5 +139,3 @@ chpwd() { set_term_title } -source ~/.aliases -