diff --git a/runcoms/zlogin b/runcoms/zlogin index 30549f33..cea16803 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -1,8 +1,14 @@ +# Sourced in login shells after .zshrc +# Commands that should be exectued only in login shells +# Do not set environment variables +# Do not define alias, functions, options, etc. +# Set terminal type +# Execute external commands (fortune, msgs, etc) # -# Executes commands at login post-zshrc. -# -# Authors: -# Sorin Ionescu +# $ZDOTDIR/.zshenv +# $ZDOTDIR/.zprofile +# $ZDOTDIR/.zshrc +# $ZDOTDIR/.zlogin # # Execute code that does not affect the current session in the background. @@ -21,3 +27,20 @@ if (( $+commands[fortune] )); then print fi fi + +echo "Last logins:" +last -5 $USER +echo + +echo "$BASH $BASH_VERSION" +date -u +"%a %e %b %Y %H:%M:%S GMT" +date -u +"%FT%TZ %Y-%jT%TZ %Y-W%W-%wT%TZ" +date +"%FT%T %Y-%jT%T %Y-W%W-%wT%T" +astrodate.py --jd --mjd --suffix --spacing=8 +echo + +# Setup by subsystem +for f in `find $HOME/Library/Scripts/config -name '*.shlogin'`; do + source "$f" +done + diff --git a/runcoms/zlogout b/runcoms/zlogout index 7c27e885..5422072d 100644 --- a/runcoms/zlogout +++ b/runcoms/zlogout @@ -1,9 +1,11 @@ -# -# Executes commands at logout. -# -# Authors: -# Sorin Ionescu -# +# Sourced when login shells exit + +if [ -z "${TERM_PROGRAM}" ] +then + if klist -s + then kdestroy + fi +fi # Print the message. cat <<-EOF diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 4778944c..2c1130d0 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -28,10 +28,19 @@ zstyle ':prezto:load' pmodule \ 'terminal' \ 'editor' \ 'history' \ + 'history-substring-search' \ 'directory' \ 'spectrum' \ 'utility' \ 'completion' \ + 'osx' \ + 'git' \ + 'node' \ + 'python' \ + 'haskell' \ + 'syntax-highlighting' \ + 'utility' \ + 'archive' \ 'prompt' # @@ -39,7 +48,7 @@ zstyle ':prezto:load' pmodule \ # # Set the key mapping style to 'emacs' or 'vi'. -zstyle ':prezto:module:editor' key-bindings 'emacs' +zstyle ':prezto:module:editor' key-bindings 'vi' # Auto convert .... to ../.. # zstyle ':prezto:module:editor' dot-expansion 'yes' diff --git a/runcoms/zprofile b/runcoms/zprofile index d87cb3b0..94d54913 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -1,56 +1,31 @@ +# Sourced in login shells before .zshrc +# Commands that should be exectued only in login shells +# Do not set environment variables +# Do not define alias, functions, options, etc. # -# Executes commands at login pre-zshrc. -# -# Authors: -# Sorin Ionescu -# +# $ZDOTDIR/.zshenv +# $ZDOTDIR/.zprofile +# $ZDOTDIR/.zshrc +# $ZDOTDIR/.zlogin -# # Browser -# - -if [[ "$OSTYPE" == darwin* ]]; then - export BROWSER='open' -fi +case `/usr/bin/uname -s` in + Darwin) + export BROWSER='open' + ;; +esac -# # Editors -# - -export EDITOR='nano' -export VISUAL='nano' +export EDITOR='vim' +export VISUAL='vim' export PAGER='less' +export LESSEDIT='vim' -# # Language -# - if [[ -z "$LANG" ]]; then export LANG='en_US.UTF-8' fi -# -# Paths -# - -# Ensure path arrays do not contain duplicates. -typeset -gU cdpath fpath mailpath path - -# Set the the list of directories that cd searches. -# cdpath=( -# $cdpath -# ) - -# Set the list of directories that Zsh searches for programs. -path=( - /usr/local/{bin,sbin} - $path -) - -# -# Less -# - # Set the default Less options. # Mouse-wheel scrolling has been disabled by -X (disable screen clearing). # Remove -X and -F (exit if the content fits on one screen) to enable it. @@ -62,10 +37,7 @@ if (( $#commands[(i)lesspipe(|.sh)] )); then export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" fi -# # Temporary Files -# - if [[ ! -d "$TMPDIR" ]]; then export TMPDIR="/tmp/$LOGNAME" mkdir -p -m 700 "$TMPDIR" diff --git a/runcoms/zshenv b/runcoms/zshenv index 2d972031..431c01da 100644 --- a/runcoms/zshenv +++ b/runcoms/zshenv @@ -1,11 +1,101 @@ +# Sourced on all invocations of shell unless -f option is set +# Command Search Path +# Important Environment Variables +# Do not produce output +# Do not assume tty # -# Defines environment variables. -# -# Authors: -# Sorin Ionescu -# +# $ZDOTDIR/.zshenv +# $ZDOTDIR/.zprofile +# $ZDOTDIR/.zshrc +# $ZDOTDIR/.zlogin + +export LANG=en_US.UTF-8 -# Ensure that a non-login, non-interactive shell has a defined environment. -if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then - source "${ZDOTDIR:-$HOME}/.zprofile" +declare UNAME_S=`/usr/bin/uname -s` +declare UNAME_M=`/usr/bin/uname -m` +declare UNAME_N=`/usr/bin/uname -n` + +# Setup path +path=( + $HOME/Library/Scripts/bin/`/usr/bin/uname -s`/`/usr/bin/uname -m` + $HOME/Library/Scripts/bin/`/usr/bin/uname -s` + $HOME/Library/Scripts/sh + $HOME/Library/Python/bin + /opt/local/bin /usr/local/bin /usr/bin /bin + /opt/local/sbin /usr/local/sbin /usr/sbin /sbin + /usr/X11R6/bin + /opt/local/Library/Frameworks/Python.framework/Versions/Current/bin +) + +if [ -d $HOME/.rvm/bin ]; then + path=($path $HOME/.rvm/bin) fi + +# Go +if [ -d /usr/local/go/bin ]; then + path=($path /usr/local/go/bin) + declare -x GOPATH="/Users/lanhel/Developer/SpaceMonkey/katamari/go" +fi + + +# Setup MANPATH +manpath=( + $HOME/man + /opt/local/man + /usr/local/share/man + /usr/local/man + /usr/share/man + /usr/man +) + +# Set the the list of directories that cd searches. +# cdpath=( +# $cdpath +# ) +# Setup file creation mask +#umask 077 + +# Setup by operating system type +case $UNAME_S in + Darwin) + path=($path /System/Applications /Applications) + + declare -x MANPATH=`echo $MANPATH | sed 's*'$HOME/man'*'$HOME/Library/man'*g'` + ;; + + linux*) + ;; +esac + +# Setup by processor type +case $UNAME_M in + powerpc) + ;; + + i386) + ;; +esac + +# Setup by host name +case $UNAME_N in + helsten) + ;; + + pfiefferhorn) + ;; +esac + +# Setup by subsystem +for f in `find $HOME/Library/Scripts/config -name '*.shenv' -print`; do + source "$f" +done + +# Ensure path arrays do not contain duplicates +typeset -gU cdpath fpath mailpath path + +# Cleanup +unset UNAME_S +unset UNAME_M +unset UNAME_N + + diff --git a/runcoms/zshrc b/runcoms/zshrc index 039b882d..b3e7a468 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -1,13 +1,87 @@ +# Sourced for interactive shells +# Set up aliases, functions, options, key bindings, etc. +# Do not produce output # -# Executes commands at the start of an interactive session. -# -# Authors: -# Sorin Ionescu +# $ZDOTDIR/.zshenv +# $ZDOTDIR/.zprofile +# $ZDOTDIR/.zshrc +# $ZDOTDIR/.zlogin # +# http://zsh.sourceforge.net # Source Prezto. if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" + source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +else + # Setup Prompt + declare PS1='%(!,%S%F{red},%F{green})%m:%!(%L)%#%(!,%s%f,%f) ' + #declare PS1="\[\033[1;30m\][\[\033[1;34m\]\$(date +%H:%M) \u\[\033[1;30m\]@\[\033[0;35m\]\h\[\033[1;30m\]] \[\033[0;37m\]\W \[\033[1;30m\]\$\[\033[0m\] " + #PS1=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} + #%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b ' + declare RPS1='%DT%*' +fi + +set -o vi + +# General Settings +declare -x CALENDAR_DIR="/usr/share/calendar" +declare HISTFILESIZE='50' +declare HISTSIZE='50' + +#aliases +alias c="clear; clear; dirs" +alias ls="ls -FGh" +alias su="su -m" +alias ping="ping -c 4" +alias sed="sed -E" +alias grep="grep -nHEI --color --exclude-dir=\.git --exclude-dir=\.hg --exclude-dir=\.svn --exclude-dir=build --exclude-dir=dist --exclude=tags" + +if [ "$ZSH_VERSION" ]; then + autoload -U compinit + compinit + + # cd hook + autoload -U add-zsh-hook + load-local-conf() { + # check file exists, is regular file and is readable: + if [[ -f .sh_source && -r .sh_source ]]; then + source .sh_source + fi + } + add-zsh-hook chpwd load-local-conf fi -# Customize to your needs... +# Setup by operating system type +case `/usr/bin/uname -s` in + Darwin) + alias psql_start="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data start" + alias psql_stop="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data stop" + ;; + + linux*) + ;; +esac + +# Setup by processor type +case `/usr/bin/uname -m` in + powerpc) + ;; + + i386) + ;; +esac + +# Setup by host name +case `/usr/bin/uname -n` in + helsten) + ;; + + pfiefferhorn) + ;; +esac + +# Setup by subsystem +for f in `find $HOME/Library/Scripts/config -name '*.shrc'`; do + source "$f" +done +