Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Dec 5, 2023
2 parents a97292b + 8f405b1 commit 4a92cee
Show file tree
Hide file tree
Showing 13 changed files with 609 additions and 435 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.zwc
.vscode
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
# [v3.0.0](/compare/v2.0.1...v3.0.0) (2023-12-05)


### Features

* **deps:** update git-prompt-kit to v4.0.0
* **working directory:** use GIT_PROMPT_KIT_CWD [ca46db2](https://github.com/olets/hometown-prompt/commit/ca46db2)
* **HOMETOWN_PROMPT_VERSION:** add [bac5c8f](https://github.com/olets/hometown-prompt/commit/bac5c8f)
* **layout options:** two new config options (prev in git-prompt-kit) [fd80d33](https://github.com/olets/hometown-prompt/commit/fd80d33)
- `HOMETOWN_PROMPT_LINEBREAK_AFTER_GIT_REF` and `HOMETOWN_PROMPT_NO_LINEBREAK_BEFORE_GIT_REF`
* **HOMETOWN_PROMPT_VERSION:** add [bac5c8f](https://github.com/olets/hometown-prompt/bac5c8f817ac1658c282785e8d55990aae618075)
* **time:** move into HOMETOWN_PROMPT_CUSTOM [b031664](https://github.com/olets/hometown-prompt/commit/b031664c49ff38909c93eda2cd96954a22baa7f5)
* **names:** drop '_prompt' from file, function, and var names [a164132](https://github.com/olets/hometown-prompt/a1641326d73b6f3012061182fe9cb002bb5e69cf)
* **theme file:** extension is zsh-theme [e9f8b6a](olets/hometown-prompt/e9f8b6afcd2b06c6016b4438cc42d2b375d8ea16)


# [v2.0.1](/compare/v2.0.0...v2.0.1) (2022-11-27)


### Bug Fixes

* **binaries:** delete and ignore cc08f8b
* **binaries:** delete and ignore [cc08f8b](https://github.com/olets/hometown-prompt/commit/cc08f8b)


### Features

* **extended status:** new HOMETOWN_PROMPT_SHOW_EXTENDED_STATUS option f5de6f7
* **extended status:** new HOMETOWN_PROMPT_SHOW_EXTENDED_STATUS option [f5de6f7](https://github.com/olets/hometown-prompt/commit/f5de6f7)
* **git-prompt-kit:** update submodule v3.0.1
* **git:** no space before status if no extended status db3b9c3
* **git:** no space before status if no extended status [db3b9c3](https://github.com/olets/hometown-prompt/commit/db3b9c3)



Expand Down
618 changes: 388 additions & 230 deletions LICENSE

Large diffs are not rendered by default.

203 changes: 89 additions & 114 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion git-prompt-kit
1 change: 0 additions & 1 deletion hometown-prompt.plugin.zsh

This file was deleted.

86 changes: 0 additions & 86 deletions hometown-prompt.zsh

This file was deleted.

1 change: 1 addition & 0 deletions hometown.plugin.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source ${0:A:h}/hometown.zsh-theme
110 changes: 110 additions & 0 deletions hometown.zsh-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env zsh

# Hometown
# v3.0.0
# Dec 5 2023
# https://github.com/olets/hometown-prompt
# Copyright (©) 2021-present Henry Bley-Vroman

typeset -r HOMETOWN_PROMPT_VERSION="3.0.0"

typeset -g HOMETOWN_CUSTOM=${HOMETOWN_CUSTOM-%*}
typeset -gi HOMETOWN_LINEBREAK_AFTER_GIT_REF=${HOMETOWN_LINEBREAK_AFTER_GIT_REF:-1}
typeset -gi HOMETOWN_NO_LINEBREAK_BEFORE_GIT_REF=${HOMETOWN_NO_LINEBREAK_BEFORE_GIT_REF:-1}
typeset -gi HOMETOWN_SHOW_EXTENDED_STATUS=${HOMETOWN_SHOW_EXTENDED_STATUS:-1}

_hometown_git_prompt() {
emulate -L zsh

local git_prompt=

if (( HOMETOWN_NO_LINEBREAK_BEFORE_GIT_REF )); then
git_prompt+='${GIT_PROMPT_KIT_REF:+ }'
else
git_prompt+='${GIT_PROMPT_KIT_REF:+\n}'
fi

git_prompt+='${GIT_PROMPT_KIT_REF:+$GIT_PROMPT_KIT_REF}'

if (( HOMETOWN_LINEBREAK_AFTER_GIT_REF )); then
if (( HOMETOWN_SHOW_EXTENDED_STATUS )); then
# Add a line break after the Git ref if there's any of Git extended status, Git status, or Git action
git_prompt+='${${GIT_PROMPT_KIT_STATUS_EXTENDED:-${GIT_PROMPT_KIT_STATUS:-${GIT_PROMPT_KIT_ACTION}}}:+\n}'
else
# Add a line break after the Git ref if there's either Git status or Git action
git_prompt+='${${GIT_PROMPT_KIT_STATUS:-${GIT_PROMPT_KIT_ACTION}}:+\n}'
fi
else
if (( HOMETOWN_SHOW_EXTENDED_STATUS )); then
# Add a space after the Git ref if there's any of Git extended status, Git status, or Git action
git_prompt+='${${GIT_PROMPT_KIT_STATUS_EXTENDED:-${GIT_PROMPT_KIT_STATUS:-${GIT_PROMPT_KIT_ACTION}}}:+ }'
else
# Add a space after the Git ref if there's either Git status or Git action
git_prompt+='${${GIT_PROMPT_KIT_STATUS:-${GIT_PROMPT_KIT_ACTION}}:+ }'
fi
fi

if (( HOMETOWN_SHOW_EXTENDED_STATUS )); then
git_prompt+='${GIT_PROMPT_KIT_STATUS_EXTENDED}'

# Add a space after the extended Git prompt if there's an extended Git status and either a Git status or a Git action
git_prompt+='${GIT_PROMPT_KIT_STATUS_EXTENDED:+${${GIT_PROMPT_KIT_STATUS:-$GIT_PROMPT_KIT_ACTION}:+ }}'
fi

git_prompt+='${GIT_PROMPT_KIT_STATUS}'

# Add a space after the Git status if there's a Git action
git_prompt+='${GIT_PROMPT_KIT_STATUS:+${GIT_PROMPT_KIT_ACTION:+ }}'

git_prompt+='${GIT_PROMPT_KIT_ACTION}'

'builtin' 'echo' $git_prompt
}

_hometown_build_prompt() {
emulate -L zsh

local prompt=

# Blank line after result of previous command
prompt+=$'\n'

# User and host
prompt+='${GIT_PROMPT_KIT_USERHOST:+$GIT_PROMPT_KIT_USERHOST }'

# Custom (24h format HH:MM:SS time by default)
prompt+='${HOMETOWN_CUSTOM:+$HOMETOWN_CUSTOM }'

# Working directory
prompt+='${GIT_PROMPT_KIT_CWD}'

# Git
prompt+=$(_hometown_git_prompt)

# Prompt character
prompt+=$'\n'
prompt+='${GIT_PROMPT_KIT_CHAR:+$GIT_PROMPT_KIT_CHAR }'

'builtin' 'echo' $prompt
}

_hometown_init() {
emulate -L zsh

local dir

if ! (( $# )); then
'builtin' 'printf' Hometown could not be initialized
fi

dir=$1

GIT_PROMPT_KIT_GITSTATUS_FUNCTIONS_SUFFIX=__hometown
GIT_PROMPT_KIT_GITSTATUSD_INSTANCE_NAME=HOMETOWN

'builtin' 'source' $dir/git-prompt-kit/git-prompt-kit.zsh

PROMPT=$(_hometown_build_prompt)
}

_hometown_init ${0:A:h}
Binary file added img/hometown-prompt-custom.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/hometown-prompt-default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/hometown-prompt-long.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/hometown-prompt-short.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4a92cee

Please sign in to comment.