Forráskód Böngészése

use consistent variable style

Matt Hamilton 8 éve
szülő
commit
a1a56ac63f

+ 4 - 4
README.md

@@ -42,14 +42,14 @@ uninstall those first to prevent conflicts.
 
 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):
   ```
   setopt EXTENDED_GLOB
-  for template_file ( ${ZDOTDIR:-$HOME}/.zim/templates/* ); do
-    cat ${template_file} | tee -a ${ZDOTDIR:-$HOME}/.$(basename ${template_file}) > /dev/null
+  for template_file ( ${ZDOTDIR:-${HOME}}/.zim/templates/* ); do
+    cat ${template_file} | tee -a ${ZDOTDIR:-${HOME}}/.$(basename ${template_file}) > /dev/null
   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):
   ```
-  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.

+ 9 - 9
init.zsh

@@ -3,21 +3,21 @@
 #
 
 # Define zim location
-ZIM="${ZDOTDIR:-$HOME}/.zim"
+ZIM="${ZDOTDIR:-${HOME}}/.zim"
 
 # Source user configuration
-if [[ -s "${ZDOTDIR:-$HOME}/.zimrc" ]]; then
-  source "${ZDOTDIR:-$HOME}/.zimrc"
+if [[ -s "${ZDOTDIR:-${HOME}}/.zimrc" ]]; then
+  source "${ZDOTDIR:-${HOME}}/.zimrc"
 fi
 
 load_zim_module() {
   local wanted_module
 
-  for wanted_module ($zmodules); do
-    if [[ -s "${ZIM}/modules/$wanted_module/init.zsh" ]]; then
-      source "${ZIM}/modules/$wanted_module/init.zsh"
-    elif [[ ! -d "${ZIM}/modules/$wanted_module" ]]; then
-      print "No such module \"$wanted_module\"." >&2
+  for wanted_module (${zmodules}); do
+    if [[ -s "${ZIM}/modules/${wanted_module}/init.zsh" ]]; then
+      source "${ZIM}/modules/${wanted_module}/init.zsh"
+    elif [[ ! -d "${ZIM}/modules/${wanted_module}" ]]; then
+      print "No such module \"${wanted_module}\"." >&2
     fi
   done
 }
@@ -32,7 +32,7 @@ load_zim_function() {
   function {
     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}
     done
   }

+ 5 - 5
modules/archive/functions/archive

@@ -4,9 +4,9 @@
 
 local archive_name dir_to_archive _gzip_bin _bzip2_bin
 
