use consistent variable style

This commit is contained in:
Matt Hamilton 2015-12-19 09:48:29 -05:00
parent 08c9987b38
commit a1a56ac63f
30 changed files with 123 additions and 125 deletions

View File

@ -42,14 +42,14 @@ uninstall those first to prevent conflicts.
1. In Zsh, clone the repository: 1. In Zsh, clone the repository:
``` ```
git clone --recursive https://github.com/Eriner/zim.git ${ZDOTDIR:-$HOME}/.zim git clone --recursive https://github.com/Eriner/zim.git ${ZDOTDIR:-${HOME}}/.zim
``` ```
2. Copy the template configuration files (or append to existing configs): 2. Copy the template configuration files (or append to existing configs):
``` ```
setopt EXTENDED_GLOB setopt EXTENDED_GLOB
for template_file ( ${ZDOTDIR:-$HOME}/.zim/templates/* ); do for template_file ( ${ZDOTDIR:-${HOME}}/.zim/templates/* ); do
cat ${template_file} | tee -a ${ZDOTDIR:-$HOME}/.$(basename ${template_file}) > /dev/null cat ${template_file} | tee -a ${ZDOTDIR:-${HOME}}/.$(basename ${template_file}) > /dev/null
done done
``` ```
@ -60,7 +60,7 @@ uninstall those first to prevent conflicts.
4. Open a new terminal and finish optimization (this is only needed once, hereafter it will happen upon desktop/tty login): 4. Open a new terminal and finish optimization (this is only needed once, hereafter it will happen upon desktop/tty login):
``` ```
source ~/.zlogin source ${ZDOTDIR:-${HOME}}/.zlogin
``` ```
5. You're done! Enjoy your Zsh IMproved! Take some time to read about the [available modules][modules] and tweak your `.zshrc` file. 5. You're done! Enjoy your Zsh IMproved! Take some time to read about the [available modules][modules] and tweak your `.zshrc` file.

View File

@ -3,21 +3,21 @@
# #
# Define zim location # Define zim location
ZIM="${ZDOTDIR:-$HOME}/.zim" ZIM="${ZDOTDIR:-${HOME}}/.zim"
# Source user configuration # Source user configuration
if [[ -s "${ZDOTDIR:-$HOME}/.zimrc" ]]; then if [[ -s "${ZDOTDIR:-${HOME}}/.zimrc" ]]; then
source "${ZDOTDIR:-$HOME}/.zimrc" source "${ZDOTDIR:-${HOME}}/.zimrc"
fi fi
load_zim_module() { load_zim_module() {
local wanted_module local wanted_module
for wanted_module ($zmodules); do for wanted_module (${zmodules}); do
if [[ -s "${ZIM}/modules/$wanted_module/init.zsh" ]]; then if [[ -s "${ZIM}/modules/${wanted_module}/init.zsh" ]]; then
source "${ZIM}/modules/$wanted_module/init.zsh" source "${ZIM}/modules/${wanted_module}/init.zsh"
elif [[ ! -d "${ZIM}/modules/$wanted_module" ]]; then elif [[ ! -d "${ZIM}/modules/${wanted_module}" ]]; then
print "No such module \"$wanted_module\"." >&2 print "No such module \"${wanted_module}\"." >&2
fi fi
done done
} }
@ -32,7 +32,7 @@ load_zim_function() {
function { function {
setopt LOCAL_OPTIONS EXTENDED_GLOB setopt LOCAL_OPTIONS EXTENDED_GLOB
for mod_function in ${ZIM}/modules/${^zmodules}/functions/$~function_glob; do for mod_function in ${ZIM}/modules/${^zmodules}/functions/${~function_glob}; do
autoload -Uz ${mod_function} autoload -Uz ${mod_function}
done done
} }

View File

@ -4,9 +4,9 @@
local archive_name dir_to_archive _gzip_bin _bzip2_bin local archive_name dir_to_archive _gzip_bin _bzip2_bin
if (( $# != 2 )); then if (( ${#} != 2 )); then
cat >&2 <<EOF cat >&2 <<EOF
usage: $0 [archive_name.zip] [/path/to/include/into/archive] usage: ${0} [archive_name.zip] [/path/to/include/into/archive]
Where 'archive.zip' uses any of the following extensions: Where 'archive.zip' uses any of the following extensions:
.tar.gz, .tar.bz2, .tar.xz, .tar.lzma, .tar, .zip, .rar, .7z .tar.gz, .tar.bz2, .tar.xz, .tar.lzma, .tar, .zip, .rar, .7z
There is no '-v' switch; all operations are verbose. There is no '-v' switch; all operations are verbose.
@ -24,18 +24,18 @@ dir_to_archive="${2}"
# if the directory doesn't exist, quit. Nothing to archive # if the directory doesn't exist, quit. Nothing to archive
if [[ ! -e "${dir_to_archive}" ]]; then if [[ ! -e "${dir_to_archive}" ]]; then
print "$0: file or directory not valid: ${dir_to_archive}" >&2 print "${0}: file or directory not valid: ${dir_to_archive}" >&2
return 1 return 1
fi fi
# here, we check for dropin/multi-threaded replacements # here, we check for dropin/multi-threaded replacements
if (( $+commands[pigz] )); then if (( ${+commands[pigz]} )); then
_gzip_bin='pigz' _gzip_bin='pigz'
else else
_gzip_bin='gzip' _gzip_bin='gzip'
fi fi
if (( $+commands[pbzip2] )); then if (( ${+commands[pbzip2]} )); then
_bzip2_bin='pbzip2' _bzip2_bin='pbzip2'
else else
_bzip2_bin='bzip2' _bzip2_bin='bzip2'

View File

@ -4,9 +4,9 @@
local archive_name _gunzip_bin _bunzip2_bin local archive_name _gunzip_bin _bunzip2_bin
if (( $# != 1 )); then if (( ${#} != 1 )); then
cat >&2 <<EOF cat >&2 <<EOF
usage: $0 [archive.zip] usage: ${0} [archive.zip]
EOF EOF
return 1 return 1
fi fi

View File

@ -8,11 +8,11 @@
# pigz # pigz
# #
if (( $+commands[pigz] )); then if (( ${+commands[pigz]} )); then
alias gzip='pigz' alias gzip='pigz'
fi fi
if (( $+commands[unpigz] )); then if (( ${+commands[unpigz]} )); then
alias gunzip='pigz' alias gunzip='pigz'
fi fi
@ -20,10 +20,10 @@ fi
# pbzip2 # pbzip2
# #
if (( $+commands[pbzip2] )); then if (( ${+commands[pbzip2]} )); then
alias bzip2='pbzip2' alias bzip2='pbzip2'
fi fi
if (( $+commands[pbunzip2] )); then if (( ${+commands[pbunzip2]} )); then
alias bunzip2='pbzip2' alias bunzip2='pbzip2'
fi fi

View File

@ -16,14 +16,14 @@ fi
fpath=(${0:h}/external/src ${fpath}) fpath=(${0:h}/external/src ${fpath})
# load and initialize the completion system # load and initialize the completion system
autoload -Uz compinit && compinit -C -d ${ZDOTDIR:-$HOME}/.zcompdump autoload -Uz compinit && compinit -C -d ${ZDOTDIR:-${HOME}}/.zcompdump
# set any compdefs # set any compdefs
source ${0:h}/compdefs.zsh source ${0:h}/compdefs.zsh
{ {
# zcomple the .zcompdump in the background # zcomple the .zcompdump in the background
local zcompdump=${ZDOTDIR:-$HOME}/.zcompdump local zcompdump=${ZDOTDIR:-${HOME}}/.zcompdump
if [[ -s ${zcompdump} && ( ! -s ${zcompdump}.zwc || ${zcompdump} -nt ${zcompdump}.zwc) ]]; then if [[ -s ${zcompdump} && ( ! -s ${zcompdump}.zwc || ${zcompdump} -nt ${zcompdump}.zwc) ]]; then
zcompile ${zcompdump} zcompile ${zcompdump}
@ -86,7 +86,7 @@ zstyle ':completion:*' squeeze-slashes true
# enable caching # enable caching
zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache" zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-${HOME}}/.zcompcache"
# ignore useless commands and functions # ignore useless commands and functions
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|prompt_*)' zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|prompt_*)'

View File

@ -19,7 +19,7 @@ setopt PUSHD_IGNORE_DUPS
# Do not print the directory stack after pushd or popd. # Do not print the directory stack after pushd or popd.
setopt PUSHD_SILENT setopt PUSHD_SILENT
# Have pushd with no arguments act like pushd $HOME. # Have pushd with no arguments act like pushd ${HOME}.
setopt PUSHD_TO_HOME setopt PUSHD_TO_HOME
# #

View File

@ -6,7 +6,7 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
fi fi

View File

@ -7,10 +7,10 @@
local git_dir="${$(git rev-parse --git-dir):A}" local git_dir="${$(git rev-parse --git-dir):A}"
if [[ -n "$git_dir" ]]; then if [[ -n "${git_dir}" ]]; then
print "$git_dir" print "${git_dir}"
return 0 return 0
else else
print "$0: not a repository: $PWD" >&2 print "${0}: not a repository: ${PWD}" >&2
return 1 return 1
fi fi

View File

@ -12,6 +12,6 @@ if ! git-root &> /dev/null; then
fi fi
# we are in a git repository. add parameters to .gitignore # we are in a git repository. add parameters to .gitignore
for file in "$@"; do for file in "${@}"; do
print "$file" >>! $(git-root)/.gitignore print "${file}" >>! $(git-root)/.gitignore
done done

View File

@ -7,10 +7,10 @@
local root="$(git rev-parse --show-toplevel 2> /dev/null)" local root="$(git rev-parse --show-toplevel 2> /dev/null)"
if [[ -n "$root" ]]; then if [[ -n "${root}" ]]; then
print "$root" print "${root}"
return 0 return 0
else else
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
fi fi

View File

@ -6,7 +6,7 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
fi fi
@ -14,8 +14,8 @@ local stashed
if [[ -f "$(git-dir)/refs/stash" ]]; then if [[ -f "$(git-dir)/refs/stash" ]]; then
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')" stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
if (( $stashed > 0 )); then if (( ${stashed} > 0 )); then
if read -q "?Clear $stashed stashed state(s) [y/N]? "; then if read -q "?Clear ${stashed} stashed state(s) [y/N]? "; then
git stash clear git stash clear
fi fi
fi fi

View File

@ -6,7 +6,7 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
fi fi

View File

@ -6,13 +6,13 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
fi fi
local commit local commit
for commit in "$@"; do for commit in "${@}"; do
git update-ref \ git update-ref \
-m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit" -m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "${commit}"
done done

View File

@ -6,27 +6,27 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
elif [[ "$PWD" != "$(git-root)" ]]; then elif [[ "${PWD}" != "$(git-root)" ]]; then
print "$0: must be run from the root of the work tree" >&2 print "${0}: must be run from the root of the work tree" >&2
return 1 return 1
fi fi
local src="$1" local src="${1}"
local dst="$2" local dst="${2}"
local url local url
url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")" url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
if [[ -z "$url" ]]; then if [[ -z "${url}" ]]; then
print "$0: submodule not found: $src" >&2 print "${0}: submodule not found: ${src}" >&2
return 1 return 1
fi fi
mkdir -p "${dst:h}" mkdir -p "${dst:h}"
git-submodule-remove "$src" git-submodule-remove "${src}"
git submodule add "$url" "$dst" git submodule add "${url}" "${dst}"
return 0 return 0

View File

@ -6,13 +6,13 @@
# #
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
print "$0: not a repository work tree: $PWD" >&2 print "${0}: not a repository work tree: ${PWD}" >&2
return 1 return 1
elif [[ "$PWD" != "$(git-root)" ]]; then elif [[ "${PWD}" != "$(git-root)" ]]; then
print "$0: must be run from the root of the work tree" >&2 print "${0}: must be run from the root of the work tree" >&2
return 1 return 1
elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
print "$0: submodule not found: $1" >&2 print "${0}: submodule not found: ${1}" >&2
return 1 return 1
fi fi

View File

@ -1,9 +1,9 @@
# slightly modified git_current_branch from oh-my-zsh for theme compatibility # slightly modified git_current_branch from oh-my-zsh for theme compatibility
local ref local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$? local ret=${?}
if [[ $ret != 0 ]]; then if [[ ${ret} != 0 ]]; then
[[ $ret == 128 ]] && return # no git repo. [[ ${ret} == 128 ]] && return # no git repo.
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi fi
print ${ref#refs/heads/} print ${ref#refs/heads/}

View File

@ -4,5 +4,5 @@ local ref
if [[ ${zgit_hide_prompt} != 'true' ]]; then if [[ ${zgit_hide_prompt} != 'true' ]]; then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
print "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" print "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref#refs/heads/}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
fi fi

View File

@ -4,15 +4,13 @@
local STATUS='' local STATUS=''
local FLAGS=('--porcelain' '--ignore-submodules=dirty') local FLAGS=('--porcelain' '--ignore-submodules=dirty')
if [[ ${zgit_hide_prompt} != 'true' ]]; then if [[ ${zgit_hide_prompt} != 'true' ]]; then
if [[ "$zgit_disable_untracked_dirty" == "true" ]]; then if [[ "${zgit_disable_untracked_dirty}" == "true" ]]; then
FLAGS+='--untracked-files=no' FLAGS+='--untracked-files=no'
fi fi
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
fi fi
if [[ -n $STATUS ]]; then if [[ -n ${STATUS} ]]; then
print ${ZSH_THEME_GIT_PROMPT_DIRTY} print ${ZSH_THEME_GIT_PROMPT_DIRTY}
else else
print ${ZSH_THEME_GIT_PROMPT_CLEAN} print ${ZSH_THEME_GIT_PROMPT_CLEAN}
fi fi
#unset FLAGS STATUS

View File

@ -2,7 +2,7 @@
# git aliases and functions # git aliases and functions
# #
if (( ! $+commands[git] )); then if (( ! ${+commands[git]} )); then
return 1 return 1
fi fi

View File

@ -11,8 +11,8 @@ HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
# bind UP and DOWN keys # bind UP and DOWN keys
bindkey "$terminfo[kcuu1]" history-substring-search-up bindkey "${terminfo[kcuu1]}" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down bindkey "${terminfo[kcud1]}" history-substring-search-down
# bind UP and DOWN arrow keys (compatibility fallback) # bind UP and DOWN arrow keys (compatibility fallback)
bindkey '^[[A' history-substring-search-up bindkey '^[[A' history-substring-search-up

View File

@ -3,7 +3,7 @@ History
Sets sane default history options. Sets sane default history options.
History file is set to save in `${ZDOTDIR:-$HOME}/.zhistory` History file is set to save in `${ZDOTDIR:-${HOME}}/.zhistory`
(most likely ~/.zhistory) (most likely ~/.zhistory)

View File

@ -3,7 +3,7 @@
# #
# sets the location of the history file # sets the location of the history file
HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
# limit of history entries # limit of history entries
HISTSIZE=10000 HISTSIZE=10000
@ -16,7 +16,7 @@ setopt BANG_HIST
# : <beginning time>:<elapsed seconds>;<command>. # : <beginning time>:<elapsed seconds>;<command>.
setopt EXTENDED_HISTORY setopt EXTENDED_HISTORY
# This options works like APPEND_HISTORY except that new history lines are added to the $HISTFILE incrementally # This options works like APPEND_HISTORY except that new history lines are added to the ${HISTFILE} incrementally
# (as soon as they are entered), rather than waiting until the shell exits. # (as soon as they are entered), rather than waiting until the shell exits.
setopt INC_APPEND_HISTORY setopt INC_APPEND_HISTORY

View File

@ -4,7 +4,7 @@
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then if [[ ${TERM} == 'dumb' ]]; then
return 1 return 1
fi fi
@ -19,46 +19,46 @@ key_info=(
'Meta' '\M-' 'Meta' '\M-'
'Backspace' "^?" 'Backspace' "^?"
'Delete' "^[[3~" 'Delete' "^[[3~"
'F1' "$terminfo[kf1]" 'F1' "${terminfo[kf1]}"
'F2' "$terminfo[kf2]" 'F2' "${terminfo[kf2]}"
'F3' "$terminfo[kf3]" 'F3' "${terminfo[kf3]}"
'F4' "$terminfo[kf4]" 'F4' "${terminfo[kf4]}"
'F5' "$terminfo[kf5]" 'F5' "${terminfo[kf5]}"
'F6' "$terminfo[kf6]" 'F6' "${terminfo[kf6]}"
'F7' "$terminfo[kf7]" 'F7' "${terminfo[kf7]}"
'F8' "$terminfo[kf8]" 'F8' "${terminfo[kf8]}"
'F9' "$terminfo[kf9]" 'F9' "${terminfo[kf9]}"
'F10' "$terminfo[kf10]" 'F10' "${terminfo[kf10]}"
'F11' "$terminfo[kf11]" 'F11' "${terminfo[kf11]}"
'F12' "$terminfo[kf12]" 'F12' "${terminfo[kf12]}"
'Insert' "$terminfo[kich1]" 'Insert' "${terminfo[kich1]}"
'Home' "$terminfo[khome]" 'Home' "${terminfo[khome]}"
'PageUp' "$terminfo[kpp]" 'PageUp' "${terminfo[kpp]}"
'End' "$terminfo[kend]" 'End' "${terminfo[kend]}"
'PageDown' "$terminfo[knp]" 'PageDown' "${terminfo[knp]}"
'Up' "$terminfo[kcuu1]" 'Up' "${terminfo[kcuu1]}"
'Left' "$terminfo[kcub1]" 'Left' "${terminfo[kcub1]}"
'Down' "$terminfo[kcud1]" 'Down' "${terminfo[kcud1]}"
'Right' "$terminfo[kcuf1]" 'Right' "${terminfo[kcuf1]}"
'BackTab' "$terminfo[kcbt]" 'BackTab' "${terminfo[kcbt]}"
) )
# Bind the keys # Bind the keys
bindkey "$key_info[Home]" beginning-of-line bindkey "${key_info[Home]}" beginning-of-line
bindkey "$key_info[End]" end-of-line bindkey "${key_info[End]}" end-of-line
bindkey "$key_info[Insert]" overwrite-mode bindkey "${key_info[Insert]}" overwrite-mode
bindkey "$key_info[Delete]" delete-char bindkey "${key_info[Delete]}" delete-char
bindkey "$key_info[Backspace]" backward-delete-char bindkey "${key_info[Backspace]}" backward-delete-char
bindkey "$key_info[Left]" backward-char bindkey "${key_info[Left]}" backward-char
bindkey "$key_info[Right]" forward-char bindkey "${key_info[Right]}" forward-char
# Expandpace. # Expandpace.
bindkey ' ' magic-space bindkey ' ' magic-space
# Clear # Clear
bindkey "$key_info[Control]L" clear-screen bindkey "${key_info[Control]}L" clear-screen
# Bind Shift + Tab to go to the previous menu item. # Bind Shift + Tab to go to the previous menu item.
bindkey "$key_info[BackTab]" reverse-menu-complete bindkey "${key_info[BackTab]}" reverse-menu-complete

View File

@ -4,12 +4,12 @@
# download and build AUR package # download and build AUR package
aurb() { aurb() {
git clone https://aur.archlinux.org/$1.git && cd $1 && makepkg -sci git clone https://aur.archlinux.org/${1}.git && cd ${1} && makepkg -sci
} }
# only download aur package; do not build # only download aur package; do not build
aurd() { aurd() {
git clone https://aur.archlinux.org/$1.git git clone https://aur.archlinux.org/${1}.git
} }
# remove old package, rebuild, and install. # remove old package, rebuild, and install.

View File

@ -3,7 +3,7 @@
# #
# ensure pacman is available # ensure pacman is available
if (( ! $+commands[pacman] )); then if (( ! ${+commands[pacman]} )); then
return 1 return 1
fi fi
@ -11,16 +11,16 @@ fi
if [[ ${zpacman_frontend} == 'auto' ]]; then if [[ ${zpacman_frontend} == 'auto' ]]; then
# no frontend set in config; test for common frontends. # no frontend set in config; test for common frontends.
if (( $+commands[powerpill] )); then if (( ${+commands[powerpill]} )); then
zpacman_frontend='powerpill' zpacman_frontend='powerpill'
elif (( $+commands[pacmatic] )); then elif (( ${+commands[pacmatic]} )); then
zpacman_frontend='pacmatic' zpacman_frontend='pacmatic'
else else
zpacman_frontend='pacman' zpacman_frontend='pacman'
fi fi
elif (( ! $+zpacman_frontend )); then elif (( ! ${+zpacman_frontend} )); then
zpacman_frontend='pacman' zpacman_frontend='pacman'
elif (( ! $+commands[${zpacman_frontend}] )); then elif (( ! ${+commands[${zpacman_frontend}]} )); then
print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\"." >&2 print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\"." >&2
print "you can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2 print "you can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2
zpacman_frontend='pacman' zpacman_frontend='pacman'

View File

@ -3,7 +3,7 @@
# #
# Return if requirements are not found. # Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then if [[ ${TERM} == 'dumb' ]]; then
return 1 return 1
fi fi
@ -49,17 +49,17 @@ FX=(
font-ninth "\e[19m" no-font-ninth "\e[10m" font-ninth "\e[19m" no-font-ninth "\e[10m"
) )
FG[none]="$FX[none]" FG[none]="${FX[none]}"
BG[none]="$FX[none]" BG[none]="${FX[none]}"
colors=(black red green yellow blue magenta cyan white) colors=(black red green yellow blue magenta cyan white)
for color in {0..255}; do for color in {0..255}; do
if (( $color >= 0 )) && (( $color < $#colors )); then if (( ${color} >= 0 )) && (( ${color} < ${#colors} )); then
index=$(( $color + 1 )) index=$(( ${color} + 1 ))
FG[$colors[$index]]="\e[38;5;${color}m" FG[${colors[${index}]}]="\e[38;5;${color}m"
BG[$colors[$index]]="\e[48;5;${color}m" BG[${colors[${index}]}]="\e[48;5;${color}m"
fi fi
FG[$color]="\e[38;5;${color}m" FG[${color}]="\e[38;5;${color}m"
BG[$color]="\e[48;5;${color}m" BG[${color}]="\e[48;5;${color}m"
done done
unset color{s,} index unset color{s,} index

View File

@ -3,7 +3,7 @@
# #
# don't do anything unless we can actually use ssh-agent # don't do anything unless we can actually use ssh-agent
if (( ! $+commands[ssh-agent] )); then if (( ! ${+commands[ssh-agent]} )); then
return 1 return 1
fi fi

View File

@ -23,10 +23,10 @@ local zcompare() {
# These jobs are asynchronous, and will not impact the interactive shell # These jobs are asynchronous, and will not impact the interactive shell
{ {
# First, we will zcompile the completion cache, if it exists. Siginificant speedup. # First, we will zcompile the completion cache, if it exists. Siginificant speedup.
zcompare ${ZDOTDIR:-$HOME}/.zcompdump zcompare ${ZDOTDIR:-${HOME}}/.zcompdump
# Next, zcompile .zshrc if needed # Next, zcompile .zshrc if needed
zcompare ${ZDOTDIR:-$HOME}/.zshrc zcompare ${ZDOTDIR:-${HOME}}/.zshrc
# Then, we should zcomplie the 'heavy' modules where possible. # Then, we should zcomplie the 'heavy' modules where possible.
# This includes syntax-highlighting and completion. # This includes syntax-highlighting and completion.
@ -34,7 +34,7 @@ local zcompare() {
function { function {
# use of anonymous function for setopt extended_glob # use of anonymous function for setopt extended_glob
local zim=${ZDOTDIR:-$HOME}/.zim local zim=${ZDOTDIR:-${HOME}}/.zim
setopt EXTENDED_GLOB setopt EXTENDED_GLOB
# #

View File

@ -3,7 +3,7 @@
# #
# Source zim # Source zim
if [[ -s ${ZDOTDIR:-$HOME}/.zim/init.zsh ]]; then if [[ -s ${ZDOTDIR:-${HOME}}/.zim/init.zsh ]]; then
source ${ZDOTDIR:-$HOME}/.zim/init.zsh source ${ZDOTDIR:-${HOME}}/.zim/init.zsh
fi fi