diff options
Diffstat (limited to 'internal/configure.zsh')
-rw-r--r-- | internal/configure.zsh | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/internal/configure.zsh b/internal/configure.zsh index 9c92c233..4fb7cb6e 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -1,5 +1,7 @@ -typeset -gr __p9k_wizard_columns=51 -typeset -gr __p9k_wizard_lines=12 +# Fewer than 47 columns will probably work. Haven't tried it. +typeset -gr __p9k_wizard_columns=47 +# The bottleneck is ask_tails with nerd fonts. Everything else works fine with 12 lines. +typeset -gr __p9k_wizard_lines=14 typeset -gr __p9k_zd=${ZDOTDIR:-$HOME} typeset -gr __p9k_zd_u=${${${(q)__p9k_zd}/#(#b)${(q)HOME}(|\/*)/'~'$match[1]}//\%/%%} typeset -gr __p9k_zshrc=${${:-$__p9k_zd/.zshrc}:A} @@ -19,10 +21,20 @@ function _p9k_can_configure() { [[ -o multibyte ]] || { $0_error "multibyte option is not set"; return 1 } [[ -e $__p9k_zd ]] || { $0_error "$__p9k_zd_u does not exist"; return 1 } [[ -d $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not a directory"; return 1 } - [[ -w $__p9k_zd ]] || { $0_error "$__p9k_zd_u is not writable"; return 1 } [[ ! -d $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a directory"; return 1 } [[ ! -d $__p9k_zshrc ]] || { $0_error "$__p9k_zshrc_u is a directory"; return 1 } + local dir=${__p9k_cfg_path:h} + while [[ ! -e $dir && $dir != ${dir:h} ]]; do dir=${dir:h}; done + if [[ ! -d $dir ]]; then + $0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is not a directory" + return 1 + fi + if [[ ! -w $dir ]]; then + $0_error "cannot create $__p9k_cfg_path_u because ${dir//\%/%%} is readonly" + return 1 + fi + [[ ! -e $__p9k_cfg_path || -f $__p9k_cfg_path || -h $__p9k_cfg_path ]] || { $0_error "$__p9k_cfg_path_u is a special file" return 1 @@ -44,7 +56,7 @@ function _p9k_can_configure() { done (( LINES >= __p9k_wizard_lines && COLUMNS >= __p9k_wizard_columns )) || { - $0_error "terminal size too small; must be at least $__p9k_wizard_columns x $__p9k_wizard_lines" + $0_error "terminal size too small; must be at least $__p9k_wizard_columns columns by $__p9k_wizard_lines lines" return 1 } [[ -t 0 && -t 1 ]] || { $0_error "no TTY"; return 2 } |