mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
feat(spackenv): Adding Spackenv plugin (#13191)
* Add spackenv plugin to handle Spack environment * Use ":t" instead of 'basename'
This commit is contained in:
parent
61b144d809
commit
680298e920
2 changed files with 22 additions and 0 deletions
17
plugins/spackenv/README.md
Normal file
17
plugins/spackenv/README.md
Normal 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 `]`.
|
||||
5
plugins/spackenv/spackenv.plugin.zsh
Normal file
5
plugins/spackenv/spackenv.plugin.zsh
Normal 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=)}"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue