[#255] Use $ZDOTDIR or $HOME

This commit is contained in:
Sorin Ionescu 2012-09-03 16:13:53 -04:00
parent fb9a20591f
commit 8cdf06e386
7 changed files with 18 additions and 15 deletions

View file

@ -40,7 +40,7 @@ function pmodload {
pmodules=("$argv[@]") pmodules=("$argv[@]")
# Add functions to $fpath. # Add functions to $fpath.
fpath=(${pmodules:+${PREZTO}/modules/${^pmodules}/functions(/FN)} $fpath) fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
function { function {
local pfunction local pfunction
@ -49,7 +49,7 @@ function pmodload {
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
# Load Prezto functions. # Load Prezto functions.
for pfunction in $PREZTO/modules/${^pmodules}/functions/$~pfunction_glob; do for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
autoload -Uz "$pfunction" autoload -Uz "$pfunction"
done done
} }
@ -58,19 +58,19 @@ function pmodload {
for pmodule in "$pmodules[@]"; do for pmodule in "$pmodules[@]"; do
if zstyle -t ":prezto:module:$pmodule" loaded; then if zstyle -t ":prezto:module:$pmodule" loaded; then
continue continue
elif [[ ! -d "$PREZTO/modules/$pmodule" ]]; then elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then
print "$0: no such module: $pmodule" >&2 print "$0: no such module: $pmodule" >&2
continue continue
else else
if [[ -s "$PREZTO/modules/$pmodule/init.zsh" ]]; then if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then
source "$PREZTO/modules/$pmodule/init.zsh" source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh"
fi fi
if (( $? == 0 )); then if (( $? == 0 )); then
zstyle ":prezto:module:$pmodule" loaded 'yes' zstyle ":prezto:module:$pmodule" loaded 'yes'
else else
# Remove the $fpath entry. # Remove the $fpath entry.
fpath[(r)$PREZTO/modules/${pmodule}/functions]=() fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=()
function { function {
local pfunction local pfunction
@ -80,7 +80,7 @@ function pmodload {
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
# Unload Prezto functions. # Unload Prezto functions.
for pfunction in $PREZTO/modules/$pmodule/functions/$~pfunction_glob; do for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do
unfunction "$pfunction" unfunction "$pfunction"
done done
} }

View file

@ -13,6 +13,11 @@ if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
fi fi
unset min_zsh_version unset min_zsh_version
# Source the Prezto configuration file.
if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
source "${ZDOTDIR:-$HOME}/.zpreztorc"
fi
# Disable color and theme in dumb terminals. # Disable color and theme in dumb terminals.
if [[ "$TERM" == 'dumb' ]]; then if [[ "$TERM" == 'dumb' ]]; then
zstyle ':prezto:*:*' color 'no' zstyle ':prezto:*:*' color 'no'

View file

@ -39,7 +39,7 @@ WORDCHARS='*?_-.[]~&;!#$%^(){}<>'
# Use caching to make completion for cammands such as dpkg and apt usable. # Use caching to make completion for cammands such as dpkg and apt usable.
zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "$HOME/.zcompcache" zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
# Case-insensitive (all), partial-word, and then substring completion. # Case-insensitive (all), partial-word, and then substring completion.
if zstyle -t ':prezto:module:completion:*' case-sensitive; then if zstyle -t ':prezto:module:completion:*' case-sensitive; then

View file

@ -10,7 +10,7 @@
# Variables # Variables
# #
HISTFILE="$HOME/.zhistory" # The path to the history file. HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.
HISTSIZE=10000 # The maximum number of events to save in the internal history. HISTSIZE=10000 # The maximum number of events to save in the internal history.
SAVEHIST=10000 # The maximum number of events to save in the history file. SAVEHIST=10000 # The maximum number of events to save in the history file.

View file

@ -8,7 +8,7 @@
# Execute code that does not affect the current session in the background. # Execute code that does not affect the current session in the background.
{ {
# Compile the completion dump to increase startup speed. # Compile the completion dump to increase startup speed.
zcompdump="$HOME/.zcompdump" zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
if [[ "$zcompdump" -nt "${zcompdump}.zwc" || ! -s "${zcompdump}.zwc" ]]; then if [[ "$zcompdump" -nt "${zcompdump}.zwc" || ! -s "${zcompdump}.zwc" ]]; then
zcompile "$zcompdump" zcompile "$zcompdump"
fi fi

View file

@ -5,10 +5,6 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
# Set the path to Prezto.
export ZDOTDIR="${ZDOTDIR:-$HOME}"
export PREZTO="$ZDOTDIR/.zprezto"
# #
# Browser # Browser
# #

View file

@ -45,7 +45,9 @@ zstyle ':prezto:load' pmodule \
zstyle ':prezto:module:prompt' theme 'sorin' zstyle ':prezto:module:prompt' theme 'sorin'
# Source Prezto. # Source Prezto.
source "$PREZTO/init.zsh" if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# Customize to your needs... # Customize to your needs...