Skip to content

Commit 66ec0c0

Browse files
author
jedahan
committed
Add geometry_jj for jujutsu
1 parent ed7eaf1 commit 66ec0c0

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

functions/geometry_jj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# geometry_jj - display current jujutsu status
2+
3+
geometry_jj () {
4+
(( $+commands[jj] )) || return 1
5+
jj log --quiet --no-pager --no-graph --ignore-working-copy --revisions @ --color never --template \
6+
${GEOMETRY_JJ_TEMPLATE:-'"%F{5}" ++ change_id.shortest() ++ "%F{4}" ++ commit_id.shortest() ++ "%f% "'} \
7+
2> /dev/null
8+
}

geometry.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
typeset -gA GEOMETRY; GEOMETRY[ROOT]=${0:A:h}
88

99
(($+GEOMETRY_PROMPT)) || GEOMETRY_PROMPT=(geometry_echo geometry_status geometry_path)
10-
(($+GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_exec_time geometry_git geometry_hg geometry_echo)
10+
(($+GEOMETRY_RPROMPT)) || GEOMETRY_RPROMPT=(geometry_exec_time geometry_git geometry_hg geometry_jj geometry_echo)
1111
(($+GEOMETRY_INFO)) || GEOMETRY_INFO=()
1212
(($+GEOMETRY_TITLE)) || GEOMETRY_TITLE=(geometry_path)
1313
(($+GEOMETRY_CMDTITLE)) || GEOMETRY_CMDTITLE=(geometry_cmd geometry_hostname)

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ GEOMETRY_GIT_TIME_DETAILED=true # show full time (e.g. `12h 30m 53s`) instea
120120

121121
![picture of git features](./images/screenshots/git.png)
122122

123+
### geometry_jj
124+
You can customize the template using [jj template language](https://jj-vcs.github.io/jj/latest/templates/)
125+
126+
```shell
127+
GEOMETRY_JJ_TEMPLATE='"%F{5}" ++ change_id.shortest() ++ "%F{4}" ++ commit_id.shortest() ++ "%f% "'
128+
```
129+
123130
## Hostname based colors
124131
Geometry provides a generic function (`geometry::hostcolor`) for setting any color based on hostname. The color is calculated as the sum of each character converted to an integer. For example the hostname 'abc' generates a value of 294.
125132

0 commit comments

Comments
 (0)