Mercurial > dotfiles
changeset 39:62bfb554ab85
Reorganize zsh files so that bash can work as well.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 26 Jan 2009 13:21:00 -0600 |
parents | f70862dadf83 |
children | 94604a37503a |
files | .bashrc .hgignore .shell.d/00.path_manipulation.sh .shell.d/01.aliases.sh .shell.d/50.common_env.sh .shell.d/50.completions.zsh .shell.d/50.editorsetup.sh .shell.d/50.keybindings.zsh .shell.d/50.misc_functions.zsh .shell.d/50.vcs_functions.sh .shell.d/99.prompt.bash .shell.d/99.prompt.zsh .zsh/00.path_manipulation.zsh .zsh/01.aliases.zsh .zsh/50.completions.zsh .zsh/50.editorsetup.zsh .zsh/50.keybindings.zsh .zsh/50.misc_functions.zsh .zsh/50.vcs_functions.zsh .zsh/99.prompt.zsh .zshenv .zshrc |
diffstat | 14 files changed, 132 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/.bashrc +++ b/.bashrc @@ -1,2 +1,47 @@ -source .zsh/50.vcs_functions.zsh +# This is more or less a clone of my .zshrc, with modifications as needed. +# The .zshrc is canonical, bash is simply the home-away-from-home when needed. +# one-off alias for a zsh reflex +alias ..='cd ..' + +for file in $(ls $HOME/.shell.d/*.{,ba}sh) ; do + source $file +done + +if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then + if which screen > /dev/null; then + detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'` + if [ ! -z "$detached_screens" ]; then + echo "+---------------------------------------+" + echo "| Detached screens are available: |" + echo "$detached_screens" + echo "+---------------------------------------+" + fi + fi + export SHOWED_SCREEN_MESSAGE="true" +fi + +# If available, source private extensions stored in a different repo +if [[ -a ~/.private/bashrc ]]; then + source ~/.private/bashrc +fi + +# I really wish bash had something like .zshenv - maybe I just don't know what it is called? +if [[ "x$TZ" == "x" ]] ; then + export MACHINE_TZ="xNoTimeZone" + local DEFAULT_TZ="America/Detroit" +fi + +# Do this right before the timezone stuff +if [[ -a ~/.bashrc-machine ]]; then + source ~/.bashrc-machine +fi + +# do this last so that we can tell if .zshenv-machine set the timezone +if [[ "x$TZ" == "x" ]] ; then + if [ "$MACHINE_TZ" = "xNoTimeZone" ]; then + export TZ="$DEFAULT_TZ" + else + export TZ="$MACHINE_TZ" + fi +fi
--- a/.hgignore +++ b/.hgignore @@ -11,6 +11,7 @@ syntax:glob .appcfg_cookies .appcfg_nag .aspell* +.bashrc-machine .codereview_upload_cookies .dropbox .dvdcss
rename from .zsh/01.aliases.zsh rename to .shell.d/01.aliases.sh --- a/.zsh/01.aliases.zsh +++ b/.shell.d/01.aliases.sh @@ -1,10 +1,26 @@ #aliases and funtions to act like them -function less() { command less -M "$@" } -function ll() { command ls -lFh "$@" } -function ls() { command ls -F "$@" } -function la() { command ls -aF "$@" } -function lla() { command ls -laFh "$@" } -function screen() { command screen -U "$@" } -function ipy() { command ipython "$@" } -function memacs() { command open -a Emacs "$@" } -alias vi='vim' \ No newline at end of file +function less() { + command less -M "$@" +} +function ll() { + command ls -lFh "$@" +} +function ls() { + command ls -F "$@" +} +function la() { + command ls -aF "$@" +} +function lla() { + command ls -laFh "$@" +} +function screen() { + command screen -U "$@" +} +function ipy() { + command ipython "$@" +} +function memacs() { + command open -a Emacs "$@" +} +alias vi=vim
new file mode 100644 --- /dev/null +++ b/.shell.d/50.common_env.sh @@ -0,0 +1,24 @@ +# generic settings, pulled into a .d file so it's easy to share between bash and zsh +# Get me colors in ls +export CLICOLOR="yes" +export LSCOLORS="exgxcxDxCxEGEDcbcgExEx" + +# Generic environment variables +export PAGER='less -M -X' +export EDITOR='vim' +export SVN_MERGE='svn-hgmerge.py' +export CVS_RSH='ssh' +export LESS="-R" + +insert_path_element ~/unixSoft/bin +unset MANPATH # smart man(1)s autodetect that from PATH. + +# Python stuff +export PYTHONSTARTUP="$HOME/.python/startup.py" + +MYPYTHONPATH="$HOME/unixSoft/lib/python:/opt/durin/lib/svn-python" +if [[ "$PYTHONPATH" == "" ]] ; then + export PYTHONPATH="$MYPYTHONPATH" +else + export PYTHONPATH="$PYTHONPATH:$MYPYTHONPATH" +fi
new file mode 100644 --- /dev/null +++ b/.shell.d/99.prompt.bash @@ -0,0 +1,13 @@ +if [ "x`whoami`" = "xroot" ] ; then + PS1='\e];\u@\h: \w [bash]\a[\h:\w] \e[31m\u\e[0m# ' +else + PS1='\[\e];\u@\h: \w [bash]\a\][\h:\w] \[\e[34m\]\u\[\e[0m\]$ ' +fi + +if [ "$TERM" = "rxvt" ] || [ "$TERM" = "xterm" ] \ + || [ "$TERM" = "xterm-color" ] || [ "$TERM" = "screen" ]; then + export FANCYTYPE="YES" +else + export FANCYTYPE="NO" + PS1='[\h:\w] \u$ ' +fi
--- a/.zshenv +++ b/.zshenv @@ -17,47 +17,25 @@ setopt extended_history setopt hist_save_no_dups # don't save duplicates in history setopt inc_append_history # append to history file so multiple processes DTRT -# Get me colors in ls -export CLICOLOR="yes" -export LSCOLORS="exgxcxDxCxEGEDcbcgExEx" - -# Generic environment variables -export PAGER='less -M -X' -export EDITOR='vim' -export SVN_MERGE='svn-hgmerge.py' -export CVS_RSH='ssh' -export LESS="-R" - -source $HOME/.zsh/00.path_manipulation.zsh -insert_path_element ~/unixSoft/bin -unset MANPATH # smart man(1)s autodetect that from PATH. - -# Python stuff -export PYTHONSTARTUP="$HOME/.python/startup.py" - -local MYPYTHONPATH="$HOME/unixSoft/lib/python:/opt/durin/lib/svn-python" -if [[ "$PYTHONPATH" == "" ]] ; then - export PYTHONPATH="$MYPYTHONPATH" -else - export PYTHONPATH="$PYTHONPATH:$MYPYTHONPATH" -fi +source $HOME/.shell.d/00.path_manipulation.sh +source $HOME/.shell.d/50.common_env.sh # prep to parse the zshenv-machine if [[ "x$TZ" == "x" ]] ; then - export MACHINE_TZ="xNoTimeZone" - local DEFAULT_TZ="America/Detroit" + export MACHINE_TZ="xNoTimeZone" + local DEFAULT_TZ="America/Detroit" fi # Do this right before the timezone stuff if [[ -a ~/.zshenv-machine ]]; then - source ~/.zshenv-machine + source ~/.zshenv-machine fi # do this last so that we can tell if .zshenv-machine set the timezone if [[ "x$TZ" == "x" ]] ; then - if [ "$MACHINE_TZ" = "xNoTimeZone" ]; then - export TZ="$DEFAULT_TZ" - else - export TZ="$MACHINE_TZ" - fi + if [ "$MACHINE_TZ" = "xNoTimeZone" ]; then + export TZ="$DEFAULT_TZ" + else + export TZ="$MACHINE_TZ" + fi fi
--- a/.zshrc +++ b/.zshrc @@ -1,22 +1,22 @@ # Augie Fackler's zshrc file -for file in $(ls $HOME/.zsh) ; do - source $HOME/.zsh/$file +for file in $(ls $HOME/.shell.d/*.{,z}sh) ; do + source $file done # Login greeting ------------------ if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then - if which screen > /dev/null; then - detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'` - if [ ! -z "$detached_screens" ]; then - echo "+---------------------------------------+" - echo "| Detached screens are available: |" - echo "$detached_screens" - echo "+---------------------------------------+" - fi - fi - export SHOWED_SCREEN_MESSAGE="true" + if which screen > /dev/null; then + detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'` + if [ ! -z "$detached_screens" ]; then + echo "+---------------------------------------+" + echo "| Detached screens are available: |" + echo "$detached_screens" + echo "+---------------------------------------+" + fi + fi + export SHOWED_SCREEN_MESSAGE="true" fi # If available, source private extensions stored in a different repo @@ -25,5 +25,5 @@ if [[ -a ~/.private/zshrc ]]; then fi if [[ -a ~/.zshrc-machine ]]; then - source ~/.zshrc-machine + source ~/.zshrc-machine fi