mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-31 11:49:50 +00:00
Compare commits
5 Commits
2525dae661
...
680298e920
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
680298e920 | ||
|
|
61b144d809 | ||
|
|
9d00a004b2 | ||
|
|
28ac0e95da | ||
|
|
10b750af26 |
12
plugins/kompose/README.md
Normal file
12
plugins/kompose/README.md
Normal 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)
|
||||
3
plugins/kompose/kompose.plugin.zsh
Normal file
3
plugins/kompose/kompose.plugin.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ $commands[kompose] ]; then
|
||||
source <(kompose completion zsh)
|
||||
fi
|
||||
@@ -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"
|
||||
|
||||
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=)}"
|
||||
}
|
||||
26
plugins/tt/README.MD
Normal file
26
plugins/tt/README.MD
Normal 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
21
plugins/tt/tt.plugin.zsh
Normal 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
|
||||
}
|
||||
@@ -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%}'
|
||||
|
||||
Reference in New Issue
Block a user