From e3743957469d508ff59c69df27b0dfcc1d1605a4 Mon Sep 17 00:00:00 2001 From: romkatv Date: Sun, 19 Jan 2020 15:24:12 +0100 Subject: [PATCH] follow ~/.zshrc and ~/.p10k.zsh symlinks When the user tells the configuration wizard to apply changes to ~/.zshrc and ~/.p10k.zsh and these files are symlinks, apply changes to the targets. see #426 --- internal/configure.zsh | 7 ++++--- internal/wizard.zsh | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/configure.zsh b/internal/configure.zsh index 1cd16dd1..a627ca6a 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -3,9 +3,10 @@ typeset -gr __p9k_wizard_lines=21 typeset -gr __p9k_zd=${ZDOTDIR:-$HOME} typeset -gr __p9k_zd_u=${${${(q)__p9k_zd}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%} typeset -gr __p9k_cfg_basename=.p10k.zsh -typeset -gr __p9k_cfg_path=$__p9k_zd/$__p9k_cfg_basename +typeset -gr __p9k_cfg_path_o=$__p9k_zd/$__p9k_cfg_basename +typeset -gr __p9k_cfg_path=${__p9k_cfg_path_o:A} typeset -gr __p9k_cfg_path_u=$__p9k_zd_u/$__p9k_cfg_basename -typeset -gr __p9k_zshrc=$__p9k_zd/.zshrc +typeset -gr __p9k_zshrc=${${:-$__p9k_zd/.zshrc}:A} typeset -gr __p9k_zshrc_u=$__p9k_zd_u/.zshrc typeset -gr __p9k_root_dir_u=${${${(q)__p9k_root_dir}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%} @@ -61,7 +62,7 @@ function _p9k_can_configure() { function p9k_configure() { emulate -L zsh - setopt no_hist_expand extended_glob + setopt no_hist_expand extended_glob no_prompt_bang prompt_{percent,subst} no_aliases ( set -- -f source $__p9k_root_dir/internal/wizard.zsh diff --git a/internal/wizard.zsh b/internal/wizard.zsh index 7e0ee37c..00966da7 100755 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -1410,12 +1410,12 @@ function ask_zshrc_edit() { if [[ -e $__p9k_zshrc ]]; then zshrc_content="$(<$__p9k_zshrc)" || quit -c local lines=(${(f)zshrc_content}) - local f0=$__p9k_cfg_path + local f0=$__p9k_cfg_path_o local f1=${(q)f0} local f2=${(q-)f0} local f3=${(qq)f0} local f4=${(qqq)f0} - local g1=${${(q)__p9k_cfg_path}/#(#b)${(q)HOME}\//'~/'} + local g1=${${(q)__p9k_cfg_path_o}/#(#b)${(q)HOME}\//'~/'} if [[ -n ${(@M)lines:#(#b)[^#]#([^[:IDENT:]]|)source[[:space:]]##($f1|$f2|$f3|$f4|$g1)(|[[:space:]]*|'#'*)} ]]; then zshrc_has_cfg=1 fi