diff --git a/init.zsh b/init.zsh old mode 100644 new mode 100755 index 6b5254fb..57f99c2c --- a/init.zsh +++ b/init.zsh @@ -1,3 +1,4 @@ +#!/usr/bin/env zsh # # Initializes Prezto. # @@ -31,7 +32,7 @@ function pmodload { pmodules=("$argv[@]") # Add functions to $fpath. - fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath) + fpath=(${pmodules:+$DOTFILES/zprezto/modules/${^pmodules}/functions(/FN)} $fpath) function { local pfunction @@ -40,7 +41,7 @@ function pmodload { setopt LOCAL_OPTIONS EXTENDED_GLOB # Load Prezto functions. - for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do + for pfunction in $DOTFILES/zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do autoload -Uz "$pfunction" done } @@ -49,19 +50,19 @@ function pmodload { for pmodule in "$pmodules[@]"; do if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then continue - elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then + elif [[ ! -d "$DOTFILES/zprezto/modules/$pmodule" ]]; then print "$0: no such module: $pmodule" >&2 continue else - if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" + if [[ -s "$DOTFILES/zprezto/modules/$pmodule/init.zsh" ]]; then + source "$DOTFILES/zprezto/modules/$pmodule/init.zsh" fi if (( $? == 0 )); then zstyle ":prezto:module:$pmodule" loaded 'yes' else # Remove the $fpath entry. - fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=() + fpath[(r)$DOTFILES/zprezto/modules/${pmodule}/functions]=() function { local pfunction @@ -71,7 +72,7 @@ function pmodload { setopt LOCAL_OPTIONS EXTENDED_GLOB # Unload Prezto functions. - for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do + for pfunction in $DOTFILES/zprezto/modules/$pmodule/functions/$~pfunction_glob; do unfunction "$pfunction" done } diff --git a/runcoms/zlogin b/runcoms/zlogin index 30549f33..d46d4093 100644 --- a/runcoms/zlogin +++ b/runcoms/zlogin @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # # Executes commands at login post-zshrc. # @@ -13,11 +15,3 @@ zcompile "$zcompdump" fi } &! - -# Print a random, hopefully interesting, adage. -if (( $+commands[fortune] )); then - if [[ -t 0 || -t 1 ]]; then - fortune -s - print - fi -fi diff --git a/runcoms/zlogout b/runcoms/zlogout deleted file mode 100644 index 7c27e885..00000000 --- a/runcoms/zlogout +++ /dev/null @@ -1,13 +0,0 @@ -# -# Executes commands at logout. -# -# Authors: -# Sorin Ionescu -# - -# Print the message. -cat <<-EOF - -Thank you. Come again! - -- Dr. Apu Nahasapeemapetilon -EOF diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index e93ac6bf..8cadf90c 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # # Sets Prezto options. # @@ -27,13 +29,23 @@ zstyle ':prezto:load' pmodule \ 'environment' \ 'terminal' \ 'editor' \ + 'archive' \ 'history' \ 'directory' \ 'spectrum' \ 'utility' \ 'completion' \ + 'python' \ + 'ruby' \ + 'node' \ + 'rsync' \ + 'syntax-highlighting' \ + 'history-substring-search' \ + 'git' \ + 'spectrum' \ 'prompt' + # # Autosuggestions # @@ -49,7 +61,7 @@ zstyle ':prezto:load' pmodule \ zstyle ':prezto:module:editor' key-bindings 'emacs' # Auto convert .... to ../.. -# zstyle ':prezto:module:editor' dot-expansion 'yes' +zstyle ':prezto:module:editor' dot-expansion 'yes' # # Git @@ -70,13 +82,13 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # # Set the query found color. -# zstyle ':prezto:module:history-substring-search:color' found '' +zstyle ':prezto:module:history-substring-search:color' found '' # Set the query not found color. -# zstyle ':prezto:module:history-substring-search:color' not-found '' +zstyle ':prezto:module:history-substring-search:color' not-found '' # Set the search globbing flags. -# zstyle ':prezto:module:history-substring-search' globbing-flags '' +zstyle ':prezto:module:history-substring-search' globbing-flags '' # # Pacman @@ -92,7 +104,7 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Set the prompt theme to load. # Setting it to 'random' loads a random theme. # Auto set to 'off' on dumb terminals. -zstyle ':prezto:module:prompt' theme 'sorin' +zstyle ':prezto:module:prompt' theme 'craveytrain' # # Ruby diff --git a/runcoms/zprofile b/runcoms/zprofile index d87cb3b0..b2f3121c 100644 --- a/runcoms/zprofile +++ b/runcoms/zprofile @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # # Executes commands at login pre-zshrc. # @@ -13,14 +15,6 @@ if [[ "$OSTYPE" == darwin* ]]; then export BROWSER='open' fi -# -# Editors -# - -export EDITOR='nano' -export VISUAL='nano' -export PAGER='less' - # # Language # diff --git a/runcoms/zshenv b/runcoms/zshenv index 2d972031..2e6329f6 100644 --- a/runcoms/zshenv +++ b/runcoms/zshenv @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # # Defines environment variables. # @@ -5,6 +7,8 @@ # Sorin Ionescu # +export DOTFILES="$(cd "$(dirname "$(readlink ~/.bashrc)")" && cd .. && pwd)" + # 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" diff --git a/runcoms/zshrc b/runcoms/zshrc index 039b882d..52645f12 100644 --- a/runcoms/zshrc +++ b/runcoms/zshrc @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + # # Executes commands at the start of an interactive session. # @@ -6,8 +8,25 @@ # # Source Prezto. -if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then - source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" +if [[ -s "$DOTFILES/zprezto/init.zsh" ]]; then + source "$DOTFILES/zprezto/init.zsh" fi # Customize to your needs... +source_if_present() { + if [ -f "$1" ]; then + . "$1" + fi +} + +# Reload profile +alias reload!=". $HOME/.zshrc" + +path=( + $HOME/bin + $DOTFILES/bin + /usr/local/opt/coreutils + $path +) + +source_if_present "$DOTFILES/system/load.sh"