# HG changeset patch # User Augie Fackler # Date 1232997660 21600 # Node ID 62bfb554ab85edcae1d20e3898ab0c57cfe7c95f # Parent f70862dadf83fc1327acb1b7921d2561c61b7dc2 Reorganize zsh files so that bash can work as well. diff --git a/.bashrc b/.bashrc --- 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 diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -11,6 +11,7 @@ syntax:glob .appcfg_cookies .appcfg_nag .aspell* +.bashrc-machine .codereview_upload_cookies .dropbox .dvdcss diff --git a/.zsh/00.path_manipulation.zsh b/.shell.d/00.path_manipulation.sh rename from .zsh/00.path_manipulation.zsh rename to .shell.d/00.path_manipulation.sh diff --git a/.zsh/01.aliases.zsh b/.shell.d/01.aliases.sh 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 diff --git a/.shell.d/50.common_env.sh b/.shell.d/50.common_env.sh 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 diff --git a/.zsh/50.completions.zsh b/.shell.d/50.completions.zsh rename from .zsh/50.completions.zsh rename to .shell.d/50.completions.zsh diff --git a/.zsh/50.editorsetup.zsh b/.shell.d/50.editorsetup.sh rename from .zsh/50.editorsetup.zsh rename to .shell.d/50.editorsetup.sh diff --git a/.zsh/50.keybindings.zsh b/.shell.d/50.keybindings.zsh rename from .zsh/50.keybindings.zsh rename to .shell.d/50.keybindings.zsh diff --git a/.zsh/50.misc_functions.zsh b/.shell.d/50.misc_functions.zsh rename from .zsh/50.misc_functions.zsh rename to .shell.d/50.misc_functions.zsh diff --git a/.zsh/50.vcs_functions.zsh b/.shell.d/50.vcs_functions.sh rename from .zsh/50.vcs_functions.zsh rename to .shell.d/50.vcs_functions.sh diff --git a/.shell.d/99.prompt.bash b/.shell.d/99.prompt.bash 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 diff --git a/.zsh/99.prompt.zsh b/.shell.d/99.prompt.zsh rename from .zsh/99.prompt.zsh rename to .shell.d/99.prompt.zsh diff --git a/.zshenv b/.zshenv --- 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 diff --git a/.zshrc b/.zshrc --- 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