diff options
author | Mike Beattie <mike@ethernal.org> | 2018-05-27 19:57:30 +1200 |
---|---|---|
committer | Mike Beattie <mike@ethernal.org> | 2018-05-27 19:57:30 +1200 |
commit | 72c99d53541e63563c17154a4b982755c72e8eb1 (patch) | |
tree | d63e91268b6a36f4a905c777a6c3e2cffe799f7e | |
parent | 18ad1f0ef3b09e66a58918cc68ceac0afa85ebe5 (diff) |
ZSH: make more variables local to zshrc
Signed-off-by: Mike Beattie <mike@ethernal.org>
-rw-r--r-- | .zshrc | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1,7 +1,7 @@ ########################################################## # Prompt -setprompt () { +function () { setopt prompt_subst @@ -18,6 +18,7 @@ setprompt () { local nocolor="%{$terminfo[sgr0]%}" # Base prompt. + local pr_baseprompt pr_baseprompt="%(!.${red}%U%n%u.${green}%n)" # Username.. red underlining if uid 0 (root) pr_baseprompt+="${magenta}@${green}%m" # "@<host>" pr_baseprompt+="${yellow}:${green}%30<...<%~%<<%" # truncated path @@ -25,8 +26,8 @@ setprompt () { pr_baseprompt+="${yellow}>${nocolor} " # Finally, add a yellow "> " # Info for title bar/screen title - pr_titleinfo='%(!.[ROOT] | .)%l) %n@%m:%30<...<%~%<<' - pr_windowtitle='' + local pr_titleinfo='%(!.[ROOT] | .)%l) %n@%m:%30<...<%~%<<' + local pr_windowtitle='' pr_wt_in='' pr_wt_out='' case ${TERM} in @@ -62,7 +63,6 @@ setprompt () { } -setprompt ########################################################## # Misc @@ -108,9 +108,11 @@ LOGCHECK=120 # check every 2 min for login/logout activity autoload -U compinit compinit if [ -e ~/.ssh/known_hosts ]; then - # Use .ssh/known_hosts for hostnames. - hosts=(${${(f)"$(<~/.ssh/known_hosts)"//,/ }%%\ *}) - zstyle ':completion:*:hosts' hosts $hosts + # Use .ssh/known_hosts for hostnames. + function () { + local hosts=(${${(f)"$(<~/.ssh/known_hosts)"//,/ }%%\ *}) + zstyle ':completion:*:hosts' hosts $hosts + } fi ########################################################## |