From 81b5f4c020a9f60fc6e1c1dfec8f7ce5cf3d62c8 Mon Sep 17 00:00:00 2001 From: Akelge Date: Wed, 16 Jan 2013 10:08:25 +0000 Subject: [PATCH] Modified Processing of source files Changed prompts Added 99-local autocreation --- zsh/zsh.d/30-aliases | 8 ++++++ zsh/zsh.d/30-prompt | 28 ++----------------- zsh/zsh.d/{99-virtualenv => 90-virtualenv} | 0 zsh/zsh.d/prompts/prompt_minimal_setup | 19 +++++++++++++ zsh/zsh.d/prompts/prompt_nice_setup | 19 +++++++++++++ .../prompt_plain_setup} | 16 +++++------ zsh/zshrc | 25 +++++++++++------ 7 files changed, 72 insertions(+), 43 deletions(-) rename zsh/zsh.d/{99-virtualenv => 90-virtualenv} (100%) create mode 100644 zsh/zsh.d/prompts/prompt_minimal_setup create mode 100644 zsh/zsh.d/prompts/prompt_nice_setup rename zsh/zsh.d/{zshfunctions/prompt_akel1_setup => prompts/prompt_plain_setup} (50%) diff --git a/zsh/zsh.d/30-aliases b/zsh/zsh.d/30-aliases index 184930a..44b4ff3 100644 --- a/zsh/zsh.d/30-aliases +++ b/zsh/zsh.d/30-aliases @@ -26,4 +26,12 @@ alias soa='host -t soa' alias ptr='host -t ptr' alias vi="vim " + +# Global Aliases +# +alias -g L="|less" +alias -g NO="> /dev/null" +alias -g NE="2> /dev/null" +alias -g NA="> /dev/null 2>&1" + # vim: set ts=4 sw=4 tw=0 ft=zsh : diff --git a/zsh/zsh.d/30-prompt b/zsh/zsh.d/30-prompt index a33e9cc..f2d54e4 100644 --- a/zsh/zsh.d/30-prompt +++ b/zsh/zsh.d/30-prompt @@ -1,29 +1,5 @@ -####################################################################################### +fpath=(`dirname $0`/prompts $fpath) -# prompt_akel_setup() { - # precmd () { - - # # Setup PROMPT - # if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then - # # We are on xterminal - # W="%{]2;::: %n at %m in %. :::%}" - # I="%{]1;%m::%.%}" - # L="%B%K{blue}%F{white}@%m::%2~ %f%k -# %F{yellow}%#%f%b " - # PS1="$W$I$L" - # unset W I L - - # else - # # We are not on xterminal - # PS1="%B[%l] %n@%m:%~ %#%b " - # fi - # } - - # preexec () { } - -# } - -# prompt_akel_setup autoload -U promptinit;promptinit -prompt akel1 + # vim: set ts=4 sw=4 tw=0 ft=zsh : diff --git a/zsh/zsh.d/99-virtualenv b/zsh/zsh.d/90-virtualenv similarity index 100% rename from zsh/zsh.d/99-virtualenv rename to zsh/zsh.d/90-virtualenv diff --git a/zsh/zsh.d/prompts/prompt_minimal_setup b/zsh/zsh.d/prompts/prompt_minimal_setup new file mode 100644 index 0000000..07e505f --- /dev/null +++ b/zsh/zsh.d/prompts/prompt_minimal_setup @@ -0,0 +1,19 @@ +function prompt_minimal_setup { +# Setup PROMPT +if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then + # We are on xterminal + W="%n@%m:%." + I="%m:%." + L="%B%. %#%b " + PS1="%{]2;$W%}%{]1;$I%}$L" + unset W I L + +else + # We are not on xterminal + PS1="%B%. %#%b " +fi +} + +prompt_minimal_setup + +# vim: set ts=4 sw=4 tw=0 ft=zsh : diff --git a/zsh/zsh.d/prompts/prompt_nice_setup b/zsh/zsh.d/prompts/prompt_nice_setup new file mode 100644 index 0000000..ddf1cce --- /dev/null +++ b/zsh/zsh.d/prompts/prompt_nice_setup @@ -0,0 +1,19 @@ +function prompt_nice_setup { + +if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then + W="::: %n at %m in %. :::" + I="%m::%." + L="%B%K{blue}%F{white}@%m::%2~ %f%k +%F{yellow}%#%f%b " + PS1="%{]2;$W%}%{]1;$I%}$L" + unset W I L + +else + # We are not on xterminal + PS1="%B%K{blue}%F{white}[%l] %n@%m:%~ %f%k%F{yellow}%#%f%b " +fi +} + +prompt_nice_setup + +# vim: set ts=4 sw=4 tw=0 ft=zsh : diff --git a/zsh/zsh.d/zshfunctions/prompt_akel1_setup b/zsh/zsh.d/prompts/prompt_plain_setup similarity index 50% rename from zsh/zsh.d/zshfunctions/prompt_akel1_setup rename to zsh/zsh.d/prompts/prompt_plain_setup index 714a7b1..8f241b6 100644 --- a/zsh/zsh.d/zshfunctions/prompt_akel1_setup +++ b/zsh/zsh.d/prompts/prompt_plain_setup @@ -1,13 +1,11 @@ -function prompt_akel1_setup { - +function prompt_plain_setup { # Setup PROMPT if [ ${TERM[0,5]} = "xterm" ] || [ ${TERM} = "rxvt" ]; then # We are on xterminal - W="%{]2;::: %n at %m in %. :::%}" - I="%{]1;%m::%.%}" - L="%B%K{blue}%F{white}@%m::%2~ %f%k -%F{yellow}%#%f%b " - PS1="$W$I$L" + W="%n@%m:%." + I="%m:%." + L="%B[%l] %~ %#%b " + PS1="%{]2;$W%}%{]1;$I%}$L" unset W I L else @@ -16,4 +14,6 @@ else fi } -prompt_akel1_setup +prompt_plain_setup + +# vim: set ts=4 sw=4 tw=0 ft=zsh : diff --git a/zsh/zshrc b/zsh/zshrc index cf5e693..91d6b2d 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -6,21 +6,28 @@ # # Global Order: zshenv, zprofile, zshrc, zlogin # + +# Determine zsh conf file position. On Debian/Ubuntu is /etc/zsh, on other should be /etc +[ -d /etc/zsh ] && BASE="/etc/zsh" || BASE="/etc" + KERNEL=`uname -s` -LIBRARY="/etc/zsh.d" -KERNLIB="${LIBRARY}/${KERNEL}" +LIBRARY=${BASE}/zsh.d +KERNLIB=${LIBRARY}/${KERNEL} function loadRC { + # [ -d $1 ] && cd $1 || exit 1 + if [ -d $1/zshfunctions ]; then fpath=($1/zshfunctions $fpath) fi - if [ -d $1 ]; then - # for zshFile in $1/*[^~]; do - for zshFile in $1/*[^off\|~]; do - . $zshFile - done - fi + # Add local customization file, svn ignored + [ -f $1/99-local ] || echo "# Local customizations" > $1/99-local + + for zshFile in $1/[0-9]*[^off\|~]; do + . $zshFile + done + unset zshFile } @@ -32,7 +39,7 @@ unset LIBRARY unset KERNLIB # Local (per Host) customizations -for localDir in /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do +for localDir in ${LIBRARY} /etc/zsh /etc /usr/local/etc /usr/local/etc/zsh; do if [ -f ${localDir}/zshrc.local ]; then . ${localDir}/zshrc.local fi