Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: function lazy loading. #273

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion geometry.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ GEOMETRY[ROOT]=${0:A:h}
(($+GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_exec_time geometry_git geometry_hg geometry_echo)
(($+GEOMETRY_INFO)) || GEOMETRY_INFO=(geometry_hostname geometry_jobs)

load=($GEOMETRY_PROMPT)
load+=(${GEOMETRY_RPROMPT:|load})
load+=(${GEOMETRY_INFO:|load})

autoload -U add-zsh-hook

function { local fun; for fun ("${GEOMETRY[ROOT]}"/functions/geometry_*.zsh(N.)) . $fun }
function { local fun; for fun in $load; . "${GEOMETRY_ROOT}/functions/${fun}.zsh" }

(( $+functions[ansi] )) || ansi() { (($# - 2)) || echo -n "%F{$1}$2%f"; }

Expand Down