Compare commits

..
Author SHA1 Message Date
adf9eeea22 feat(git): add grpa alias for git reset --patch
The counterpart to `gapa` (`git add --patch`): unstage hunks interactively.
Originally proposed in #11295.

Co-authored-by: Carl Nimhed <carl.nimhed@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:35:46 -08:00
8 changed files with 4 additions and 56 deletions

No files matched your search

-11
View File
@@ -2,8 +2,6 @@
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
autoload -Uz is-at-least
typeset -AHg FX FG BG
FX=(
@@ -20,16 +18,7 @@ FX=(
() {
setopt localoptions noksharrays
local -a codes fg bg
local code
codes=({000..255})
# ${a:^b} array zipping needs zsh 5.0.6
if ! is-at-least 5.0.6; then
for code in $codes; do
FG[$code]="%{"$'\e'"[38;5;${code}m%}"
BG[$code]="%{"$'\e'"[48;5;${code}m%}"
done
return
fi
fg=( "%{"$'\e'"[38;5;"${^codes}"m%}" )
bg=( "%{"$'\e'"[48;5;"${^codes}"m%}" )
FG=( ${codes:^fg} )
-2
View File
@@ -58,8 +58,6 @@ Running the shortest `gs` shell alias that it found:
![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b)
It also looks through aliases you type, suggesting only ones that cover more of the command. With the kubectl plugin, `k get pods` suggests `kgp`, while `kgp` on its own suggests nothing.
### Options
+2 -13
View File
@@ -65,20 +65,9 @@ alias-finder() {
preexec_alias-finder() {
# TODO: Remove backward compatibility (other than zstyle form)
zstyle -t ':omz:plugins:alias-finder' autoload || [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]] || return
# $3 has aliases expanded, so `k get pods` can suggest `kgp`
local -a words=(${(z)1}) found=(${(f)"$(alias-finder $3)"}) keep
local used=${aliases[$words[1]]} line
# If an alias was typed, only suggest aliases that cover more of the command
if [[ -n "$used" ]]; then
for line in $found; do
(( ${#${(Q)line#*=}} > ${#used} )) && keep+=("$line")
done
found=($keep)
zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
alias-finder $1
fi
(( $#found )) && print -rl -- $found
}
autoload -U add-zsh-hook
+1
View File
@@ -177,6 +177,7 @@ plugins=(... git)
| `grhh` | `git reset --hard` |
| `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` |
| `grpa` | `git reset --patch` |
| `gpristine` | `git reset --hard && git clean --force -dfx` |
| `gwipe` | `git reset --hard && git clean --force -df` |
| `groh` | `git reset origin/$(git_current_branch) --hard` |
+1
View File
@@ -378,6 +378,7 @@ alias gru='git reset --'
alias grhh='git reset --hard'
alias grhk='git reset --keep'
alias grhs='git reset --soft'
alias grpa='git reset --patch'
alias gpristine='git reset --hard && git clean --force -dfx'
alias gwipe='git reset --hard && git clean --force -df'
alias groh='git reset origin/$(git_current_branch) --hard'
-8
View File
@@ -12,14 +12,6 @@ plugins=(... terraform)
## Requirements
- [Terraform](https://terraform.io/)
- [terraform-docs](https://terraform-docs.io/) (optional, for completion)
## terraform-docs completion
If `terraform-docs` is installed, this plugin also enables its completion.
The completion script is generated from the installed version and cached in
`$ZSH_CACHE_DIR/completions/_terraform-docs`. It is refreshed in the background
each time the plugin loads, so completion stays in sync with the installed CLI.
## Aliases
-20
View File
@@ -39,23 +39,3 @@ alias tfsh='terraform show'
alias tfw='terraform workspace'
alias tfwl='terraform workspace list'
alias tfws='terraform workspace select'
if (( $+commands[terraform-docs] )); then
# If the completion file doesn't exist yet, compinit hasn't registered it.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_terraform-docs" ]]; then
typeset -g -A _comps
autoload -Uz _terraform-docs
_comps[terraform-docs]=_terraform-docs
fi
zmodload -F zsh/files b:zf_mv
() {
local completions
completions=$(command terraform-docs completion zsh) || return
[[ -n "$completions" ]] || return
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._terraform-docs"
zf_mv -f -- =(print -r -- "$completions") \
"$ZSH_CACHE_DIR/completions/_terraform-docs"
} &|
fi
-2
View File
@@ -4,9 +4,7 @@
To use it, add thefuck to the plugins array of your zshrc file:
```zsh
plugins=(... thefuck)
```
## Usage
Press `ESC` twice to correct previous console command.