-if (( $# != 2 )); then
+if (( ${#} != 2 )); then
   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:
 .tar.gz, .tar.bz2, .tar.xz, .tar.lzma, .tar, .zip, .rar, .7z
 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 [[ ! -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
 fi
 
 # here, we check for dropin/multi-threaded replacements
-if (( $+commands[pigz] )); then
+if (( ${+commands[pigz]} )); then
   _gzip_bin='pigz'
 else
   _gzip_bin='gzip'
 fi
 
-if (( $+commands[pbzip2] )); then
+if (( ${+commands[pbzip2]} )); then
   _bzip2_bin='pbzip2'
 else
   _bzip2_bin='bzip2'

+ 2 - 2
modules/archive/functions/unarchive

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

+ 4 - 4
modules/archive/init.zsh

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

+ 3 - 3
modules/completion/init.zsh

@@ -16,14 +16,14 @@ fi
 fpath=(${0:h}/external/src ${fpath})
 
 # 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
 source ${0:h}/compdefs.zsh
 
 {
   # 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
     zcompile ${zcompdump}
@@ -86,7 +86,7 @@ zstyle ':completion:*' squeeze-slashes true
 
 # enable caching
 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
 zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec)|prompt_*)'

+ 1 - 1
modules/directory/init.zsh

@@ -19,7 +19,7 @@ setopt PUSHD_IGNORE_DUPS
 # Do not print the directory stack after pushd or popd.
 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
 
 #

+ 1 - 1
modules/git/functions/git-commit-lost

@@ -6,7 +6,7 @@
 #
 
 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
 fi
 

+ 3 - 3
modules/git/functions/git-dir

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

+ 2 - 2
modules/git/functions/git-ignore-add

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

+ 3 - 3
modules/git/functions/git-root

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

+ 3 - 3
modules/git/functions/git-stash-clear-interactive

@@ -6,7 +6,7 @@
 #
 
 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
 fi
 
@@ -14,8 +14,8 @@ local stashed
 
 if [[ -f "$(git-dir)/refs/stash" ]]; then
   stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
-  if (( $stashed > 0 )); then
-    if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
+  if (( ${stashed} > 0 )); then
+    if read -q "?Clear ${stashed} stashed state(s) [y/N]? "; then
       git stash clear
     fi
   fi

+ 1 - 1
modules/git/functions/git-stash-dropped

@@ -6,7 +6,7 @@
 #
 
 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
 fi
 

+ 3 - 3
modules/git/functions/git-stash-recover

@@ -6,13 +6,13 @@
 #
 
 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
 fi
 
 local commit
 
-for commit in "$@"; do
+for commit in "${@}"; do
   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

+ 9 - 9
modules/git/functions/git-submodule-move

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

+ 4 - 4
modules/git/functions/git-submodule-remove

@@ -6,13 +6,13 @@
 #
 
 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
-elif [[ "$PWD" != "$(git-root)" ]]; then
-  print "$0: must be run from the root of the work tree" >&2
+elif [[ "${PWD}" != "$(git-root)" ]]; then
+  print "${0}: must be run from the root of the work tree" >&2
   return 1
 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
 fi
 

+ 3 - 3
modules/git/functions/git_current_branch

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

+ 1 - 1
modules/git/functions/git_prompt_info

@@ -4,5 +4,5 @@ local ref
 if [[ ${zgit_hide_prompt} != 'true' ]]; then
  ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
  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

+ 2 - 4
modules/git/functions/parse_git_dirty

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

+ 1 - 1
modules/git/init.zsh

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

+ 2 - 2
modules/history-substring-search/init.zsh

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

+ 1 - 1
modules/history/README.md

@@ -3,7 +3,7 @@ History
 
 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)
 

+ 2 - 2
modules/history/init.zsh

@@ -3,7 +3,7 @@
 #
 
 # sets the location of the history file
-HISTFILE="${ZDOTDIR:-$HOME}/.zhistory"
+HISTFILE="${ZDOTDIR:-${HOME}}/.zhistory"
 
 # limit of history entries
 HISTSIZE=10000
@@ -16,7 +16,7 @@ setopt BANG_HIST
 # ‘: <beginning time>:<elapsed seconds>;<command>’.
 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.
 setopt INC_APPEND_HISTORY
 

+ 32 - 32
modules/input/init.zsh

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

+ 2 - 2
modules/pacman/helper_aur.zsh

@@ -4,12 +4,12 @@
 
 # download and build AUR package
 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
 aurd() {
-  git clone https://aur.archlinux.org/$1.git 
+  git clone https://aur.archlinux.org/${1}.git 
 }
 
 # remove old package, rebuild, and install.

+ 5 - 5
modules/pacman/init.zsh

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

+ 9 - 9
modules/spectrum/init.zsh

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

+ 1 - 1
modules/ssh/init.zsh

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

+ 3 - 3
templates/zlogin

@@ -23,10 +23,10 @@ local zcompare() {
 # These jobs are asynchronous, and will not impact the interactive shell
 {
   # 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
-  zcompare ${ZDOTDIR:-$HOME}/.zshrc
+  zcompare ${ZDOTDIR:-${HOME}}/.zshrc
 
   # Then, we should zcomplie the 'heavy' modules where possible.
   # This includes syntax-highlighting and completion. 
@@ -34,7 +34,7 @@ local zcompare() {
   function {
     # use of anonymous function for setopt extended_glob
 
-    local zim=${ZDOTDIR:-$HOME}/.zim
+    local zim=${ZDOTDIR:-${HOME}}/.zim
     setopt EXTENDED_GLOB
 
     #

+ 2 - 2
templates/zshrc

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