mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-25 18:03:03 +01:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eebae3a3f | ||
|
|
ca5b808de8 | ||
|
|
c8aea70a11 | ||
|
|
799f9a8a8a | ||
|
|
7140fedbfa | ||
|
|
b5cb2fe952 | ||
|
|
49766a713a | ||
|
|
570bd64a56 | ||
|
|
ad203cc9c4 | ||
|
|
89ec2b437b | ||
|
|
3943d2f880 | ||
|
|
a449ed2c4e |
No files matched your search
@@ -35,7 +35,8 @@ plugins=(... aws)
|
|||||||
|
|
||||||
* `aws_change_access_key`: changes the AWS access key of a profile.
|
* `aws_change_access_key`: changes the AWS access key of a profile.
|
||||||
|
|
||||||
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
|
* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`) and
|
||||||
|
`$AWS_SHARED_CREDENTIALS_FILE` (default: `~/.aws/credentials`).
|
||||||
Used to provide completion for the `asp` function.
|
Used to provide completion for the `asp` function.
|
||||||
|
|
||||||
* `aws_regions`: lists the available regions.
|
* `aws_regions`: lists the available regions.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function asp() {
|
|||||||
export AWS_PROFILE=$1
|
export AWS_PROFILE=$1
|
||||||
export AWS_EB_PROFILE=$1
|
export AWS_EB_PROFILE=$1
|
||||||
|
|
||||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
export AWS_PROFILE_REGION=$(_aws_profile_region "$1")
|
||||||
|
|
||||||
_aws_update_state
|
_aws_update_state
|
||||||
|
|
||||||
@@ -239,9 +239,47 @@ function aws_regions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function aws_profiles() {
|
function aws_profiles() {
|
||||||
aws --no-cli-pager configure list-profiles 2> /dev/null && return
|
emulate -L zsh
|
||||||
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
|
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
||||||
command grep -Eo '^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?[^][:space:]]+[[:space:]]*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | command sed -E 's/^[[:space:]]*\[[[:space:]]*(profile[[:space:]]+)?([^][:space:]]+)[[:space:]]*\]$/\2/'
|
local creds="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
|
||||||
|
# Read the files directly; the AWS CLI is slow to start
|
||||||
|
if [[ ! -r "$config" && ! -r "$creds" ]]; then
|
||||||
|
aws --no-cli-pager configure list-profiles 2> /dev/null
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
local line words
|
||||||
|
# Only read the section headers, so the credentials never enter the shell
|
||||||
|
for line in "${(@f)$(command grep -h '^[[:space:]]*\[' -- "$config" "$creds" 2> /dev/null)}"; do
|
||||||
|
line=${line#*\[} # drop up to the first [
|
||||||
|
line=${line%\]*} # drop from the last ] (comments, CR)
|
||||||
|
words=(${=line})
|
||||||
|
if (( $#words == 1 )); then
|
||||||
|
print -r -- $words[1] # [default], or [foo] in the credentials file
|
||||||
|
elif (( $#words == 2 )) && [[ $words[1] == profile ]]; then
|
||||||
|
print -r -- $words[2]
|
||||||
|
fi
|
||||||
|
done | command sort -u
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read a profile's region from the config file, falling back to the AWS CLI
|
||||||
|
function _aws_profile_region() {
|
||||||
|
emulate -L zsh
|
||||||
|
local config="${AWS_CONFIG_FILE:-$HOME/.aws/config}" line words in_profile
|
||||||
|
if [[ -r "$config" ]]; then
|
||||||
|
# Only read headers and region lines, so any credentials never enter the shell
|
||||||
|
for line in "${(@f)$(command grep -e '\[' -e region -- "$config" 2> /dev/null)}"; do
|
||||||
|
line=${line%$'\r'}
|
||||||
|
words=(${=line//[\[\]=]/ }) # "[profile foo]" -> (profile foo), "region = x" -> (region x)
|
||||||
|
if [[ ${${=line}[1]} == \[* ]]; then # header, possibly indented
|
||||||
|
in_profile=
|
||||||
|
[[ "$words" == "profile $1" || ( $1 == default && "$words" == default ) ]] && in_profile=1
|
||||||
|
elif [[ -n $in_profile && $words[1] == region ]]; then
|
||||||
|
print -r -- $words[2]
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
aws configure get region
|
||||||
}
|
}
|
||||||
|
|
||||||
function _aws_regions() {
|
function _aws_regions() {
|
||||||
@@ -285,7 +323,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
|||||||
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||||
|
|
||||||
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
|
test -z "${aws_state[2]}" && AWS_REGION=$(_aws_profile_region "$AWS_PROFILE")
|
||||||
|
|
||||||
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
||||||
export AWS_DEFAULT_REGION="$AWS_REGION"
|
export AWS_DEFAULT_REGION="$AWS_REGION"
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ colorize_less() {
|
|||||||
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
|
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
|
||||||
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
||||||
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
||||||
|
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
|
||||||
colorize_cat %s 2> /dev/null'"
|
colorize_cat %s 2> /dev/null'"
|
||||||
|
|
||||||
# LESSCLOSE will be set to prevent any errors by executing a user script
|
# LESSCLOSE will be set to prevent any errors by executing a user script
|
||||||
|
|||||||
@@ -112,6 +112,37 @@ plugins=(... hcloud)
|
|||||||
| hcst | `hcloud server-type list` | List all server types |
|
| hcst | `hcloud server-type list` | List all server types |
|
||||||
| hcit | `hcloud image list --type system` | List all system images |
|
| hcit | `hcloud image list --type system` | List all system images |
|
||||||
|
|
||||||
|
## Prompt function
|
||||||
|
|
||||||
|
This plugin provides `hcloud_prompt_info` which can be added to your prompt to display the current Hetzner Cloud context.
|
||||||
|
|
||||||
|
- If `HCLOUD_TOKEN` environment variable is set, it displays `HCLOUD_TOKEN` (indicating direct token usage)
|
||||||
|
- Otherwise, it displays the active context name
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Add `$(hcloud_prompt_info)` to your `PROMPT` or `RPROMPT` in your `.zshrc`:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
RPROMPT='$(hcloud_prompt_info)'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Theme variables
|
||||||
|
|
||||||
|
| Variable | Default | Description |
|
||||||
|
| :----------------------------- | :-------------- | :----------------------------------------------- |
|
||||||
|
| `ZSH_THEME_HCLOUD_PREFIX` | `<hcloud:` | Prefix before the context name |
|
||||||
|
| `ZSH_THEME_HCLOUD_SUFFIX` | `>` | Suffix after the context name |
|
||||||
|
| `ZSH_THEME_HCLOUD_TOKEN_TEXT` | `HCLOUD_TOKEN` | Text shown when `HCLOUD_TOKEN` env var is set |
|
||||||
|
|
||||||
|
### Example with custom styling
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
ZSH_THEME_HCLOUD_PREFIX="%{$fg[blue]%}hcloud:("
|
||||||
|
ZSH_THEME_HCLOUD_SUFFIX=")%{$reset_color%}"
|
||||||
|
RPROMPT='$(hcloud_prompt_info)'
|
||||||
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed.
|
This plugin requires the [Hetzner Cloud CLI](https://github.com/hetznercloud/cli) to be installed.
|
||||||
|
|||||||
@@ -131,3 +131,20 @@ alias hcdc='hcloud datacenter list'
|
|||||||
alias hcloc='hcloud location list'
|
alias hcloc='hcloud location list'
|
||||||
alias hcst='hcloud server-type list'
|
alias hcst='hcloud server-type list'
|
||||||
alias hcit='hcloud image list --type system'
|
alias hcit='hcloud image list --type system'
|
||||||
|
|
||||||
|
# Prompt function to display current hcloud context
|
||||||
|
# Usage: add $(hcloud_prompt_info) to your PROMPT or RPROMPT
|
||||||
|
function hcloud_prompt_info() {
|
||||||
|
# Check if HCLOUD_TOKEN is set (overrides context)
|
||||||
|
if [[ -n "$HCLOUD_TOKEN" ]]; then
|
||||||
|
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${ZSH_THEME_HCLOUD_TOKEN_TEXT=HCLOUD_TOKEN}${ZSH_THEME_HCLOUD_SUFFIX=>}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get active context
|
||||||
|
local context
|
||||||
|
context=$(hcloud context active 2>/dev/null)
|
||||||
|
[[ -n "$context" ]] || return
|
||||||
|
|
||||||
|
echo "${ZSH_THEME_HCLOUD_PREFIX=<hcloud:}${context}${ZSH_THEME_HCLOUD_SUFFIX=>}"
|
||||||
|
}
|
||||||
@@ -80,3 +80,17 @@ zstyle ':omz:plugins:laravel' php 'herd php'
|
|||||||
| `paqr` | `php artisan queue:retry` |
|
| `paqr` | `php artisan queue:retry` |
|
||||||
| `paqt` | `php artisan queue:table` |
|
| `paqt` | `php artisan queue:table` |
|
||||||
| `paqw` | `php artisan queue:work` |
|
| `paqw` | `php artisan queue:work` |
|
||||||
|
|
||||||
|
## Modules
|
||||||
|
|
||||||
|
Aliases for [nWidart/laravel-modules](https://github.com/nWidart/laravel-modules).
|
||||||
|
|
||||||
|
| Alias | Description |
|
||||||
|
|:-:|:-:|
|
||||||
|
| `pamol` | `php artisan module:list` |
|
||||||
|
| `pamomk` | `php artisan module:make` |
|
||||||
|
| `pamoe` | `php artisan module:enable` |
|
||||||
|
| `pamod` | `php artisan module:disable` |
|
||||||
|
| `pamom` | `php artisan module:migrate` |
|
||||||
|
| `pamomr` | `php artisan module:migrate-rollback` |
|
||||||
|
| `pamos` | `php artisan module:seed` |
|
||||||
@@ -53,4 +53,13 @@ alias paqr="$_omz_laravel_php artisan queue:retry"
|
|||||||
alias paqt="$_omz_laravel_php artisan queue:table"
|
alias paqt="$_omz_laravel_php artisan queue:table"
|
||||||
alias paqw="$_omz_laravel_php artisan queue:work"
|
alias paqw="$_omz_laravel_php artisan queue:work"
|
||||||
|
|
||||||
|
# Modules (nWidart/laravel-modules)
|
||||||
|
alias pamol="$_omz_laravel_php artisan module:list"
|
||||||
|
alias pamomk="$_omz_laravel_php artisan module:make"
|
||||||
|
alias pamoe="$_omz_laravel_php artisan module:enable"
|
||||||
|
alias pamod="$_omz_laravel_php artisan module:disable"
|
||||||
|
alias pamom="$_omz_laravel_php artisan module:migrate"
|
||||||
|
alias pamomr="$_omz_laravel_php artisan module:migrate-rollback"
|
||||||
|
alias pamos="$_omz_laravel_php artisan module:seed"
|
||||||
|
|
||||||
unset _omz_laravel_php
|
unset _omz_laravel_php
|
||||||
@@ -30,6 +30,7 @@ man-command-line() {
|
|||||||
else
|
else
|
||||||
BUFFER="man ${args[1]}"
|
BUFFER="man ${args[1]}"
|
||||||
fi
|
fi
|
||||||
|
zle end-of-line
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -N man-command-line
|
zle -N man-command-line
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ if it's found, or the mvn command otherwise.
|
|||||||
| `mvncisto` | `mvn clean install -DskipTests --offline` |
|
| `mvncisto` | `mvn clean install -DskipTests --offline` |
|
||||||
| `mvncom` | `mvn compile` |
|
| `mvncom` | `mvn compile` |
|
||||||
| `mvncp` | `mvn clean package` |
|
| `mvncp` | `mvn clean package` |
|
||||||
|
| `mvncpst` | `mvn clean package -DskipTests` |
|
||||||
|
| `mvncpsto` | `mvn clean package -DskipTests --offline` |
|
||||||
| `mvnct` | `mvn clean test` |
|
| `mvnct` | `mvn clean test` |
|
||||||
| `mvncv` | `mvn clean verify` |
|
| `mvncv` | `mvn clean verify` |
|
||||||
| `mvncvst` | `mvn clean verify -DskipTests` |
|
| `mvncvst` | `mvn clean verify -DskipTests` |
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ alias mvncist='mvn clean install -DskipTests'
|
|||||||
alias mvncisto='mvn clean install -DskipTests --offline'
|
alias mvncisto='mvn clean install -DskipTests --offline'
|
||||||
alias mvncom='mvn compile'
|
alias mvncom='mvn compile'
|
||||||
alias mvncp='mvn clean package'
|
alias mvncp='mvn clean package'
|
||||||
|
alias mvncpst='mvn clean package -DskipTests'
|
||||||
|
alias mvncpsto='mvn clean package -DskipTests --offline'
|
||||||
alias mvnct='mvn clean test'
|
alias mvnct='mvn clean test'
|
||||||
alias mvncv='mvn clean verify'
|
alias mvncv='mvn clean verify'
|
||||||
alias mvncvst='mvn clean verify -DskipTests'
|
alias mvncvst='mvn clean verify -DskipTests'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Pre-commit plugin
|
# Pre-commit plugin
|
||||||
|
|
||||||
This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/).
|
This plugin adds aliases for common commands of [pre-commit](https://pre-commit.com/).
|
||||||
It also supports [prek](https://github.com/prek/prek) as a drop-in replacement.
|
It also supports [prek](https://github.com/j178/prek) as a drop-in replacement.
|
||||||
If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback.
|
If `prek` is available, it will be used; otherwise, `pre-commit` is used as fallback.
|
||||||
|
|
||||||
To use this plugin, add it to the plugins array in your zshrc file:
|
To use this plugin, add it to the plugins array in your zshrc file:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ tldr-command-line() {
|
|||||||
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
|
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
|
||||||
|
|
||||||
BUFFER="tldr ${args[1]}"
|
BUFFER="tldr ${args[1]}"
|
||||||
|
zle end-of-line
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -N tldr-command-line
|
zle -N tldr-command-line
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ plugins=(... uv)
|
|||||||
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
|
| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
|
||||||
| uvp | `uv pip` | Manage pip packages |
|
| uvp | `uv pip` | Manage pip packages |
|
||||||
| uvpi | `uv python install` | Install a specific version of python |
|
| uvpi | `uv python install` | Install a specific version of python |
|
||||||
| uvpl | `uv python list` | Lists all python version installed |
|
| uvpl | `uv python list` | List all installed Python versions. |
|
||||||
| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
|
| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
|
||||||
| uvpu | `uv python uninstall` | Remove a specific version of python |
|
| uvpu | `uv python uninstall` | Remove a specific version of python |
|
||||||
| uvpy | `uv python` | Manage Python installs |
|
| uvpy | `uv python` | Manage Python installs |
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# zsh-patina plugin
|
||||||
|
|
||||||
|
Initializes [zsh-patina](https://github.com/michel-kraemer/zsh-patina), a
|
||||||
|
"blazingly fast Zsh plugin performing syntax highlighting of your command line
|
||||||
|
while you type 🌈"
|
||||||
|
|
||||||
|
The plugin also caches completions for the `zsh-patina` command in
|
||||||
|
`$ZSH_CACHE_DIR/completions/_zsh-patina`, refreshed each time the plugin loads.
|
||||||
|
|
||||||
|
To use it, add `zsh-patina` to the plugins array in your `.zshrc` file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... zsh-patina)
|
||||||
|
```
|
||||||
|
|
||||||
|
zsh-patina replaces [zsh-syntax-highlighting](../zsh-syntax-highlighting), so
|
||||||
|
enable only one of them. If zsh-syntax-highlighting is in the plugins array or
|
||||||
|
already loaded, this plugin prints a warning and does not activate.
|
||||||
|
|
||||||
|
## Binary location
|
||||||
|
|
||||||
|
If `zsh-patina` is not in your `PATH` when Oh My Zsh loads (eg: it lives in
|
||||||
|
`~/.cargo/bin`), set `ZSH_PATINA_BINARY` to its full path before sourcing
|
||||||
|
Oh My Zsh:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
ZSH_PATINA_BINARY=$HOME/.cargo/bin/zsh-patina
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** you have to [install zsh-patina](https://github.com/michel-kraemer/zsh-patina#how-to-install) first.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
if (( $+ZSH_HIGHLIGHT_VERSION )) || (( ${plugins[(Ie)zsh-syntax-highlighting]} )); then
|
||||||
|
echo '[oh-my-zsh] zsh-patina conflicts with zsh-syntax-highlighting, please enable only one of them'
|
||||||
|
elif [[ -x ${ZSH_PATINA_BINARY:-$commands[zsh-patina]} ]]; then
|
||||||
|
eval "$(${ZSH_PATINA_BINARY:-$commands[zsh-patina]} activate)"
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `zsh-patina`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_zsh-patina" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _zsh-patina
|
||||||
|
_comps[zsh-patina]=_zsh-patina
|
||||||
|
fi
|
||||||
|
|
||||||
|
zmodload -F zsh/files b:zf_mv
|
||||||
|
() {
|
||||||
|
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zsh-patina"
|
||||||
|
zf_mv -f -- =( "$1" completion ) "$ZSH_CACHE_DIR/completions/_zsh-patina"
|
||||||
|
} "${ZSH_PATINA_BINARY:-$commands[zsh-patina]}" &|
|
||||||
|
else
|
||||||
|
echo '[oh-my-zsh] zsh-patina not found, please install it from https://github.com/michel-kraemer/zsh-patina'
|
||||||
|
fi
|
||||||
Executable → Regular
File mode changed.
Reference in new issue
Block a user