From a1a56ac63f8fcd66d066fb05711d751a7ff6be8a Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Sat, 19 Dec 2015 09:48:29 -0500 Subject: [PATCH] use consistent variable style --- README.md | 8 +-- init.zsh | 18 +++--- modules/archive/functions/archive | 10 +-- modules/archive/functions/unarchive | 4 +- modules/archive/init.zsh | 8 +-- modules/completion/init.zsh | 6 +- modules/directory/init.zsh | 2 +- modules/git/functions/git-commit-lost | 2 +- modules/git/functions/git-dir | 6 +- modules/git/functions/git-ignore-add | 4 +- modules/git/functions/git-root | 6 +- .../git/functions/git-stash-clear-interactive | 6 +- modules/git/functions/git-stash-dropped | 2 +- modules/git/functions/git-stash-recover | 6 +- modules/git/functions/git-submodule-move | 18 +++--- modules/git/functions/git-submodule-remove | 8 +-- modules/git/functions/git_current_branch | 6 +- modules/git/functions/git_prompt_info | 2 +- modules/git/functions/parse_git_dirty | 6 +- modules/git/init.zsh | 2 +- modules/history-substring-search/init.zsh | 4 +- modules/history/README.md | 2 +- modules/history/init.zsh | 4 +- modules/input/init.zsh | 64 +++++++++---------- modules/pacman/helper_aur.zsh | 4 +- modules/pacman/init.zsh | 10 +-- modules/spectrum/init.zsh | 18 +++--- modules/ssh/init.zsh | 2 +- templates/zlogin | 6 +- templates/zshrc | 4 +- 30 files changed, 123 insertions(+), 125 deletions(-) diff --git a/README.md b/README.md index f8fa715..d5e8cf8 100644 --- a/README.md +++ b/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. diff --git a/init.zsh b/init.zsh index 7cc137b..23308a2 100755 --- a/init.zsh +++ b/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 } diff --git a/modules/archive/functions/archive b/modules/archive/functions/archive index 1b8a781..e1406d0 100644 --- a/modules/archive/functions/archive +++ b/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 <&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' diff --git a/modules/archive/functions/unarchive b/modules/archive/functions/unarchive index 762f10c..1771b24 100644 --- a/modules/archive/functions/unarchive +++ b/modules/archive/functions/unarchive @@ -4,9 +4,9 @@ local archive_name _gunzip_bin _bunzip2_bin -if (( $# != 1 )); then +if (( ${#} != 1 )); then cat >&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 diff --git a/modules/git/functions/git-dir b/modules/git/functions/git-dir index 7e16ca8..429ae25 100644 --- a/modules/git/functions/git-dir +++ b/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 diff --git a/modules/git/functions/git-ignore-add b/modules/git/functions/git-ignore-add index 0e93f0d..bd16c01 100644 --- a/modules/git/functions/git-ignore-add +++ b/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 diff --git a/modules/git/functions/git-root b/modules/git/functions/git-root index 712e4fe..a68f9f6 100644 --- a/modules/git/functions/git-root +++ b/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 diff --git a/modules/git/functions/git-stash-clear-interactive b/modules/git/functions/git-stash-clear-interactive index e45165c..a2ad7dc 100644 --- a/modules/git/functions/git-stash-clear-interactive +++ b/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 diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index 5158070..2fabed9 100644 --- a/modules/git/functions/git-stash-dropped +++ b/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 diff --git a/modules/git/functions/git-stash-recover b/modules/git/functions/git-stash-recover index 6add26f..1f1916d 100644 --- a/modules/git/functions/git-stash-recover +++ b/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 diff --git a/modules/git/functions/git-submodule-move b/modules/git/functions/git-submodule-move index 34c5e44..d2d5ae4 100644 --- a/modules/git/functions/git-submodule-move +++ b/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 diff --git a/modules/git/functions/git-submodule-remove b/modules/git/functions/git-submodule-remove index 852b9cd..51c214b 100644 --- a/modules/git/functions/git-submodule-remove +++ b/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 diff --git a/modules/git/functions/git_current_branch b/modules/git/functions/git_current_branch index b035ea0..7325a61 100644 --- a/modules/git/functions/git_current_branch +++ b/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/} diff --git a/modules/git/functions/git_prompt_info b/modules/git/functions/git_prompt_info index 2eb7413..269d0db 100644 --- a/modules/git/functions/git_prompt_info +++ b/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 diff --git a/modules/git/functions/parse_git_dirty b/modules/git/functions/parse_git_dirty index 9de07f4..6a0f0ea 100644 --- a/modules/git/functions/parse_git_dirty +++ b/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 diff --git a/modules/git/init.zsh b/modules/git/init.zsh index e6eb0d4..c6fe632 100644 --- a/modules/git/init.zsh +++ b/modules/git/init.zsh @@ -2,7 +2,7 @@ # git aliases and functions # -if (( ! $+commands[git] )); then +if (( ! ${+commands[git]} )); then return 1 fi diff --git a/modules/history-substring-search/init.zsh b/modules/history-substring-search/init.zsh index a0a7ded..b2a2b71 100644 --- a/modules/history-substring-search/init.zsh +++ b/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 diff --git a/modules/history/README.md b/modules/history/README.md index 46e5312..46f5f77 100644 --- a/modules/history/README.md +++ b/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) diff --git a/modules/history/init.zsh b/modules/history/init.zsh index 3893df9..d0d7928 100644 --- a/modules/history/init.zsh +++ b/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 # ‘: :;’. 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 diff --git a/modules/input/init.zsh b/modules/input/init.zsh index dadff3c..ba83d04 100644 --- a/modules/input/init.zsh +++ b/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 diff --git a/modules/pacman/helper_aur.zsh b/modules/pacman/helper_aur.zsh index 1a3c193..d051e83 100644 --- a/modules/pacman/helper_aur.zsh +++ b/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. diff --git a/modules/pacman/init.zsh b/modules/pacman/init.zsh index 8957d26..241c6f8 100644 --- a/modules/pacman/init.zsh +++ b/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' diff --git a/modules/spectrum/init.zsh b/modules/spectrum/init.zsh index 45b9e23..fc12ecb 100644 --- a/modules/spectrum/init.zsh +++ b/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 diff --git a/modules/ssh/init.zsh b/modules/ssh/init.zsh index f6a861e..c4ca68a 100644 --- a/modules/ssh/init.zsh +++ b/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 diff --git a/templates/zlogin b/templates/zlogin index c6977fc..33f63ec 100644 --- a/templates/zlogin +++ b/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 # diff --git a/templates/zshrc b/templates/zshrc index 80a24c1..da2e240 100644 --- a/templates/zshrc +++ b/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