Skip to content

Commit 608a391

Browse files
author
jedahan
committed
externalize a few more functions
1 parent 550aec7 commit 608a391

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

functions/geometry_last_command

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(($+GEOMETRY_LAST_COMMAND)) && builtin echo $GEOMETRY_LAST_COMMAND

functions/geometry_path

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# geometry_path - show the current path
22

3+
(($+GEOMETRY_PATH_TRUNCATE)) || GEOMETRY_PATH_TRUNCATE=3
4+
35
# symbol representing the home directory
46
dir=${GEOMETRY_PATH_SYMBOL_HOME:-"%$GEOMETRY_PATH_TRUNCATE~"}
57
( ${GEOMETRY_PATH_SHOW_BASENAME:-false} ) && dir=${PWD:t}

geometry.zsh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ builtin typeset -gA GEOMETRY; GEOMETRY[ROOT]=${0:A:h}
1010
(($+GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_git geometry_hg geometry_jj geometry_echo)
1111
(($+GEOMETRY_INFO)) || GEOMETRY_INFO=()
1212
(($+GEOMETRY_TITLE)) || GEOMETRY_TITLE=(geometry_path)
13-
(($+GEOMETRY_CMDTITLE)) || GEOMETRY_CMDTITLE=(geometry_cmd geometry_hostname)
14-
(($+GEOMETRY_PATH_TRUNCATE)) || GEOMETRY_PATH_TRUNCATE=3
13+
(($+GEOMETRY_COMMAND_TITLE)) || GEOMETRY_COMMAND_TITLE=(geometry_last_command geometry_hostname)
1514

1615
builtin autoload -U add-zsh-hook
1716

1817
fpath+=("${GEOMETRY[ROOT]}"/functions)
1918
autoload -Uz \
19+
geometry_last_command \
2020
geometry_docker_machine \
2121
geometry_echo \
2222
geometry_exitcode \
@@ -36,7 +36,6 @@ autoload -Uz \
3636
geometry_status \
3737
geometry_virtualenv
3838

39-
(( $+functions[geometry_cmd])) || geometry_cmd() { builtin echo $GEOMETRY_LAST_CMD; }
4039
(( $+functions[ansi] )) || ansi() { (($# - 2)) || builtin echo -n "%F{$1}$2%f"; }
4140
(( $+functions[deansi] )) || deansi() { (($# - 1)) || builtin echo -n "$(echo "$1" | sed s/$(builtin echo "\033")\\\[\[0-9\]\\\{1,2\\\}m//g)"; }
4241

@@ -86,8 +85,8 @@ geometry::hostcolor() {
8685
# set cmd title (while command is running)
8786
geometry::set_cmdtitle() {
8887
# Make command title available for optional consumption by geometry_cmd
89-
GEOMETRY_LAST_CMD=$2
90-
local ansiCmdTitle=$(builtin print -P $(geometry::wrap $PWD $GEOMETRY_CMDTITLE))
88+
GEOMETRY_LAST_COMMAND=$2
89+
local ansiCmdTitle=$(builtin print -P $(geometry::wrap $PWD $GEOMETRY_COMMAND_TITLE))
9190
local cmdTitle=$(deansi "$ansiCmdTitle")
9291

9392
builtin echo -ne "\e]1;$cmdTitle\a"

0 commit comments

Comments
 (0)