From c76bb681148f6b84b8007e595edb073671ccb385 Mon Sep 17 00:00:00 2001 From: Sebastian Tramp Date: Thu, 23 Aug 2012 11:08:03 +0200 Subject: [PATCH] introduce a basic environment config --- aliases.zsh | 9 +++------ colors.zsh | 36 ------------------------------------ environment.zsh | 17 +++++++++++++++++ zshrc | 11 +++++------ 4 files changed, 25 insertions(+), 48 deletions(-) delete mode 100644 colors.zsh create mode 100644 environment.zsh diff --git a/aliases.zsh b/aliases.zsh index 6d4f397..a2b3de5 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -6,11 +6,9 @@ export EDITOR="vim" alias vi="vim" -alias aedit=" $EDITOR ~/.zsh/aliases.zsh; source ~/.zsh/aliases.zsh" -alias fedit=" $EDITOR ~/.zsh/functions.zsh; source ~/.zsh/functions.zsh" -alias pedit=" $EDITOR ~/.zsh/private.zsh; source ~/.zsh/private.zsh" -alias vedit=" $EDITOR /etc/httpd/conf/extra/httpd-vhosts.conf" -alias gedit=" $EDITOR ~/.gitconfig" +alias aedit=" $EDITOR $ZSH_CONFG/aliases.zsh; source $ZSH_CONFIG/aliases.zsh" +alias fedit=" $EDITOR $ZSH_CONFG/functions.zsh; source $ZSH_CONFIG/functions.zsh" +alias pedit=" $EDITOR $ZSH_CONFIG/private.zsh; source $ZSH_CONFIG/private.zsh" #alias man="unset PAGER; man" alias grep='grep --color=auto' @@ -33,7 +31,6 @@ alias g='git' alias d=' dirs -v' alias ka="killall" -#alias .='open .' alias cd=' cd' alias ..=' cd ..; ls' alias ...=' cd ..; cd ..; ls' diff --git a/colors.zsh b/colors.zsh deleted file mode 100644 index affec11..0000000 --- a/colors.zsh +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/zsh -# A script to make using 256 colors in zsh less painful. -# P.C. Shyamshankar -# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ - -typeset -Ag FX FG BG - -FX=( - reset "%{%}" - bold "%{%}" no-bold "%{%}" - italic "%{%}" no-italic "%{%}" - underline "%{%}" no-underline "%{%}" - blink "%{%}" no-blink "%{%}" - reverse "%{%}" no-reverse "%{%}" -) - -for color in {000..255}; do - FG[$color]="%{[38;5;${color}m%}" - BG[$color]="%{[48;5;${color}m%}" -done - - -# See if we can use colors. -# Original from Phil Gold at http://aperiodic.net/phil/prompt/ -autoload colors zsh/terminfo -if [[ "$terminfo[colors]" -ge 8 ]]; then - colors -fi -for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) -done -PR_NO_COLOR="%{$terminfo[sgr0]%}" - - diff --git a/environment.zsh b/environment.zsh new file mode 100644 index 0000000..6a348d9 --- /dev/null +++ b/environment.zsh @@ -0,0 +1,17 @@ +# @author Sebastian Tramp +# @license http://opensource.org/licenses/gpl-license.php +# +# Basic environment settings related to the zsh compiliation (not private) + +# XDG Base Directory Specification +# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export ZSH_CONFIG="$XDG_CONFIG_HOME/zsh" +export ZSH_CACHE="$XDG_CACHE_HOME/zsh" +mkdir -p $ZSH_CACHE + +# executable search path +export PATH=$HOME/.local/bin:$PATH + + diff --git a/zshrc b/zshrc index 6fdfa0c..287ac9f 100644 --- a/zshrc +++ b/zshrc @@ -4,13 +4,11 @@ # the main RC file (will be linked to ~/.zshrc) # -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_HOME="$HOME/.cache" -export ZSH_CONFIG="$XDG_CONFIG_HOME/zsh" -export ZSH_CACHE="$XDG_CACHE_HOME/zsh" -mkdir -p $ZSH_CACHE +# first include of the environment +source $HOME/.config/zsh/environment.zsh typeset -ga sources +sources+="$ZSH_CONFIG/environment.zsh" sources+="$ZSH_CONFIG/options.zsh" sources+="$ZSH_CONFIG/prompt.zsh" sources+="$ZSH_CONFIG/functions.zsh" @@ -32,9 +30,10 @@ sources+="$ZSH_CONFIG/autojump/autojump.zsh" systemFile=`uname -s | tr "[:upper:]" "[:lower:]"` sources+="$ZSH_CONFIG/$systemFile.zsh" -# Finally include the private.zsh file +# Private aliases and adoptions sources+="$ZSH_CONFIG/private.zsh" +# completion config needs to be after system and private config sources+="$ZSH_CONFIG/completion.zsh" # try to include all sources