5 Commits

Author SHA1 Message Date
David Chin
680298e920 feat(spackenv): Adding Spackenv plugin (#13191)
* Add spackenv plugin to handle Spack environment

* Use ":t" instead of 'basename'
2025-09-01 12:02:29 -07:00
Benjamin Bock
61b144d809 feat(magic-enter plugin): Add support for jj to magic-enter plugin (#13241) 2025-09-01 11:47:54 -07:00
ymlair
9d00a004b2 feat(tt): add plugin tt (#8273) 2025-09-01 11:37:37 -07:00
Vanildo Souto Mangueira
28ac0e95da fix(juanghurtado): Changed text color to red when 'root' (#7104) 2025-09-01 11:31:29 -07:00
Kevin S Kirkup
10b750af26 feat(kompost): Add plugin for kompose (#7729)
Co-authored-by: Kevin S Kirkup <kevin.kirkup@pureport.com>
2025-09-01 11:28:12 -07:00
8 changed files with 92 additions and 2 deletions

12
plugins/kompose/README.md Normal file
View File

@@ -0,0 +1,12 @@
# kompose
This plugin provides completion for [kompose](https://github.com/kubernetes/kompose),
to migrate from docker compose to Kubernetes resource definitions.
To use it, add `kompose` to the plugins array in your zshrc file.
```
plugins=(... kompose)
```
**Author:** [@kevinkirkup](https://github.com/kevinkirkup)

View File

@@ -0,0 +1,3 @@
if [ $commands[kompose] ]; then
source <(kompose completion zsh)
fi

View File

@@ -1,5 +1,6 @@
# Default commands
: ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository
: ${MAGIC_ENTER_JJ_COMMAND:="jj st --no-pager ."} # run when in a jj repository
: ${MAGIC_ENTER_OTHER_COMMAND:="ls -lh ."} # run anywhere else
magic-enter() {
@@ -9,7 +10,9 @@ magic-enter() {
return
fi
if command git rev-parse --is-inside-work-tree &>/dev/null; then
if command jj st &>/dev/null; then # needs to be before git to handle colocated repositories
BUFFER="$MAGIC_ENTER_JJ_COMMAND"
elif command git rev-parse --is-inside-work-tree &>/dev/null; then
BUFFER="$MAGIC_ENTER_GIT_COMMAND"
else
BUFFER="$MAGIC_ENTER_OTHER_COMMAND"

View File

@@ -0,0 +1,17 @@
# spackenv
Based on the virtualenv plugin.
The plugin displays information of the created Spack environment and allows background theming.
To use it, add `spackenv` to the plugins array of your zshrc file:
```
plugins=(... spackenv)
```
The plugin creates a `spackenv_prompt_info` function that you can use in your theme, which displays
the basename of the current `$SPACK_ENV`. It uses two variables to control how that is shown:
- `ZSH_THEME_SPACKENV_PREFIX`: sets the prefix of the SPACK_ENV. Defaults to `[`.
- `ZSH_THEME_SPACKENV_SUFFIX`: sets the suffix of the SPACK_ENV. Defaults to `]`.

View File

@@ -0,0 +1,5 @@
function spackenv_prompt_info(){
[[ -n ${SPACK_ENV} ]] || return
export SPACK_ENV_PROMPT=${SPACK_ENV:t}
echo "${ZSH_THEME_SPACKENV_PREFIX=(}${SPACK_ENV:t:gs/%/%%}${ZSH_THEME_SPACKENV_SUFFIX=)}"
}

26
plugins/tt/README.MD Normal file
View File

@@ -0,0 +1,26 @@
# TT
This plugin provides mutual conversion of timestamp and date.
To use it add tt to the plugins array in your zshrc file.
```bash
plugins=(... tt)
```
# Example
print timestamp for "2019-10-16"
```bash
tt 2019-10-16
```
print timestamp for "2019-10-16 18:41:00"
```bash
tt "2019-10-16 18:41:00"
```
print date for "1571222561"
```bash
tt 1571222561
```
echo 2019-10-16 18:42:41

21
plugins/tt/tt.plugin.zsh Normal file
View File

@@ -0,0 +1,21 @@
#
# Functions
#
# timestamp to date Or date to timestamp
#
tt () {
if [[ $1 =~ "-" ]]
then
if [[ $1 =~ " " ]]
then
date -j -f "%Y-%m-%d %H:%M:%S" "$1" +%s 2> /dev/null
else
date -j -f "%Y-%m-%d %H:%M:%S" "$1 00:00:00" +%s 2> /dev/null
fi
elif [[ $1 = "" ]]
then
date +%s
else
date -r $1 "+%Y-%m-%d %H:%M:%S"
fi
}

View File

@@ -34,8 +34,11 @@ ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)"
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
USER_COLOR=$GREEN_BOLD
[[ $UID -eq 0 ]] && USER_COLOR=$RED_BOLD
# Prompt format
PROMPT='
%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
%{$USER_COLOR%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}
%{$BLUE%}>%{$RESET_COLOR%} '
RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'