mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-19 02:02:32 +01:00
Merge branch 'ohmyzsh:master' into adamsir/git-checkout-interactive
This commit is contained in:
commit
1b4703387d
266 changed files with 8748 additions and 2962 deletions
9
plugins/alias-finder/.zunit.yml
Normal file
9
plugins/alias-finder/.zunit.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
tap: false
|
||||
directories:
|
||||
tests: tests
|
||||
output: tests/_output
|
||||
support: tests/_support
|
||||
time_limit: 0
|
||||
fail_fast: false
|
||||
allow_risky: false
|
||||
verbose: true
|
||||
|
|
@ -2,45 +2,32 @@
|
|||
|
||||
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||
|
||||
## Usage
|
||||
|
||||
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||
```
|
||||
plugins=(... alias-finder)
|
||||
```
|
||||
|
||||
## Usage
|
||||
To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
|
||||
To enable it for every single command, set zstyle in your `~/.zshrc`.
|
||||
|
||||
## Options
|
||||
```zsh
|
||||
# ~/.zshrc
|
||||
|
||||
zstyle ':omz:plugins:alias-finder' autoload yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' longer yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' exact yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' cheaper yes # disabled by default
|
||||
```
|
||||
|
||||
As you can see, options are also available with zstyle.
|
||||
|
||||
### Options
|
||||
|
||||
> In order to clarify, let's say `alias a=abc` has source 'abc' and destination 'a'.
|
||||
|
||||
- Use `--longer` or `-l` to include aliases where the source is longer than the input (in other words, the source could contain the whole input).
|
||||
- Use `--exact` or `-e` to avoid aliases where the source is shorter than the input (in other words, the source must be the same with the input).
|
||||
- Use `--cheaper` or `-c` to avoid aliases where the destination is longer than the input (in other words, the destination must be the shorter than the input).
|
||||
|
||||
- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
|
||||
- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
|
||||
|
||||
## Examples
|
||||
```
|
||||
$ alias-finder "git pull"
|
||||
gl='git pull'
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ alias-finder "web_search google oh my zsh"
|
||||
google='web_search google'
|
||||
```
|
||||
```
|
||||
$ alias-finder "git commit -v"
|
||||
gc="git commit -v"
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ alias-finder -e "git commit -v"
|
||||
gc='git commit -v'
|
||||
```
|
||||
```
|
||||
$ alias-finder -l "git commit -v"
|
||||
gc='git commit -v'
|
||||
'gc!'='git commit -v --amend'
|
||||
gca='git commit -v -a'
|
||||
'gca!'='git commit -v -a --amend'
|
||||
'gcan!'='git commit -v -a --no-edit --amend'
|
||||
'gcans!'='git commit -v -a -s --no-edit --amend'
|
||||
'gcn!'='git commit -v --no-edit --amend'
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,44 +1,59 @@
|
|||
alias-finder() {
|
||||
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
||||
for i in $@; do
|
||||
case $i in
|
||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'{0,1}$" finder="" filter=""
|
||||
|
||||
# build command and options
|
||||
for c in "$@"; do
|
||||
case $c in
|
||||
# TODO: Remove backward compatibility (other than zstyle form)
|
||||
# set options if exist
|
||||
-e|--exact) exact=true;;
|
||||
-l|--longer) longer=true;;
|
||||
*)
|
||||
if [[ -z $cmd ]]; then
|
||||
cmd=$i
|
||||
else
|
||||
cmd="$cmd $i"
|
||||
fi
|
||||
;;
|
||||
-c|--cheaper) cheaper=true;;
|
||||
# concatenate cmd
|
||||
*) cmd="$cmd$c " ;;
|
||||
esac
|
||||
done
|
||||
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
||||
if (( $(wc -l <<< $cmd) == 1 )); then
|
||||
while [[ $cmd != "" ]]; do
|
||||
if [[ $longer = true ]]; then
|
||||
wordStart="'{0,1}"
|
||||
else
|
||||
wordEnd="$"
|
||||
multiWordEnd="'$"
|
||||
fi
|
||||
if [[ $cmd == *" "* ]]; then
|
||||
local finder="'$cmd$multiWordEnd"
|
||||
else
|
||||
local finder=$wordStart$cmd$wordEnd
|
||||
fi
|
||||
alias | grep -E "=$finder"
|
||||
if [[ $exact = true || $longer = true ]]; then
|
||||
break
|
||||
else
|
||||
cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
|
||||
fi
|
||||
done
|
||||
|
||||
zstyle -t ':omz:plugins:alias-finder' longer && longer=true
|
||||
zstyle -t ':omz:plugins:alias-finder' exact && exact=true
|
||||
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
|
||||
|
||||
# format cmd for grep
|
||||
## - replace newlines with spaces
|
||||
## - trim both ends
|
||||
## - replace multiple spaces with one space
|
||||
## - add escaping character to special characters
|
||||
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
|
||||
|
||||
if [[ $longer == true ]]; then
|
||||
wordEnd="" # remove wordEnd to find longer aliases
|
||||
fi
|
||||
|
||||
# find with alias and grep, removing last word each time until no more words
|
||||
while [[ $cmd != "" ]]; do
|
||||
finder="'{0,1}$cmd$wordEnd"
|
||||
|
||||
# make filter to find only shorter results than current cmd
|
||||
if [[ $cheaper == true ]]; then
|
||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
||||
fi
|
||||
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
|
||||
if [[ $exact == true ]]; then
|
||||
break # because exact case is only one
|
||||
elif [[ $longer = true ]]; then
|
||||
break # because above grep command already found every longer aliases during first cycle
|
||||
fi
|
||||
|
||||
cmd=$(sed -E 's/ {0,}[^ ]*$//' <<< "$cmd") # remove last word
|
||||
done
|
||||
}
|
||||
|
||||
preexec_alias-finder() {
|
||||
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
# TODO: Remove backward compatibility (other than zstyle form)
|
||||
zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
alias-finder $1
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Write your bootstrap code here
|
||||
107
plugins/alias-finder/tests/test_run.sh
Normal file
107
plugins/alias-finder/tests/test_run.sh
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env zunit
|
||||
|
||||
@setup {
|
||||
load ../alias-finder.plugin.zsh
|
||||
|
||||
set_git_aliases() {
|
||||
unalias -a # all
|
||||
alias g="git"
|
||||
alias gc="git commit"
|
||||
alias gcv="git commit -v"
|
||||
alias gcvs="git commit -v -S"
|
||||
}
|
||||
}
|
||||
|
||||
@test 'find aliases that contain input' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder "git"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases that contain input with whitespaces at ends' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder " git "
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases that contain multiple words' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 3
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with input when --exact option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -e "git"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with multiple words input when --exact option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -e "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with or longer than input when --longer option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -l "git"
|
||||
|
||||
assert "${#lines[@]}" equals 4
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[4]}" same_as "gcvs='git commit -v -S'"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with or longer than multiple words input when --longer option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -l "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 2
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gcvs='git commit -v -S'"
|
||||
}
|
||||
|
||||
@test 'find aliases including expensive (longer) than input' {
|
||||
set_git_aliases
|
||||
alias expensiveCommands="git commit"
|
||||
|
||||
run alias-finder "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 4
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "expensiveCommands='git commit'"
|
||||
assert "${lines[3]}" same_as "gc='git commit'"
|
||||
assert "${lines[4]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases excluding expensive (longer) than input when --cheap option is set' {
|
||||
set_git_aliases
|
||||
alias expensiveCommands="git commit"
|
||||
|
||||
run alias-finder -c "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 3
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "g=git"
|
||||
}
|
||||
|
|
@ -15,14 +15,14 @@ Requirements: Python needs to be installed.
|
|||
|
||||
## Usage
|
||||
|
||||
- `acs`: show all aliases by group
|
||||
- `als`: show all aliases by group
|
||||
|
||||
- `acs -h/--help`: print help mesage
|
||||
- `als -h/--help`: print help message
|
||||
|
||||
- `acs <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||
- `als <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||
|
||||
- `acs -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
||||
- `als -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
||||
|
||||
- `acs --groups`: show only group names
|
||||
- `als --groups`: show only group names
|
||||
|
||||

|
||||

|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
eval '
|
||||
function acs(){
|
||||
function als(){
|
||||
(( $+commands[python3] )) || {
|
||||
echo "[error] No python executable detected"
|
||||
return
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False):
|
|||
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="acs")
|
||||
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="als")
|
||||
parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords")
|
||||
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
|
||||
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ plugins=(... ansible)
|
|||
| `acon` | command `ansible-console` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `aplaybook` | command `ansible-playbook` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `adoc` | command `ansible-doc` |
|
||||
| `agal` | command `ansible-galaxy` |
|
||||
| `apull` | command `ansible-pull` |
|
||||
|
|
@ -29,6 +28,6 @@ plugins=(... ansible)
|
|||
|
||||
## Maintainer
|
||||
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
|
||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ fi
|
|||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||
function upgrade() {
|
||||
echo ":: Checking Arch Linux PGP Keyring..."
|
||||
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
if [ $installedver != $currentver ]; then
|
||||
echo " Arch Linux PGP Keyring is out of date."
|
||||
echo " Updating before full system upgrade."
|
||||
|
|
|
|||
|
|
@ -2,26 +2,29 @@
|
|||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||
fi
|
||||
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
||||
brew_prefix="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${brew_prefix}/libexec"
|
||||
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
|
||||
unset brew_prefix
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||
# If not found, check for Homebrew package
|
||||
elif (( $+commands[brew] )); then
|
||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
unset _ASDF_PREFIX
|
||||
else
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
fpath+=("$ASDF_COMPLETIONS")
|
||||
autoload -Uz _asdf
|
||||
compdef _asdf asdf # compdef is already loaded before loading plugins
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,18 +1,21 @@
|
|||
declare -a autojump_paths
|
||||
autojump_paths=(
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
|
||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||
/nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
|
||||
)
|
||||
|
||||
for file in $autojump_paths; do
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ plugins=(... aws)
|
|||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
|
||||
Run `asp` without arguments to clear the profile.
|
||||
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
|
||||
* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
|
||||
* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
|
||||
|
||||
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
|
||||
Run `asr` without arguments to clear the profile.
|
||||
|
|
@ -45,6 +47,11 @@ plugins=(... aws)
|
|||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||
see the AWS profile/region prompt.
|
||||
|
||||
* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
|
||||
This option might slow down your shell startup time.
|
||||
By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
|
||||
You can control the state file path using the `AWS_STATE_FILE` environment variable.
|
||||
|
||||
## Theme
|
||||
|
||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||
|
|
|
|||
|
|
@ -6,10 +6,26 @@ function agr() {
|
|||
echo $AWS_REGION
|
||||
}
|
||||
|
||||
# Update state file if enabled
|
||||
function _aws_update_state() {
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _aws_clear_state() {
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||
echo -n > "${AWS_STATE_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
# AWS profile selection
|
||||
function asp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
||||
_aws_clear_state
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
|
@ -28,8 +44,16 @@ function asp() {
|
|||
|
||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
||||
|
||||
_aws_update_state
|
||||
|
||||
if [[ "$2" == "login" ]]; then
|
||||
aws sso login
|
||||
if [[ -n "$3" ]]; then
|
||||
aws sso login --sso-session $3
|
||||
else
|
||||
aws sso login
|
||||
fi
|
||||
elif [[ "$2" == "logout" ]]; then
|
||||
aws sso logout
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +61,7 @@ function asp() {
|
|||
function asr() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_REGION AWS_REGION
|
||||
_aws_update_state
|
||||
echo AWS region cleared.
|
||||
return
|
||||
fi
|
||||
|
|
@ -50,6 +75,7 @@ function asr() {
|
|||
|
||||
export AWS_REGION=$1
|
||||
export AWS_DEFAULT_REGION=$1
|
||||
_aws_update_state
|
||||
}
|
||||
|
||||
# AWS profile switch
|
||||
|
|
@ -196,8 +222,17 @@ function aws_change_access_key() {
|
|||
}
|
||||
|
||||
function aws_regions() {
|
||||
local region
|
||||
if [[ $AWS_DEFAULT_REGION ]];then
|
||||
region="$AWS_DEFAULT_REGION"
|
||||
elif [[ $AWS_REGION ]];then
|
||||
region="$AWS_REGION"
|
||||
else
|
||||
region="us-west-1"
|
||||
fi
|
||||
|
||||
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
||||
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
else
|
||||
echo "You must specify a AWS profile."
|
||||
fi
|
||||
|
|
@ -240,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
|
|||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
|
||||
test -s "${AWS_STATE_FILE}" || return
|
||||
|
||||
aws_state=($(cat $AWS_STATE_FILE))
|
||||
|
||||
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
|
||||
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||
|
||||
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
|
||||
|
||||
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
||||
export AWS_DEFAULT_REGION="$AWS_REGION"
|
||||
fi
|
||||
|
||||
# Load awscli completions
|
||||
|
||||
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
# Author: Avneet Singh (kalsi-avneet) #
|
||||
# Modified to add support for Android #
|
||||
###########################################
|
||||
# Author: Not Pua (im-notpua) #
|
||||
# Modified to add support for OpenBSD #
|
||||
###########################################
|
||||
|
||||
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
function battery_is_charging() {
|
||||
|
|
@ -139,6 +143,46 @@ elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )
|
|||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
elif [[ "$OSTYPE" = openbsd* ]]; then
|
||||
function battery_is_charging() {
|
||||
[[ $(apm -b) -eq 3 ]]
|
||||
}
|
||||
function battery_pct() {
|
||||
apm -l
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
local remaining_time
|
||||
remaining_time=$(apm -m)
|
||||
if [[ $remaining_time -ge 0 ]]; then
|
||||
((hour = $remaining_time / 60 ))
|
||||
((minute = $remaining_time % 60 ))
|
||||
printf %02d:%02d $hour $minute
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
elif [[ "$OSTYPE" = linux* ]]; then
|
||||
function battery_is_charging() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Bazel plugin
|
||||
|
||||
This plugin adds completion for [bazel](https://bazel.build), an open-source build and
|
||||
test tool that scalably supports multi-language and multi-platform projects.
|
||||
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
|
||||
|
||||
To use it, add `bazel` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
@ -12,3 +11,12 @@ plugins=(... bazel)
|
|||
The plugin has a copy of [the completion script from the git repository][1].
|
||||
|
||||
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||
| bzb | `bazel build` | The `bazel build` command |
|
||||
| bzt | `bazel test` | The `bazel test` command |
|
||||
| bzr | `bazel run` | The `bazel run` command |
|
||||
| bzq | `bazel query` | The `bazel query` command |
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef bazel
|
||||
#compdef bazel bazelisk
|
||||
|
||||
# Copyright 2015 The Bazel Authors. All rights reserved.
|
||||
#
|
||||
|
|
|
|||
5
plugins/bazel/bazel.plugin.zsh
Normal file
5
plugins/bazel/bazel.plugin.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Aliases for bazel
|
||||
alias bzb='bazel build'
|
||||
alias bzt='bazel test'
|
||||
alias bzr='bazel run'
|
||||
alias bzq='bazel query'
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
# bgnotify zsh plugin
|
||||
|
||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
|
||||
cross-platform background notifications for long running commands! Supports OSX and Linux.
|
||||
|
||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
||||
|
||||
----------------------------------
|
||||
---
|
||||
|
||||
## How to use!
|
||||
## How to use
|
||||
|
||||
Just add bgnotify to your plugins list in your `.zshrc`
|
||||
|
||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||
- On ubuntu you're already all set!
|
||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
|
||||
- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
|
@ -35,20 +35,29 @@ Just add bgnotify to your plugins list in your `.zshrc`
|
|||
|
||||
One can configure a few things:
|
||||
|
||||
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||
- `function bgnotify_formatted` lets you change the notification
|
||||
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||
|
||||
Use these by adding a function definition before the your call to source. Example:
|
||||
|
||||
~~~ sh
|
||||
```sh
|
||||
bgnotify_bell=false ## disable terminal bell
|
||||
bgnotify_threshold=4 ## set your own notification threshold
|
||||
|
||||
function bgnotify_formatted {
|
||||
## $1=exit_status, $2=command, $3=elapsed_time
|
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
|
||||
bgnotify "$title -- after $3 s" "$2";
|
||||
|
||||
# Humanly readable elapsed time
|
||||
local elapsed="$(( $3 % 60 ))s"
|
||||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
|
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
|
||||
[ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
|
||||
bgnotify "$title - took ${elapsed}" "$2" "$icon"
|
||||
}
|
||||
|
||||
plugins=(git bgnotify) ## add to plugins list
|
||||
source $ZSH/oh-my-zsh.sh ## existing source call
|
||||
~~~
|
||||
```
|
||||
|
|
|
|||
|
|
@ -21,13 +21,12 @@ function bgnotify_end {
|
|||
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||
|
||||
# check time elapsed
|
||||
[[ $bgnotify_timestamp -gt 0 ]] || return
|
||||
[[ $elapsed -ge $bgnotify_threshold ]] || return
|
||||
[[ $bgnotify_timestamp -gt 0 ]] || return 0
|
||||
[[ $elapsed -ge $bgnotify_threshold ]] || return 0
|
||||
|
||||
# check if Terminal app is not active
|
||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
|
||||
|
||||
printf '\a' # beep sound
|
||||
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
||||
} always {
|
||||
bgnotify_timestamp=0
|
||||
|
|
@ -52,53 +51,89 @@ function bgnotify_formatted {
|
|||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
|
||||
if [[ $1 -eq 0 ]]; then
|
||||
bgnotify "#win (took $elapsed)" "$2"
|
||||
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
bgnotify "#win (took $elapsed)" "$cmd"
|
||||
else
|
||||
bgnotify "#fail (took $elapsed)" "$2"
|
||||
bgnotify "#fail (took $elapsed)" "$cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
||||
function bgnotify_appid {
|
||||
if (( ${+commands[osascript]} )); then
|
||||
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
|
||||
elif (( ${+commands[xprop]} )); then
|
||||
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||
local app_id=$(bgnotify_find_sway_appid)
|
||||
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
||||
else
|
||||
echo $EPOCHSECONDS
|
||||
fi
|
||||
}
|
||||
|
||||
function bgnotify {
|
||||
# $1: title, $2: message
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id="${bgnotify_termid%%,*}" # remove window id
|
||||
if [[ -z "$term_id" ]]; then
|
||||
case "$TERM_PROGRAM" in
|
||||
iTerm.app) term_id='com.googlecode.iterm2' ;;
|
||||
Apple_Terminal) term_id='com.apple.terminal' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ -z "$term_id" ]]; then
|
||||
terminal-notifier -message "$2" -title "$1" &>/dev/null
|
||||
else
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
|
||||
fi
|
||||
function bgnotify_find_sway_appid {
|
||||
# output is "app_id,container_id", for example "Alacritty,1694"
|
||||
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
|
||||
if (( ${+commands[jq]} )); then
|
||||
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")'
|
||||
else
|
||||
swaymsg -t get_tree | awk '
|
||||
BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 }
|
||||
{
|
||||
# Enter a block
|
||||
if ($0 ~ /.*{$/) Nesting++
|
||||
|
||||
# Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 }
|
||||
|
||||
# Save the Id, it is potentially what we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 }
|
||||
|
||||
# Save the Appid, it is potentially what we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 }
|
||||
|
||||
# Window is focused, this nesting block contains the Id and Appid we want!
|
||||
if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting }
|
||||
}
|
||||
END {
|
||||
if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id
|
||||
else print ""
|
||||
}'
|
||||
fi
|
||||
}
|
||||
|
||||
function bgnotify_programid {
|
||||
case "$TERM_PROGRAM" in
|
||||
iTerm.app) echo 'com.googlecode.iterm2' ;;
|
||||
Apple_Terminal) echo 'com.apple.terminal' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function bgnotify {
|
||||
local title="$1"
|
||||
local message="$2"
|
||||
local icon="$3"
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id=$(bgnotify_programid)
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
|
||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||
growlnotify -m "$1" "$2"
|
||||
elif (( ${+commands[notify-send]} )); then # GNOME
|
||||
notify-send "$1" "$2"
|
||||
growlnotify -m "$title" "$message"
|
||||
elif (( ${+commands[notify-send]} )); then
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
|
||||
elif (( ${+commands[kdialog]} )); then # KDE
|
||||
kdialog --title "$1" --passivepopup "$2" 5
|
||||
kdialog --title "$title" --passivepopup "$message" 5
|
||||
elif (( ${+commands[notifu]} )); then # cygwin
|
||||
notifu /m "$2" /p "$1"
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
|
||||
fi
|
||||
}
|
||||
|
||||
## Defaults
|
||||
|
||||
# enable terminal bell on notify by default
|
||||
bgnotify_bell=${bgnotify_bell:-true}
|
||||
|
||||
# notify if command took longer than 5s by default
|
||||
bgnotify_threshold=${bgnotify_threshold:-5}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
|
|||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
||||
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
```
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ plugins=(... brew)
|
|||
|
||||
## Shellenv
|
||||
|
||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
||||
locations, and execute `brew shellenv` to set the environment appropriately.
|
||||
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
||||
defined for convenience.
|
||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common locations, and execute
|
||||
`brew shellenv` to set the environment appropriately. This plugin will also export
|
||||
`HOMEBREW_PREFIX="$(brew --prefix)"` if not previously defined for convenience.
|
||||
|
||||
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
||||
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
||||
|
||||
## Aliases
|
||||
|
||||
|
|
@ -33,9 +35,9 @@ defined for convenience.
|
|||
|
||||
## Completion
|
||||
|
||||
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
||||
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it
|
||||
manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
||||
|
||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
|
||||
brew installation, so we no longer ship it with the brew plugin; now it only has brew
|
||||
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
|
||||
installation fully up to date.
|
||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the brew installation,
|
||||
so we no longer ship it with the brew plugin; now it only has brew aliases. If you find that brew completion
|
||||
no longer works, make sure you have your Homebrew installation fully up to date.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
if (( ! $+commands[brew] )); then
|
||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
if [[ -n "$BREW_LOCATION" ]]; then
|
||||
if [[ ! -x "$BREW_LOCATION" ]]; then
|
||||
echo "[oh-my-zsh] $BREW_LOCATION is not executable"
|
||||
return
|
||||
fi
|
||||
elif [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
BREW_LOCATION="/opt/homebrew/bin/brew"
|
||||
elif [[ -x /usr/local/bin/brew ]]; then
|
||||
BREW_LOCATION="/usr/local/bin/brew"
|
||||
|
|
@ -31,7 +36,6 @@ fi
|
|||
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
alias bcubo='brew update && brew outdated --cask'
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
alias brewp='brew pin'
|
||||
alias brewsp='brew list --pinned'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
|
|
|
|||
20
plugins/bun/README.md
Normal file
20
plugins/bun/README.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Bun Plugin
|
||||
|
||||
This plugin sets up completion for [Bun](https://bun.sh).
|
||||
|
||||
To use it, add `bun` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... bun)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and is automatically updated when the
|
||||
plugin is loaded, which is usually when you start up a new terminal emulator.
|
||||
|
||||
The cache is stored at:
|
||||
|
||||
- `$ZSH_CACHE_DIR/completions/_bun_` completions script
|
||||
14
plugins/bun/bun.plugin.zsh
Normal file
14
plugins/bun/bun.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# If Bun is not found, don't do the rest of the script
|
||||
if (( ! $+commands[bun] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `bun`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _bun
|
||||
_comps[bun]=_bun
|
||||
fi
|
||||
|
||||
bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# catimg
|
||||
|
||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
Plugin for displaying images on the terminal using the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
|
||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
_source-from-omz-settings() {
|
||||
local _chruby_path _chruby_auto
|
||||
|
||||
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ _source-from-homebrew() {
|
|||
if [[ -h /usr/local/opt/chruby ]];then
|
||||
_brew_prefix="/usr/local/opt/chruby"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
# ok , it is not default prefix
|
||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix chruby)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
|
|||
|
||||
## Contributors
|
||||
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
|
||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||
[2]: https://github.com/benwilcock
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Also provides the following aliases:
|
|||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
||||
to run the code in a JS console.
|
||||
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||
to compile large/multi-line snippets
|
||||
|
||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ function colored() {
|
|||
# Prefer `less` whenever available, since we specifically configured
|
||||
# environment for it.
|
||||
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
||||
environment+=( GROFF_NO_SGR=1 )
|
||||
|
||||
# See ./nroff script.
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
for file (
|
||||
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
||||
/usr/share/doc/pkgfile/command-not-found.zsh
|
||||
# macOS (M1 and classic Homebrew): https://github.com/Homebrew/homebrew-command-not-found
|
||||
# Homebrew: https://github.com/Homebrew/homebrew-command-not-found
|
||||
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
); do
|
||||
if [[ -r "$file" ]]; then
|
||||
source "$file"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
if (( ${+commands[compleat]} )); then
|
||||
local prefix="${commands[compleat]:h:h}"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
|
||||
if [[ -f "$setup" ]]; then
|
||||
if ! bashcompinit >/dev/null 2>&1; then
|
||||
|
|
@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
|
|||
bashcompinit -i
|
||||
fi
|
||||
|
||||
source "$setup"
|
||||
source "$setup"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# copy the active line from the command line buffer
|
||||
# copy the active line from the command line buffer
|
||||
# onto the system clipboard
|
||||
|
||||
copybuffer () {
|
||||
if which clipcopy &>/dev/null; then
|
||||
if builtin which clipcopy &>/dev/null; then
|
||||
printf "%s" "$BUFFER" | clipcopy
|
||||
else
|
||||
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ dash
|
|||
|
||||
- Query for something in dash app: `dash query`
|
||||
```
|
||||
dash golang
|
||||
dash golang
|
||||
```
|
||||
|
||||
- You can optionally provide a keyword: `dash [keyword:]query`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ plugins=(... debian)
|
|||
- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
|
||||
- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
|
||||
|
||||
Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
|
||||
Set **both** `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior, e.g.:
|
||||
|
||||
```sh
|
||||
apt_pref='apt'
|
||||
apt_upgr='full-upgrade'
|
||||
```
|
||||
|
||||
## Common Aliases
|
||||
|
||||
|
|
@ -21,7 +26,7 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
|
|||
| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| `age` | `apt-get` | Command line tool for handling packages |
|
||||
| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
|
||||
| `acse` | `apt-cache search` | Command line tool for searching apt software package cache |
|
||||
| `acs` | `apt-cache search` | Command line tool for searching apt software package cache |
|
||||
| `aps` | `aptitude search` | Searches installed packages using aptitude |
|
||||
| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
|
||||
| `afs` | `apt-file search --regexp` | Search file in packages |
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ alias age='apt-get'
|
|||
alias api='aptitude'
|
||||
|
||||
# Some self-explanatory aliases
|
||||
alias acse="apt-cache search"
|
||||
alias acs="apt-cache search"
|
||||
alias aps='aptitude search'
|
||||
alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ _direnv_hook() {
|
|||
trap - SIGINT;
|
||||
}
|
||||
typeset -ag precmd_functions;
|
||||
if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
|
||||
if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
||||
fi
|
||||
typeset -ag chpwd_functions;
|
||||
if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
|
||||
if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ To use it, add `dnf` to the plugins array in your zshrc file:
|
|||
plugins=(... dnf)
|
||||
```
|
||||
|
||||
Classic `dnf` is getting superseded by `dnf5`; this plugin detects the presence
|
||||
of `dnf5` and uses it as drop-in alternative to the slower `dnf`.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
## Aliases
|
||||
local dnfprog="dnf"
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
alias dnfli="dnf list installed" # List installed packages
|
||||
alias dnfgl="dnf grouplist" # List package groups
|
||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
||||
alias dnfp="dnf info" # Show package information
|
||||
alias dnfs="dnf search" # Search package
|
||||
# Prefer dnf5 if installed
|
||||
command -v dnf5 > /dev/null && dnfprog=dnf5
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
||||
alias dnfi="sudo dnf install" # Install package
|
||||
alias dnfgi="sudo dnf groupinstall" # Install package group
|
||||
alias dnfr="sudo dnf remove" # Remove package
|
||||
alias dnfgr="sudo dnf groupremove" # Remove package group
|
||||
alias dnfc="sudo dnf clean all" # Clean cache
|
||||
alias dnfl="${dnfprog} list" # List packages
|
||||
alias dnfli="${dnfprog} list installed" # List installed packages
|
||||
alias dnfgl="${dnfprog} grouplist" # List package groups
|
||||
alias dnfmc="${dnfprog} makecache" # Generate metadata cache
|
||||
alias dnfp="${dnfprog} info" # Show package information
|
||||
alias dnfs="${dnfprog} search" # Search package
|
||||
|
||||
alias dnfu="sudo ${dnfprog} upgrade" # Upgrade package
|
||||
alias dnfi="sudo ${dnfprog} install" # Install package
|
||||
alias dnfgi="sudo ${dnfprog} groupinstall" # Install package group
|
||||
alias dnfr="sudo ${dnfprog} remove" # Remove package
|
||||
alias dnfgr="sudo ${dnfprog} groupremove" # Remove package group
|
||||
alias dnfc="sudo ${dnfprog} clean all" # Clean cache
|
||||
|
|
|
|||
|
|
@ -11,23 +11,24 @@ plugins=(... docker-compose)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|--------------------------------|----------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
| Alias | Command | Description |
|
||||
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ __docker-compose_subcommand() {
|
|||
'--resolve-image-digests[Pin image tags to digests.]' \
|
||||
'--services[Print the service names, one per line.]' \
|
||||
'--volumes[Print the volume names, one per line.]' \
|
||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
|
||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ alias dcupdb="$dccmd up -d --build"
|
|||
alias dcdn="$dccmd down"
|
||||
alias dcl="$dccmd logs"
|
||||
alias dclf="$dccmd logs -f"
|
||||
alias dclF="$dccmd logs -f --tail 0"
|
||||
alias dcpull="$dccmd pull"
|
||||
alias dcstart="$dccmd start"
|
||||
alias dck="$dccmd kill"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,15 @@ file**, but be aware of the side effects:
|
|||
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
|
||||
> ```
|
||||
|
||||
### Use old-style completion
|
||||
|
||||
If the current completion does not work well for you, you can enable legacy completion instead with the
|
||||
following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more information.
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:docker' legacy-completion yes
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
@ -58,7 +67,7 @@ file**, but be aware of the side effects:
|
|||
| drm | `docker container rm` | Remove the specified container(s) |
|
||||
| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
|
||||
| dst | `docker container start` | Start one or more stopped containers |
|
||||
| drs | `docker container restart` | Restart one or more containers
|
||||
| drs | `docker container restart` | Restart one or more containers |
|
||||
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
||||
| dstp | `docker container stop` | Stop one or more running containers |
|
||||
| dtop | `docker top` | Display the running processes of a container |
|
||||
|
|
|
|||
3126
plugins/docker/completions/_docker
Normal file
3126
plugins/docker/completions/_docker
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -36,17 +36,27 @@ if (( ! $+commands[docker] )); then
|
|||
return
|
||||
fi
|
||||
|
||||
# Standarized $0 handling
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _docker
|
||||
_comps[docker]=_docker
|
||||
fi
|
||||
|
||||
{
|
||||
# `docker completion` is only available from 23.0.0 on
|
||||
local _docker_version=$(command docker version --format '{{.Client.Version}}' 2>/dev/null)
|
||||
if is-at-least 23.0.0 $_docker_version; then
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _docker
|
||||
_comps[docker]=_docker
|
||||
fi
|
||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
||||
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
|
||||
# with `s:,:` remove the comma after the version, and select third word of it
|
||||
if zstyle -t ':omz:plugins:docker' legacy-completion || \
|
||||
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||
else
|
||||
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
||||
fi
|
||||
} &|
|
||||
|
|
|
|||
|
|
@ -1,25 +1,17 @@
|
|||
# This scripts is copied from (MIT License):
|
||||
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
|
||||
# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
|
||||
|
||||
_dotnet_zsh_complete()
|
||||
{
|
||||
local completions=("$(dotnet complete "$words")")
|
||||
|
||||
# If the completion list is empty, just continue with filename selection
|
||||
if [ -z "$completions" ]
|
||||
then
|
||||
_arguments '*::arguments: _normal'
|
||||
return
|
||||
fi
|
||||
|
||||
# This is not a variable assignment, don't remove spaces!
|
||||
_values = "${(ps:\n:)completions}"
|
||||
#compdef dotnet
|
||||
_dotnet_completion() {
|
||||
local -a completions=("${(@f)$(dotnet complete "${words}")}")
|
||||
compadd -a completions
|
||||
_files
|
||||
}
|
||||
|
||||
compdef _dotnet_zsh_complete dotnet
|
||||
compdef _dotnet_completion dotnet
|
||||
|
||||
# Aliases bellow are here for backwards compatibility
|
||||
# added by Shaun Tabone (https://github.com/xontab)
|
||||
# added by Shaun Tabone (https://github.com/xontab)
|
||||
|
||||
alias dn='dotnet new'
|
||||
alias dr='dotnet run'
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
|
|||
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
||||
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
||||
| efile | - | Print the path to the file open in the current buffer |
|
||||
| ecd | - | Print the directory of the file open in the the current buffer |
|
||||
| ecd | - | Print the directory of the file open in the current buffer |
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function efile {
|
|||
}
|
||||
|
||||
# Write to standard output the directory of the file
|
||||
# opened in the the current buffer
|
||||
# opened in the current buffer
|
||||
function ecd {
|
||||
local file
|
||||
file="$(efile)" || return $?
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
|
|||
|
||||
# This is a combining character that can be placed after any other character to surround
|
||||
# it in a "keycap" symbol.
|
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
||||
# which can be displayed on their own.
|
||||
|
||||
|
|
@ -63,9 +63,9 @@ function random_emoji() {
|
|||
[[ $list_size -eq 0 ]] && return 1
|
||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||
local name=${names[$random_index]}
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
echo ${emoji_flags[$name]}
|
||||
else
|
||||
else
|
||||
echo ${emoji[$name]}
|
||||
fi
|
||||
}
|
||||
|
|
@ -86,22 +86,22 @@ function display_emoji() {
|
|||
# terminals treat these emoji chars as single-width.
|
||||
local counter=1
|
||||
for i in $names; do
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
printf '%s ' "$emoji_flags[$i]"
|
||||
else
|
||||
printf '%s ' "$emoji[$i]"
|
||||
else
|
||||
printf '%s ' "$emoji[$i]"
|
||||
fi
|
||||
# New line every 20 emoji, to avoid weirdnesses
|
||||
if (($counter % 20 == 0)); then
|
||||
printf "\n"
|
||||
printf "\n"
|
||||
fi
|
||||
let counter=$counter+1
|
||||
done
|
||||
print
|
||||
for i in $names; do
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
echo "${emoji_flags[$i]} = $i"
|
||||
else
|
||||
else
|
||||
echo "${emoji[$i]} = $i"
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||
# VERSION: 1.0.0
|
||||
# DEPENDS: emoji plugin
|
||||
#
|
||||
#
|
||||
# There are different sets of emoji characters available, to choose a different
|
||||
# set export emotty_set to the name of the set you would like to use, e.g.:
|
||||
# % export emotty_set=nature
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ plugins=(... encode64)
|
|||
|
||||
### Encoding a file
|
||||
|
||||
Encode a file's contents to base64 and save output to text file.
|
||||
Encode a file's contents to base64 and save output to text file.
|
||||
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
||||
|
||||
- From parameter
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ EOF
|
|||
local file="$1" full_path="${1:A}"
|
||||
local extract_dir="${1:t:r}"
|
||||
|
||||
# Remove the .tar extension if the file name is .tar.*
|
||||
if [[ $extract_dir =~ '\.tar$' ]]; then
|
||||
extract_dir="${extract_dir:r}"
|
||||
fi
|
||||
|
||||
# If there's a file or directory with the same name as the archive
|
||||
# add a random string to the end of the extract directory
|
||||
if [[ -e "$extract_dir" ]]; then
|
||||
|
|
@ -64,8 +69,8 @@ EOF
|
|||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
|
||||
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$full_path" || gunzip -k "$full_path" ;;
|
||||
(*.bz2) bunzip2 "$full_path" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
||||
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
|
||||
(*.xz) unxz "$full_path" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
||||
(*.lz4) lz4 -d "$full_path" ;;
|
||||
|
|
@ -82,7 +87,7 @@ EOF
|
|||
builtin cd -q control; extract ../control.tar.*
|
||||
builtin cd -q ../data; extract ../data.tar.*
|
||||
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
||||
(*.zst) unzstd "$full_path" ;;
|
||||
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
|
||||
(*.cab|*.exe) cabextract "$full_path" ;;
|
||||
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
||||
(*.zpaq) zpaq x "$full_path" ;;
|
||||
|
|
@ -106,19 +111,19 @@ EOF
|
|||
# - Y2: at most give 2 files
|
||||
local -a content
|
||||
content=("${extract_dir}"/*(DNY2))
|
||||
if [[ ${#content} -eq 1 && -d "${content[1]}" ]]; then
|
||||
# The extracted folder (${content[1]}) may have the same name as $extract_dir
|
||||
if [[ ${#content} -eq 1 && -e "${content[1]}" ]]; then
|
||||
# The extracted file/folder (${content[1]}) may have the same name as $extract_dir
|
||||
# If so, we need to rename it to avoid conflicts in a 3-step process
|
||||
#
|
||||
# 1. Move and rename the extracted folder to a temporary random name
|
||||
# 1. Move and rename the extracted file/folder to a temporary random name
|
||||
# 2. Delete the empty folder
|
||||
# 3. Rename the extracted folder to the original name
|
||||
# 3. Rename the extracted file/folder to the original name
|
||||
if [[ "${content[1]:t}" == "$extract_dir" ]]; then
|
||||
# =(:) gives /tmp/zsh<random>, with :t it gives zsh<random>
|
||||
local tmp_dir==(:); tmp_dir="${tmp_dir:t}"
|
||||
command mv "${content[1]}" "$tmp_dir" \
|
||||
local tmp_name==(:); tmp_name="${tmp_name:t}"
|
||||
command mv "${content[1]}" "$tmp_name" \
|
||||
&& command rmdir "$extract_dir" \
|
||||
&& command mv "$tmp_dir" "$extract_dir"
|
||||
&& command mv "$tmp_name" "$extract_dir"
|
||||
# Otherwise, if the extracted folder name already exists in the current
|
||||
# directory (because of a previous file / folder), keep the extract_dir
|
||||
elif [[ ! -e "${content[1]:t}" ]]; then
|
||||
|
|
|
|||
101
plugins/eza/README.md
Normal file
101
plugins/eza/README.md
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# eza plugin
|
||||
|
||||
This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
|
||||
|
||||
To use it add `eza` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... eza)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
|
||||
|
||||
**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
|
||||
changing the `zstyle` won't have any effect.
|
||||
|
||||
### `dirs-first`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'dirs-first' yes|no
|
||||
```
|
||||
|
||||
If `yes`, directories will be grouped first.
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `git-status`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'git-status' yes|no
|
||||
```
|
||||
|
||||
If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `header`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'header' yes|no
|
||||
```
|
||||
|
||||
If `yes`, always add `-h` flag to add a header row for each column.
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `show-group`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'show-group' yes|no
|
||||
```
|
||||
|
||||
If `yes` (default), always add `-g` flag to show the group ownership.
|
||||
|
||||
Default: `yes`
|
||||
|
||||
### `size-prefix`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
|
||||
```
|
||||
|
||||
Choose the prefix to be used in displaying file size:
|
||||
|
||||
- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
|
||||
so on
|
||||
- `none` -- don't use any prefix, show size in bytes
|
||||
- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
|
||||
|
||||
Default: `si`
|
||||
|
||||
### `time-style`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
|
||||
```
|
||||
|
||||
Sets the `--time-style` option of `eza`. (See `man eza` for the options)
|
||||
|
||||
Default: Not set, which means the default behavior of `eza` will take place.
|
||||
|
||||
## Aliases
|
||||
|
||||
**Notes:**
|
||||
|
||||
- Aliases may be modified by Configuration
|
||||
- The term "files" without "only" qualifier means both files & directories
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | ----------------- | -------------------------------------------------------------------------- |
|
||||
| `la` | `eza -la` | List all files (except . and ..) as a long list |
|
||||
| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
|
||||
| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
|
||||
| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
|
||||
| `ll` | `eza -l` | List files as a long list |
|
||||
| `ls` | `eza` | Plain eza call |
|
||||
| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
|
||||
| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
|
||||
| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
|
||||
| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
|
||||
62
plugins/eza/eza.plugin.zsh
Normal file
62
plugins/eza/eza.plugin.zsh
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
if ! (( $+commands[eza] )); then
|
||||
print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
typeset -a _EZA_HEAD
|
||||
typeset -a _EZA_TAIL
|
||||
|
||||
function _configure_eza() {
|
||||
local _val
|
||||
# Get the head flags
|
||||
if zstyle -T ':omz:plugins:eza' 'show-group'; then
|
||||
_EZA_HEAD+=("g")
|
||||
fi
|
||||
if zstyle -t ':omz:plugins:eza' 'header'; then
|
||||
_EZA_HEAD+=("h")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
||||
case "${_val:l}" in
|
||||
binary)
|
||||
_EZA_HEAD+=("b")
|
||||
;;
|
||||
none)
|
||||
_EZA_HEAD+=("B")
|
||||
;;
|
||||
esac
|
||||
# Get the tail long-options
|
||||
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
|
||||
_EZA_TAIL+=("--group-directories-first")
|
||||
fi
|
||||
if zstyle -t ':omz:plugins:eza' 'git-status'; then
|
||||
_EZA_TAIL+=("--git")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||
if [[ $_val ]]; then
|
||||
_EZA_TAIL+=("--time-style='$_val'")
|
||||
fi
|
||||
}
|
||||
|
||||
_configure_eza
|
||||
|
||||
function _alias_eza() {
|
||||
local _head="${(j::)_EZA_HEAD}$2"
|
||||
local _tail="${(j: :)_EZA_TAIL}"
|
||||
alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
|
||||
}
|
||||
|
||||
_alias_eza la la
|
||||
_alias_eza ldot ld ".*"
|
||||
_alias_eza lD lD
|
||||
_alias_eza lDD lDa
|
||||
_alias_eza ll l
|
||||
_alias_eza ls
|
||||
_alias_eza lsd d
|
||||
_alias_eza lsdl dl
|
||||
_alias_eza lS "l -ssize"
|
||||
_alias_eza lT "l -snewest"
|
||||
|
||||
unfunction _alias_eza
|
||||
unfunction _configure_eza
|
||||
unset _EZA_HEAD
|
||||
unset _EZA_TAIL
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
# Use Ctrl-Z to switch back to Vim
|
||||
|
||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||
to Vim. I could not find a solution, so I developed one on my own that
|
||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||
to Vim. I could not find a solution, so I developed one on my own that
|
||||
works wonderfully with ZSH.
|
||||
|
||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||
|
||||
Credits:
|
||||
Credits:
|
||||
- original idea by @sheerun
|
||||
- added to OMZ by @mbologna
|
||||
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
|
|||
For example: `fastfile_var_prefix='@'`.
|
||||
|
||||
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
||||
created global aliases.
|
||||
created global aliases.
|
||||
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
||||
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
||||
or using `⌥ Option`+`6` in macOS.
|
||||
|
||||
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
||||
with a trailing slash.
|
||||
with a trailing slash.
|
||||
**Default:** `$HOME/.fastfile/`.
|
||||
|
||||
## Author
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ function fwl () {
|
|||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
||||
|
||||
for i in $zones; do
|
||||
sudo firewall-cmd --zone $i --list-all
|
||||
sudo firewall-cmd --zone ${i/ \(default\)} --list-all
|
||||
done
|
||||
|
||||
echo 'Direct Rules:'
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function fl {
|
|||
tell application forkLiftSetapp
|
||||
activate
|
||||
set forkLiftVersion to version
|
||||
end tell
|
||||
end tell
|
||||
else if forkLift3 is not null and application forkLift3 is running then
|
||||
tell application forkLift3
|
||||
activate
|
||||
|
|
@ -84,7 +84,7 @@ function fl {
|
|||
else if forkLift is not null then
|
||||
set appName to forkLift
|
||||
end if
|
||||
|
||||
|
||||
tell application appName
|
||||
activate
|
||||
set forkLiftVersion to version
|
||||
|
|
|
|||
|
|
@ -60,12 +60,22 @@ Available search contexts are:
|
|||
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
||||
| unheap | `http://www.unheap.com/?s=` |
|
||||
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
||||
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
|
||||
|
||||
If you want to have another context, open an Issue and tell us!
|
||||
|
||||
## Fallback search behaviour
|
||||
|
||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search
|
||||
function. You can set the fallback search engine to DuckDuckGo by setting
|
||||
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||
|
||||
## DuckDuckGo Lucky Search
|
||||
|
||||
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
|
||||
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
|
||||
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
|
||||
setting unnecessary in this context.
|
||||
|
||||
## Author
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
|
|||
alias typescript='frontend typescript'
|
||||
alias unheap='frontend unheap'
|
||||
alias vuejs='frontend vuejs'
|
||||
alias nextjs='frontend nextjs'
|
||||
|
||||
function _frontend_fallback() {
|
||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||
esac
|
||||
if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
|
||||
case true in
|
||||
*) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
|
||||
esac
|
||||
else
|
||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function frontend() {
|
||||
|
|
@ -70,6 +77,7 @@ function frontend() {
|
|||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||
unheap 'http://www.unheap.com/?s='
|
||||
vuejs $(_frontend_fallback 'vuejs.org')
|
||||
nextjs $(_frontend_fallback 'nextjs.org')
|
||||
)
|
||||
|
||||
# show help for command list
|
||||
|
|
@ -81,7 +89,7 @@ function frontend() {
|
|||
print -P ""
|
||||
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||
print -P ""
|
||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||
print -P ""
|
||||
|
|
@ -96,7 +104,7 @@ function frontend() {
|
|||
echo ""
|
||||
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
function fzf_setup_using_fzf() {
|
||||
(( ${+commands[fzf]} )) || return 1
|
||||
|
||||
# we remove "fzf " prefix, this fixes really old fzf versions behaviour
|
||||
# see https://github.com/ohmyzsh/ohmyzsh/issues/12387
|
||||
local fzf_ver=${"$(fzf --version)"#fzf }
|
||||
is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
|
||||
|
||||
eval "$(fzf --zsh)"
|
||||
}
|
||||
|
||||
function fzf_setup_using_base_dir() {
|
||||
local fzf_base fzf_shell fzfdirs dir
|
||||
|
||||
|
|
@ -8,6 +19,7 @@ function fzf_setup_using_base_dir() {
|
|||
"${HOME}/.fzf"
|
||||
"${HOME}/.nix-profile/share/fzf"
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
||||
"${MSYSTEM_PREFIX}/share/fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/opt/homebrew/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
|
|
@ -61,7 +73,7 @@ function fzf_setup_using_base_dir() {
|
|||
|
||||
function fzf_setup_using_debian() {
|
||||
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
||||
# Not a debian based distro
|
||||
# Not a debian based distro
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
@ -216,7 +228,8 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
|
|||
EOF
|
||||
}
|
||||
|
||||
fzf_setup_using_openbsd \
|
||||
fzf_setup_using_fzf \
|
||||
|| fzf_setup_using_openbsd \
|
||||
|| fzf_setup_using_debian \
|
||||
|| fzf_setup_using_opensuse \
|
||||
|| fzf_setup_using_cygwin \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Gas plugin
|
||||
|
||||
This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
|
||||
This plugin adds autocompletion for the [gas](http://ramblingsby.me/gas/) command,
|
||||
a utility to manage Git authors.
|
||||
|
||||
To use it, add `gas` to the plugins array of your zshrc file:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
"/usr/local/share/google-cloud-sdk"
|
||||
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/share/google-cloud-sdk"
|
||||
"/usr/share/google-cloud-sdk"
|
||||
"/snap/google-cloud-sdk/current"
|
||||
"/snap/google-cloud-cli/current"
|
||||
|
|
@ -17,6 +18,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
"/opt/google-cloud-sdk"
|
||||
"/opt/google-cloud-cli"
|
||||
"/opt/local/libexec/google-cloud-sdk"
|
||||
"$HOME/.asdf/installs/gcloud/*/"
|
||||
)
|
||||
|
||||
for gcloud_sdk_location in $search_locations; do
|
||||
|
|
@ -29,11 +31,9 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
fi
|
||||
|
||||
if (( ${+CLOUDSDK_HOME} )); then
|
||||
# Only source this if gcloud isn't already on the path
|
||||
if (( ! $+commands[gcloud] )); then
|
||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||
fi
|
||||
# Source path file
|
||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||
fi
|
||||
|
||||
# Look for completion file in different paths
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ function git-fetch-all {
|
|||
date -R &>! "$gitdir/FETCH_LOG"
|
||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||
GIT_TERMINAL_PROMPT=0 \
|
||||
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
||||
command git fetch --all --recurse-submodules=yes 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
||||
) &|
|
||||
}
|
||||
|
||||
|
|
|
|||
47
plugins/git-commit/README.md
Normal file
47
plugins/git-commit/README.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# git-commit plugin
|
||||
|
||||
The git-commit plugin adds several
|
||||
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
|
||||
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
||||
|
||||
To use it, add `git-commit` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... git-commit)
|
||||
```
|
||||
|
||||
## Syntax
|
||||
|
||||
```zsh
|
||||
git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
|
||||
```
|
||||
|
||||
Where `type` is one of the following:
|
||||
|
||||
- `build`
|
||||
- `chore`
|
||||
- `ci`
|
||||
- `docs`
|
||||
- `feat`
|
||||
- `fix`
|
||||
- `perf`
|
||||
- `refactor`
|
||||
- `rev`
|
||||
- `style`
|
||||
- `test`
|
||||
- `wip`
|
||||
|
||||
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
|
||||
> It will still generate a commit message in the format `revert: <message>`
|
||||
|
||||
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
|
||||
> care!
|
||||
|
||||
## Examples
|
||||
|
||||
| Git alias | Command |
|
||||
| --------------------------------------------- | ---------------------------------------------------- |
|
||||
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
||||
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
||||
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
|
||||
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
|
||||
58
plugins/git-commit/git-commit.plugin.zsh
Normal file
58
plugins/git-commit/git-commit.plugin.zsh
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
|
||||
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
|
||||
return
|
||||
fi
|
||||
git config --global oh-my-zsh.git-commit-alias "$_rev"
|
||||
|
||||
local -a _git_commit_aliases
|
||||
_git_commit_aliases=(
|
||||
'build'
|
||||
'chore'
|
||||
'ci'
|
||||
'docs'
|
||||
'feat'
|
||||
'fix'
|
||||
'perf'
|
||||
'refactor'
|
||||
'revert'
|
||||
'style'
|
||||
'test'
|
||||
'wip'
|
||||
)
|
||||
|
||||
local _alias _type
|
||||
for _type in "${_git_commit_aliases[@]}"; do
|
||||
# an alias can't be named "revert" because the git command takes precedence
|
||||
# https://stackoverflow.com/a/3538791
|
||||
case "$_type" in
|
||||
revert) _alias=rev ;;
|
||||
*) _alias=$_type ;;
|
||||
esac
|
||||
|
||||
local _func='!a() {
|
||||
local _scope _attention _message
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
-s | --scope )
|
||||
if [ -z $2 ]; then
|
||||
echo "Missing scope!"
|
||||
return 1
|
||||
fi
|
||||
_scope="$2"
|
||||
shift 2
|
||||
;;
|
||||
-a | --attention )
|
||||
_attention="!"
|
||||
shift 1
|
||||
;;
|
||||
* )
|
||||
_message="${_message} $1"
|
||||
shift 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
|
||||
}; a'
|
||||
|
||||
git config --global alias.$_alias "$_func"
|
||||
done
|
||||
|
|
@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
|
|||
plugins=(... git-prompt)
|
||||
```
|
||||
|
||||
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
|
||||
to change the way the prompt is built. See the
|
||||
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
|
||||
|
||||
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
||||
|
||||
## Requirements
|
||||
|
|
|
|||
|
|
@ -10,254 +10,274 @@ plugins=(... git)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
| :------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| g | git |
|
||||
| ga | git add |
|
||||
| gaa | git add --all |
|
||||
| gapa | git add --patch |
|
||||
| gau | git add --update |
|
||||
| gav | git add --verbose |
|
||||
| gap | git apply |
|
||||
| gapt | git apply --3way |
|
||||
| gb | git branch |
|
||||
| gba | git branch --all |
|
||||
| gbd | git branch --delete |
|
||||
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*(<span>$</span>(git_main_branch)\|<span>$</span>(git_develop_branch))\s*<span>$</span>)" \| xargs git branch --delete 2>/dev/null |
|
||||
| gbD | git branch --delete --force |
|
||||
| gbg | git branch -vv | grep ": gone\]" |
|
||||
| gbgd | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d |
|
||||
| gbgD | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D |
|
||||
| gbl | git blame -b -w |
|
||||
| gbnm | git branch --no-merged |
|
||||
| gbr | git branch --remote |
|
||||
| gbs | git bisect |
|
||||
| gbsb | git bisect bad |
|
||||
| gbsg | git bisect good |
|
||||
| gbsr | git bisect reset |
|
||||
| gbss | git bisect start |
|
||||
| gc | git commit --verbose |
|
||||
| gc! | git commit --verbose --amend |
|
||||
| gcn! | git commit --verbose --no-edit --amend |
|
||||
| gca | git commit --verbose --all |
|
||||
| gca! | git commit --verbose --all --amend |
|
||||
| gcan! | git commit --verbose --all --no-edit --amend |
|
||||
| gcans! | git commit --verbose --all --signoff --no-edit --amend |
|
||||
| gcam | git commit --all --message |
|
||||
| gcas | git commit --all --signoff |
|
||||
| gcasm | git commit --all --signoff --message |
|
||||
| gcsm | git commit --signoff --message |
|
||||
| gcb | git checkout -b |
|
||||
| gcf | git config --list |
|
||||
| gcl | git clone --recurse-submodules |
|
||||
| gccd | git clone --recurse-submodules "<span>$</span>@" && cd "<span>$</span>(basename <span>$</span>\_ .git)" |
|
||||
| gclean | git clean --interactive -d |
|
||||
| gpristine | git reset --hard && git clean -dffx |
|
||||
| gcm | git checkout $(git_main_branch) |
|
||||
| gcd | git checkout $(git_develop_branch) |
|
||||
| gcmsg | git commit --message |
|
||||
| gco | git checkout |
|
||||
| gcor | git checkout --recurse-submodules |
|
||||
| gcount | git shortlog --summary -n |
|
||||
| gcp | git cherry-pick |
|
||||
| gcpa | git cherry-pick --abort |
|
||||
| gcpc | git cherry-pick --continue |
|
||||
| gcs | git commit -S |
|
||||
| gcss | git commit -S -s |
|
||||
| gcssm | git commit -S -s -m |
|
||||
| gd | git diff |
|
||||
| gdca | git diff --cached |
|
||||
| gdcw | git diff --cached --word-diff |
|
||||
| gdct | git describe --tags $(git rev-list --tags --max-count=1) |
|
||||
| gds | git diff --staged |
|
||||
| gdt | git diff-tree --no-commit-id --name-only -r |
|
||||
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock" |
|
||||
| gdup | git diff @{upstream} |
|
||||
| gdv | git diff -w $@ \| view - |
|
||||
| gdw | git diff --word-diff |
|
||||
| gf | git fetch |
|
||||
| gfa | git fetch --all --prune |
|
||||
| gfg | git ls-files \| grep |
|
||||
| gfo | git fetch origin |
|
||||
| gg | git gui citool |
|
||||
| gga | git gui citool --amend |
|
||||
| ggf | git push --force origin $(current_branch) |
|
||||
| ggfl | git push --force-with-lease origin $(current_branch) |
|
||||
| ggl | git pull origin $(current_branch) |
|
||||
| ggp | git push origin $(current_branch) |
|
||||
| ggpnp | ggl && ggp |
|
||||
| ggpull | git pull origin "$(git_current_branch)" |
|
||||
| ggpur | ggu |
|
||||
| ggpush | git push origin "$(git_current_branch)" |
|
||||
| ggsup | git branch --set-upstream-to=origin/$(git_current_branch) |
|
||||
| ggu | git pull --rebase origin $(current_branch) |
|
||||
| gpsup | git push --set-upstream origin $(git_current_branch) |
|
||||
| gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes (git version >= 2.30) |
|
||||
| gpsupf | git push --set-upstream origin $(git_current_branch) --force-with-lease (git version < 2.30) |
|
||||
| ghh | git help |
|
||||
| gignore | git update-index --assume-unchanged |
|
||||
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
||||
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
|
||||
| gk | gitk --all --branches &! |
|
||||
| gke | gitk --all $(git log --walk-reflogs --pretty=%h) &! |
|
||||
| gl | git pull |
|
||||
| glg | git log --stat |
|
||||
| glgp | git log --stat --patch |
|
||||
| glgg | git log --graph |
|
||||
| glgga | git log --graph --decorate --all |
|
||||
| glgm | git log --graph --max-count=10 |
|
||||
| glo | git log --oneline --decorate |
|
||||
| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' |
|
||||
| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat |
|
||||
| glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
|
||||
| glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
|
||||
| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all |
|
||||
| glog | git log --oneline --decorate --graph |
|
||||
| gloga | git log --oneline --decorate --graph --all |
|
||||
| glp | git log --pretty=\<format\> |
|
||||
| gm | git merge |
|
||||
| gms | git merge --squash |
|
||||
| gmom | git merge origin/$(git_main_branch) |
|
||||
| gmtl | git mergetool --no-prompt |
|
||||
| gmtlvim | git mergetool --no-prompt --tool=vimdiff |
|
||||
| gmum | git merge upstream/$(git_main_branch) |
|
||||
| gma | git merge --abort |
|
||||
| gp | git push |
|
||||
| gpd | git push --dry-run |
|
||||
| gpf | git push --force-with-lease --force-if-includes (git version >= 2.30) |
|
||||
| gpf | git push --force-with-lease (git version < 2.30) |
|
||||
| gpf! | git push --force |
|
||||
| gpoat | git push origin --all && git push origin --tags |
|
||||
| gpod | git push origin --delete |
|
||||
| gpr | git pull --rebase |
|
||||
| gpu | git push upstream |
|
||||
| gpv | git push --verbose |
|
||||
| gr | git remote |
|
||||
| gra | git remote add |
|
||||
| grb | git rebase |
|
||||
| grba | git rebase --abort |
|
||||
| grbc | git rebase --continue |
|
||||
| grbd | git rebase $(git_develop_branch) |
|
||||
| grbi | git rebase --interactive |
|
||||
| grbm | git rebase $(git_main_branch) |
|
||||
| grbom | git rebase origin/$(git_main_branch) |
|
||||
| grbo | git rebase --onto |
|
||||
| grbs | git rebase --skip |
|
||||
| grev | git revert |
|
||||
| grh | git reset |
|
||||
| grhh | git reset --hard |
|
||||
| groh | git reset origin/$(git_current_branch) --hard |
|
||||
| grm | git rm |
|
||||
| grmc | git rm --cached |
|
||||
| grmv | git remote rename |
|
||||
| grrm | git remote remove |
|
||||
| grs | git restore |
|
||||
| grset | git remote set-url |
|
||||
| grss | git restore --source |
|
||||
| grst | git restore --staged |
|
||||
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
|
||||
| gru | git reset -- |
|
||||
| grup | git remote update |
|
||||
| grv | git remote --verbose |
|
||||
| gsb | git status --short -b |
|
||||
| gsd | git svn dcommit |
|
||||
| gsh | git show |
|
||||
| gsi | git submodule init |
|
||||
| gsps | git show --pretty=short --show-signature |
|
||||
| gsr | git svn rebase |
|
||||
| gss | git status --short |
|
||||
| gst | git status |
|
||||
| gsta | git stash push (git version >= 2.13) |
|
||||
| gsta | git stash save (git version < 2.13) |
|
||||
| gstaa | git stash apply |
|
||||
| gstc | git stash clear |
|
||||
| gstd | git stash drop |
|
||||
| gstl | git stash list |
|
||||
| gstp | git stash pop |
|
||||
| gsts | git stash show --text |
|
||||
| gstu | git stash --include-untracked |
|
||||
| gstall | git stash --all |
|
||||
| gsu | git submodule update |
|
||||
| gsw | git switch |
|
||||
| gswc | git switch -c |
|
||||
| gswm | git switch $(git_main_branch) |
|
||||
| gswd | git switch $(git_develop_branch) |
|
||||
| gts | git tag -s |
|
||||
| gtv | git tag \| sort -V |
|
||||
| gtl | gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl |
|
||||
| gunignore | git update-index --no-assume-unchanged |
|
||||
| gunwip | git rev-list --max-count=1 --format="%s" HEAD \| grep -q "\-\-wip\-\-" && git reset HEAD~1 |
|
||||
| gup | git pull --rebase |
|
||||
| gupv | git pull --rebase --verbose |
|
||||
| gupa | git pull --rebase --autostash |
|
||||
| gupav | git pull --rebase --autostash --verbose |
|
||||
| gupom | git pull --rebase origin $(git_main_branch) |
|
||||
| gupomi | git pull --rebase=interactive origin $(git_main_branch) |
|
||||
| glum | git pull upstream $(git_main_branch) |
|
||||
| gluc | git pull upstream $(git_current_branch) |
|
||||
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
||||
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]" |
|
||||
| gam | git am |
|
||||
| gamc | git am --continue |
|
||||
| gams | git am --skip |
|
||||
| gama | git am --abort |
|
||||
| gamscp | git am --show-current-patch |
|
||||
| gwt | git worktree |
|
||||
| gwtls | git worktree list |
|
||||
| gwtmv | git worktree move |
|
||||
| gwtrm | git worktree remove |
|
||||
| Alias | Command |
|
||||
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
|
||||
| `ggpnp` | `ggl && ggp` |
|
||||
| `ggpur` | `ggu` |
|
||||
| `g` | `git` |
|
||||
| `ga` | `git add` |
|
||||
| `gaa` | `git add --all` |
|
||||
| `gapa` | `git add --patch` |
|
||||
| `gau` | `git add --update` |
|
||||
| `gav` | `git add --verbose` |
|
||||
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` |
|
||||
| `gam` | `git am` |
|
||||
| `gama` | `git am --abort` |
|
||||
| `gamc` | `git am --continue` |
|
||||
| `gamscp` | `git am --show-current-patch` |
|
||||
| `gams` | `git am --skip` |
|
||||
| `gap` | `git apply` |
|
||||
| `gapt` | `git apply --3way` |
|
||||
| `gbs` | `git bisect` |
|
||||
| `gbsb` | `git bisect bad` |
|
||||
| `gbsg` | `git bisect good` |
|
||||
| `gbsn` | `git bisect new` |
|
||||
| `gbso` | `git bisect old` |
|
||||
| `gbsr` | `git bisect reset` |
|
||||
| `gbss` | `git bisect start` |
|
||||
| `gbl` | `git blame -w` |
|
||||
| `gb` | `git branch` |
|
||||
| `gba` | `git branch --all` |
|
||||
| `gbd` | `git branch --delete` |
|
||||
| `gbD` | `git branch --delete --force` |
|
||||
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
|
||||
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
|
||||
| `gbm` | `git branch --move` |
|
||||
| `gbnm` | `git branch --no-merged` |
|
||||
| `gbr` | `git branch --remote` |
|
||||
| `ggsup` | `git branch --set-upstream-to=origin/$(git_current_branch)` |
|
||||
| `gbg` | `LANG=C git branch -vv \| grep ": gone\]"` |
|
||||
| `gco` | `git checkout` |
|
||||
| `gcor` | `git checkout --recurse-submodules` |
|
||||
| `gcb` | `git checkout -b` |
|
||||
| `gcB` | `git checkout -B` |
|
||||
| `gcd` | `git checkout $(git_develop_branch)` |
|
||||
| `gcm` | `git checkout $(git_main_branch)` |
|
||||
| `gcp` | `git cherry-pick` |
|
||||
| `gcpa` | `git cherry-pick --abort` |
|
||||
| `gcpc` | `git cherry-pick --continue` |
|
||||
| `gclean` | `git clean --interactive -d` |
|
||||
| `gcl` | `git clone --recurse-submodules` |
|
||||
| `gccd` | `git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)"` |
|
||||
| `gcam` | `git commit --all --message` |
|
||||
| `gcas` | `git commit --all --signoff` |
|
||||
| `gcasm` | `git commit --all --signoff --message` |
|
||||
| `gcmsg` | `git commit --message` |
|
||||
| `gcsm` | `git commit --signoff --message` |
|
||||
| `gc` | `git commit --verbose` |
|
||||
| `gca` | `git commit --verbose --all` |
|
||||
| `gca!` | `git commit --verbose --all --amend` |
|
||||
| `gcan!` | `git commit --verbose --all --no-edit --amend` |
|
||||
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
|
||||
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
|
||||
| `gc!` | `git commit --verbose --amend` |
|
||||
| `gcn!` | `git commit --verbose --no-edit --amend` |
|
||||
| `gcs` | `git commit -S` |
|
||||
| `gcss` | `git commit -S -s` |
|
||||
| `gcssm` | `git commit -S -s -m` |
|
||||
| `gcf` | `git config --list` |
|
||||
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
|
||||
| `gd` | `git diff` |
|
||||
| `gdca` | `git diff --cached` |
|
||||
| `gdcw` | `git diff --cached --word-diff` |
|
||||
| `gds` | `git diff --staged` |
|
||||
| `gdw` | `git diff --word-diff` |
|
||||
| `gdv` | `git diff -w "$@" \| view -` |
|
||||
| `gdup` | `git diff @{upstream}` |
|
||||
| `gdnolock` | `git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock"` |
|
||||
| `gdt` | `git diff-tree --no-commit-id --name-only -r` |
|
||||
| `gf` | `git fetch` |
|
||||
| `gfa` | `git fetch --all --prune` |
|
||||
| `gfo` | `git fetch origin` |
|
||||
| `gg` | `git gui citool` |
|
||||
| `gga` | `git gui citool --amend` |
|
||||
| `ghh` | `git help` |
|
||||
| `glgg` | `git log --graph` |
|
||||
| `glgga` | `git log --graph --decorate --all` |
|
||||
| `glgm` | `git log --graph --max-count=10` |
|
||||
| `glod` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'` |
|
||||
| `glods` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short` |
|
||||
| `glol` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'` |
|
||||
| `glola` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all` |
|
||||
| `glols` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat` |
|
||||
| `glo` | `git log --oneline --decorate` |
|
||||
| `glog` | `git log --oneline --decorate --graph` |
|
||||
| `gloga` | `git log --oneline --decorate --graph --all` |
|
||||
| `glp` | `git log --pretty=<format>` |
|
||||
| `glg` | `git log --stat` |
|
||||
| `glgp` | `git log --stat --patch` |
|
||||
| `gignored` | `git ls-files -v \| grep "^[[:lower:]]"` |
|
||||
| `gfg` | `git ls-files \| grep` |
|
||||
| `gm` | `git merge` |
|
||||
| `gma` | `git merge --abort` |
|
||||
| `gmc` | `git merge --continue` |
|
||||
| `gms` | `git merge --squash` |
|
||||
| `gmom` | `git merge origin/$(git_main_branch)` |
|
||||
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
||||
| `gmtl` | `git mergetool --no-prompt` |
|
||||
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
|
||||
| `gl` | `git pull` |
|
||||
| `gpr` | `git pull --rebase` |
|
||||
| `gprv` | `git pull --rebase -v` |
|
||||
| `gpra` | `git pull --rebase --autostash` |
|
||||
| `gprav` | `git pull --rebase --autostash -v` |
|
||||
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
|
||||
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
|
||||
| `ggpull` | `git pull origin "$(git_current_branch)"` |
|
||||
| `ggl` | `git pull origin $(current_branch)` |
|
||||
| `gluc` | `git pull upstream $(git_current_branch)` |
|
||||
| `glum` | `git pull upstream $(git_main_branch)` |
|
||||
| `gp` | `git push` |
|
||||
| `gpd` | `git push --dry-run` |
|
||||
| `gpf!` | `git push --force` |
|
||||
| `ggf` | `git push --force origin $(current_branch)` |
|
||||
| `gpf` | On Git >= 2.30: `git push --force-with-lease --force-if-includes` |
|
||||
| `gpf` | On Git < 2.30: `git push --force-with-lease` |
|
||||
| `ggfl` | `git push --force-with-lease origin $(current_branch)` |
|
||||
| `gpsup` | `git push --set-upstream origin $(git_current_branch)` |
|
||||
| `gpsupf` | On Git >= 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes` |
|
||||
| `gpsupf` | On Git < 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease` |
|
||||
| `gpv` | `git push --verbose` |
|
||||
| `gpoat` | `git push origin --all && git push origin --tags` |
|
||||
| `gpod` | `git push origin --delete` |
|
||||
| `ggpush` | `git push origin "$(git_current_branch)"` |
|
||||
| `ggp` | `git push origin $(current_branch)` |
|
||||
| `gpu` | `git push upstream` |
|
||||
| `grb` | `git rebase` |
|
||||
| `grba` | `git rebase --abort` |
|
||||
| `grbc` | `git rebase --continue` |
|
||||
| `grbi` | `git rebase --interactive` |
|
||||
| `grbo` | `git rebase --onto` |
|
||||
| `grbs` | `git rebase --skip` |
|
||||
| `grbd` | `git rebase $(git_develop_branch)` |
|
||||
| `grbm` | `git rebase $(git_main_branch)` |
|
||||
| `grbom` | `git rebase origin/$(git_main_branch)` |
|
||||
| `grf` | `git reflog` |
|
||||
| `gr` | `git remote` |
|
||||
| `grv` | `git remote --verbose` |
|
||||
| `gra` | `git remote add` |
|
||||
| `grrm` | `git remote remove` |
|
||||
| `grmv` | `git remote rename` |
|
||||
| `grset` | `git remote set-url` |
|
||||
| `grup` | `git remote update` |
|
||||
| `grh` | `git reset` |
|
||||
| `gru` | `git reset --` |
|
||||
| `grhh` | `git reset --hard` |
|
||||
| `grhk` | `git reset --keep` |
|
||||
| `grhs` | `git reset --soft` |
|
||||
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
||||
| `gwipe` | `git reset --hard && git clean --force -df` |
|
||||
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
||||
| `grs` | `git restore` |
|
||||
| `grss` | `git restore --source` |
|
||||
| `grst` | `git restore --staged` |
|
||||
| `gunwip` | `git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1` |
|
||||
| `grev` | `git revert` |
|
||||
| `grm` | `git rm` |
|
||||
| `grmc` | `git rm --cached` |
|
||||
| `gcount` | `git shortlog --summary -n` |
|
||||
| `gsh` | `git show` |
|
||||
| `gsps` | `git show --pretty=short --show-signature` |
|
||||
| `gstall` | `git stash --all` |
|
||||
| `gstu` | `git stash --include-untracked` |
|
||||
| `gstaa` | `git stash apply` |
|
||||
| `gstc` | `git stash clear` |
|
||||
| `gstd` | `git stash drop` |
|
||||
| `gstl` | `git stash list` |
|
||||
| `gstp` | `git stash pop` |
|
||||
| `gsta` | On Git >= 2.13: `git stash push` |
|
||||
| `gsta` | On Git < 2.13: `git stash save` |
|
||||
| `gsts` | `git stash show --patch` |
|
||||
| `gst` | `git status` |
|
||||
| `gss` | `git status --short` |
|
||||
| `gsb` | `git status --short -b` |
|
||||
| `gsi` | `git submodule init` |
|
||||
| `gsu` | `git submodule update` |
|
||||
| `gsd` | `git svn dcommit` |
|
||||
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` |
|
||||
| `gsr` | `git svn rebase` |
|
||||
| `gsw` | `git switch` |
|
||||
| `gswc` | `git switch -c` |
|
||||
| `gswd` | `git switch $(git_develop_branch)` |
|
||||
| `gswm` | `git switch $(git_main_branch)` |
|
||||
| `gta` | `git tag --annotate` |
|
||||
| `gts` | `git tag -s` |
|
||||
| `gtv` | `git tag \| sort -V` |
|
||||
| `gignore` | `git update-index --assume-unchanged` |
|
||||
| `gunignore` | `git update-index --no-assume-unchanged` |
|
||||
| `gwch` | `git whatchanged -p --abbrev-commit --pretty=medium` |
|
||||
| `gwt` | `git worktree` |
|
||||
| `gwtls` | `git worktree list` |
|
||||
| `gwtmv` | `git worktree move` |
|
||||
| `gwtrm` | `git worktree remove` |
|
||||
| `gk` | `gitk --all --branches &!` |
|
||||
| `gke` | `gitk --all $(git log --walk-reflogs --pretty=%h) &!` |
|
||||
| `gtl` | `gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl` |
|
||||
|
||||
### Main branch preference
|
||||
|
||||
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin favors using
|
||||
a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive term `main`. This means
|
||||
that any aliases and functions that previously used `master`, will use `main` if that branch exists. We do this via the
|
||||
function `git_main_branch`.
|
||||
Following the recent push for removing racially-charged words from our technical vocabulary, the git plugin
|
||||
favors using a branch name other than `master`. In this case, we favor the shorter, neutral and descriptive
|
||||
term `main`. This means that any aliases and functions that previously used `master`, will use `main` if that
|
||||
branch exists. We do this via the function `git_main_branch`.
|
||||
|
||||
### Deprecated aliases
|
||||
|
||||
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not, receive further support.
|
||||
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not,
|
||||
receive further support.
|
||||
|
||||
| Alias | Command | Modification |
|
||||
| :----- | :----------------------------------------------------- | :----------------------------------------------------- |
|
||||
| gap | `git add --patch` | new alias `gapa` |
|
||||
| gcl | `git config --list` | new alias `gcf` |
|
||||
| gdc | `git diff --cached` | new alias `gdca` |
|
||||
| gdt | `git difftool` | no replacement |
|
||||
| ggpull | `git pull origin $(current_branch)` | new alias `ggl` (`ggpull` still exists for now though) |
|
||||
| ggpur | `git pull --rebase origin $(current_branch)` | new alias `ggu` (`ggpur` still exists for now though) |
|
||||
| ggpush | `git push origin $(current_branch)` | new alias `ggp` (`ggpush` still exists for now though) |
|
||||
| gk | `gitk --all --branches` | now aliased to `gitk --all --branches` |
|
||||
| glg | `git log --stat --max-count = 10` | now aliased to `git log --stat --color` |
|
||||
| glgg | `git log --graph --max-count = 10` | now aliased to `git log --graph --color` |
|
||||
| gwc | `git whatchanged -p --abbrev-commit --pretty = medium` | new alias `gwch` |
|
||||
| Alias | Command | Modification |
|
||||
| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
|
||||
| `gap` | `git add --patch` | New alias: `gapa`. |
|
||||
| `gcl` | `git config --list` | New alias: `gcf`. |
|
||||
| `gdc` | `git diff --cached` | New alias: `gdca`. |
|
||||
| `gdt` | `git difftool` | No replacement. |
|
||||
| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) |
|
||||
| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) |
|
||||
| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) |
|
||||
| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. |
|
||||
| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
|
||||
| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
|
||||
| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
|
||||
| `gup` | `git pull --rebase` | now alias `gpr` |
|
||||
| `gupv` | `git pull --rebase -v` | now alias `gprv` |
|
||||
| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
|
||||
| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
|
||||
| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
|
||||
| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
|
||||
|
||||
## Functions
|
||||
|
||||
### Current
|
||||
|
||||
| Command | Description |
|
||||
| :--------------------- | :------------------------------------------------------------------------------------------------------- |
|
||||
| `grename <old> <new>` | Rename `old` branch to `new`, including in origin remote |
|
||||
| current_branch | Return the name of the current branch |
|
||||
| git_current_user_name | Returns the `user.name` config value |
|
||||
| git_current_user_email | Returns the `user.email` config value |
|
||||
| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
||||
| git_develop_branch | Returns the name of the develop branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
||||
| Command | Description |
|
||||
| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
|
||||
| `current_branch` | Returns the name of the current branch. |
|
||||
| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
|
||||
| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
|
||||
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
|
||||
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
|
||||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
||||
| `gbda` | Deletes all merged branches |
|
||||
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
||||
|
||||
### Work in Progress (WIP)
|
||||
|
||||
These features allow to pause a branch development and switch to another one (_"Work in Progress"_, or wip). When you want to go back to work, just unwip it.
|
||||
These features allow you to pause developing one branch and switch to another one (_"Work in Progress"_, or
|
||||
“wip”). When you want to go back to work, just “unwip” it.
|
||||
|
||||
| Command | Description |
|
||||
| :--------------- | :---------------------------------------------- |
|
||||
| work_in_progress | Echoes a warning if the current branch is a wip |
|
||||
| gwip | Commit wip branch |
|
||||
| gunwip | Uncommit wip branch |
|
||||
| gunwipall | Uncommit all recent `--wip--` commits |
|
||||
| Command | Description |
|
||||
| :----------------- | :---------------------------------------------- |
|
||||
| `gwip` | Commit wip branch |
|
||||
| `gunwip` | Uncommit wip branch |
|
||||
| `gunwipall` | Uncommit all recent `--wip--` commits |
|
||||
| `work_in_progress` | Echoes a warning if the current branch is a wip |
|
||||
|
||||
Note that `gwip` and `gunwip` are aliases, but are also documented here to group all related WIP features.
|
||||
|
||||
### Deprecated functions
|
||||
|
||||
| Command | Description | Reason |
|
||||
| :----------------- | :-------------------------------------- | :-------------------------------------------------------------- |
|
||||
| current_repository | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias) |
|
||||
| Command | Description | Reason |
|
||||
| :------------------- | :-------------------------------------- | :--------------------------------------------------------------- |
|
||||
| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). |
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ autoload -Uz is-at-least
|
|||
git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
|
||||
|
||||
#
|
||||
# Functions
|
||||
# Functions Current
|
||||
# (sorted alphabetically by function name)
|
||||
# (order should follow README)
|
||||
#
|
||||
|
||||
# The name of the current branch
|
||||
|
|
@ -14,339 +16,37 @@ function current_branch() {
|
|||
git_current_branch
|
||||
}
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
if ! [ -z $1 ]; then
|
||||
git log --pretty=$1
|
||||
fi
|
||||
}
|
||||
compdef _git _git_log_prettily=git-log
|
||||
# Check for develop and similarly named branches
|
||||
function git_develop_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
local branch
|
||||
for branch in dev devel develop development; do
|
||||
if command git show-ref -q --verify refs/heads/$branch; then
|
||||
echo $branch
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
||||
}
|
||||
|
||||
# Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one
|
||||
function gunwipall() {
|
||||
local _commit=$(git log --grep='--wip--' --invert-grep --max-count=1 --format=format:%H)
|
||||
|
||||
# Check if a commit without "--wip--" was found and it's not the same as HEAD
|
||||
if [[ "$_commit" != "$(git rev-parse HEAD)" ]]; then
|
||||
git reset $_commit || return 1
|
||||
fi
|
||||
echo develop
|
||||
return 1
|
||||
}
|
||||
|
||||
# Check if main exists and use instead of master
|
||||
function git_main_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
local ref
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
|
||||
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,master}; do
|
||||
if command git show-ref -q --verify $ref; then
|
||||
echo ${ref:t}
|
||||
return
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# If no main branch was found, fall back to master but return error
|
||||
echo master
|
||||
return 1
|
||||
}
|
||||
|
||||
# Check for develop and similarly named branches
|
||||
function git_develop_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
local branch
|
||||
for branch in dev devel development; do
|
||||
if command git show-ref -q --verify refs/heads/$branch; then
|
||||
echo $branch
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo develop
|
||||
}
|
||||
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
alias g='git'
|
||||
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gapa='git add --patch'
|
||||
alias gau='git add --update'
|
||||
alias gav='git add --verbose'
|
||||
alias gap='git apply'
|
||||
alias gapt='git apply --3way'
|
||||
|
||||
alias gb='git branch'
|
||||
alias gba='git branch --all'
|
||||
alias gbd='git branch --delete'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null'
|
||||
alias gbD='git branch --delete --force'
|
||||
alias gbg='git branch -vv | grep ": gone\]"'
|
||||
alias gbgd='git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
|
||||
alias gbgD='git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
|
||||
alias gbl='git blame -b -w'
|
||||
alias gbnm='git branch --no-merged'
|
||||
alias gbr='git branch --remote'
|
||||
alias gbs='git bisect'
|
||||
alias gbsb='git bisect bad'
|
||||
alias gbsg='git bisect good'
|
||||
alias gbsr='git bisect reset'
|
||||
alias gbss='git bisect start'
|
||||
|
||||
alias gc='git commit --verbose'
|
||||
alias gc!='git commit --verbose --amend'
|
||||
alias gcn!='git commit --verbose --no-edit --amend'
|
||||
alias gca='git commit --verbose --all'
|
||||
alias gca!='git commit --verbose --all --amend'
|
||||
alias gcan!='git commit --verbose --all --no-edit --amend'
|
||||
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
|
||||
alias gcam='git commit --all --message'
|
||||
alias gcsm='git commit --signoff --message'
|
||||
alias gcas='git commit --all --signoff'
|
||||
alias gcasm='git commit --all --signoff --message'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcf='git config --list'
|
||||
|
||||
function gccd() {
|
||||
command git clone --recurse-submodules "$@"
|
||||
[[ -d "$_" ]] && cd "$_" || cd "${${_:t}%.git}"
|
||||
}
|
||||
compdef _git gccd=git-clone
|
||||
|
||||
alias gcl='git clone --recurse-submodules'
|
||||
alias gclean='git clean --interactive -d'
|
||||
alias gpristine='git reset --hard && git clean --force -dfx'
|
||||
alias gcm='git checkout $(git_main_branch)'
|
||||
alias gcd='git checkout $(git_develop_branch)'
|
||||
alias gcmsg='git commit --message'
|
||||
alias gco='git checkout'
|
||||
alias gcor='git checkout --recurse-submodules'
|
||||
alias gcount='git shortlog --summary --numbered'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gcs='git commit --gpg-sign'
|
||||
alias gcss='git commit --gpg-sign --signoff'
|
||||
alias gcssm='git commit --gpg-sign --signoff --message'
|
||||
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdcw='git diff --cached --word-diff'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gds='git diff --staged'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gdup='git diff @{upstream}'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
function gdnolock() {
|
||||
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
|
||||
}
|
||||
compdef _git gdnolock=git-diff
|
||||
|
||||
function gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
|
||||
alias gf='git fetch'
|
||||
# --jobs=<n> was added in git 2.8
|
||||
is-at-least 2.8 "$git_version" \
|
||||
&& alias gfa='git fetch --all --prune --jobs=10' \
|
||||
|| alias gfa='git fetch --all --prune'
|
||||
alias gfo='git fetch origin'
|
||||
|
||||
alias gfg='git ls-files | grep'
|
||||
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
|
||||
function ggf() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
function ggfl() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force-with-lease origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggfl=git-checkout
|
||||
|
||||
function ggl() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
|
||||
function ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-checkout
|
||||
|
||||
function ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
|
||||
function ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
||||
alias ggpur='ggu'
|
||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||
alias ggpush='git push origin "$(git_current_branch)"'
|
||||
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes' \
|
||||
|| alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease'
|
||||
|
||||
alias ghh='git help'
|
||||
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
|
||||
|
||||
alias gk='\gitk --all --branches &!'
|
||||
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||
|
||||
alias gl='git pull'
|
||||
alias glg='git log --stat'
|
||||
alias glgp='git log --stat --patch'
|
||||
alias glgg='git log --graph'
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"
|
||||
alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat"
|
||||
alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
|
||||
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all"
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glp="_git_log_prettily"
|
||||
|
||||
alias gm='git merge'
|
||||
alias gmom='git merge origin/$(git_main_branch)'
|
||||
alias gmtl='git mergetool --no-prompt'
|
||||
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
||||
alias gmum='git merge upstream/$(git_main_branch)'
|
||||
alias gma='git merge --abort'
|
||||
alias gms="git merge --squash"
|
||||
|
||||
alias gp='git push'
|
||||
alias gpd='git push --dry-run'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpf='git push --force-with-lease --force-if-includes' \
|
||||
|| alias gpf='git push --force-with-lease'
|
||||
alias gpf!='git push --force'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
alias gpod='git push origin --delete'
|
||||
alias gpr='git pull --rebase'
|
||||
alias gpu='git push upstream'
|
||||
alias gpv='git push --verbose'
|
||||
|
||||
alias gr='git remote'
|
||||
alias gra='git remote add'
|
||||
alias grb='git rebase'
|
||||
alias grba='git rebase --abort'
|
||||
alias grbc='git rebase --continue'
|
||||
alias grbd='git rebase $(git_develop_branch)'
|
||||
alias grbi='git rebase --interactive'
|
||||
alias grbm='git rebase $(git_main_branch)'
|
||||
alias grbom='git rebase origin/$(git_main_branch)'
|
||||
alias grbo='git rebase --onto'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grev='git revert'
|
||||
alias grh='git reset'
|
||||
alias grhh='git reset --hard'
|
||||
alias groh='git reset origin/$(git_current_branch) --hard'
|
||||
alias grm='git rm'
|
||||
alias grmc='git rm --cached'
|
||||
alias grmv='git remote rename'
|
||||
alias grrm='git remote remove'
|
||||
alias grs='git restore'
|
||||
alias grset='git remote set-url'
|
||||
alias grss='git restore --source'
|
||||
alias grst='git restore --staged'
|
||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
alias gru='git reset --'
|
||||
alias grup='git remote update'
|
||||
alias grv='git remote --verbose'
|
||||
|
||||
alias gsb='git status --short --branch'
|
||||
alias gsd='git svn dcommit'
|
||||
alias gsh='git show'
|
||||
alias gsi='git submodule init'
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
alias gsr='git svn rebase'
|
||||
alias gss='git status --short'
|
||||
alias gst='git status'
|
||||
|
||||
# use the default stash push on git 2.13 and newer
|
||||
is-at-least 2.13 "$git_version" \
|
||||
&& alias gsta='git stash push' \
|
||||
|| alias gsta='git stash save'
|
||||
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
alias gsts='git stash show --text'
|
||||
alias gstu='gsta --include-untracked'
|
||||
alias gstall='git stash --all'
|
||||
alias gsu='git submodule update'
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch --create'
|
||||
alias gswm='git switch $(git_main_branch)'
|
||||
alias gswd='git switch $(git_develop_branch)'
|
||||
|
||||
alias gts='git tag --sign'
|
||||
alias gtv='git tag | sort -V'
|
||||
alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
|
||||
|
||||
alias gunignore='git update-index --no-assume-unchanged'
|
||||
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
|
||||
alias gup='git pull --rebase'
|
||||
alias gupv='git pull --rebase --verbose'
|
||||
alias gupa='git pull --rebase --autostash'
|
||||
alias gupav='git pull --rebase --autostash --verbose'
|
||||
alias gupom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias glum='git pull upstream $(git_main_branch)'
|
||||
alias gluc='git pull upstream $(git_current_branch)'
|
||||
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
|
||||
|
||||
alias gwt='git worktree'
|
||||
alias gwta='git worktree add'
|
||||
alias gwtls='git worktree list'
|
||||
alias gwtmv='git worktree move'
|
||||
alias gwtrm='git worktree remove'
|
||||
|
||||
alias gam='git am'
|
||||
alias gamc='git am --continue'
|
||||
alias gams='git am --skip'
|
||||
alias gama='git am --abort'
|
||||
alias gamscp='git am --show-current-patch'
|
||||
|
||||
function grename() {
|
||||
if [[ -z "$1" || -z "$2" ]]; then
|
||||
echo "Usage: $0 old_branch new_branch"
|
||||
|
|
@ -361,4 +61,363 @@ function grename() {
|
|||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Functions Work in Progress (WIP)
|
||||
# (sorted alphabetically by function name)
|
||||
# (order should follow README)
|
||||
#
|
||||
|
||||
# Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one
|
||||
function gunwipall() {
|
||||
local _commit=$(git log --grep='--wip--' --invert-grep --max-count=1 --format=format:%H)
|
||||
|
||||
# Check if a commit without "--wip--" was found and it's not the same as HEAD
|
||||
if [[ "$_commit" != "$(git rev-parse HEAD)" ]]; then
|
||||
git reset $_commit || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
||||
}
|
||||
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically by command)
|
||||
# (order should follow README)
|
||||
# (in some cases force the alisas order to match README, like for example gke and gk)
|
||||
#
|
||||
|
||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
|
||||
function ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
|
||||
alias ggpur='ggu'
|
||||
alias g='git'
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gapa='git add --patch'
|
||||
alias gau='git add --update'
|
||||
alias gav='git add --verbose'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
|
||||
alias gam='git am'
|
||||
alias gama='git am --abort'
|
||||
alias gamc='git am --continue'
|
||||
alias gamscp='git am --show-current-patch'
|
||||
alias gams='git am --skip'
|
||||
alias gap='git apply'
|
||||
alias gapt='git apply --3way'
|
||||
alias gbs='git bisect'
|
||||
alias gbsb='git bisect bad'
|
||||
alias gbsg='git bisect good'
|
||||
alias gbsn='git bisect new'
|
||||
alias gbso='git bisect old'
|
||||
alias gbsr='git bisect reset'
|
||||
alias gbss='git bisect start'
|
||||
alias gbl='git blame -w'
|
||||
alias gb='git branch'
|
||||
alias gba='git branch --all'
|
||||
alias gbd='git branch --delete'
|
||||
alias gbD='git branch --delete --force'
|
||||
|
||||
function gbda() {
|
||||
git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null
|
||||
}
|
||||
|
||||
# Copied and modified from James Roeder (jmaroeder) under MIT License
|
||||
# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish
|
||||
function gbds() {
|
||||
local default_branch=$(git_main_branch)
|
||||
(( ! $? )) || default_branch=$(git_develop_branch)
|
||||
|
||||
git for-each-ref refs/heads/ "--format=%(refname:short)" | \
|
||||
while read branch; do
|
||||
local merge_base=$(git merge-base $default_branch $branch)
|
||||
if [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch\^{tree}) -p $merge_base -m _)) = -* ]]; then
|
||||
git branch -D $branch
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
|
||||
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
|
||||
alias gbm='git branch --move'
|
||||
alias gbnm='git branch --no-merged'
|
||||
alias gbr='git branch --remote'
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gbg='LANG=C git branch -vv | grep ": gone\]"'
|
||||
alias gco='git checkout'
|
||||
alias gcor='git checkout --recurse-submodules'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcB='git checkout -B'
|
||||
alias gcd='git checkout $(git_develop_branch)'
|
||||
alias gcm='git checkout $(git_main_branch)'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gclean='git clean --interactive -d'
|
||||
alias gcl='git clone --recurse-submodules'
|
||||
|
||||
function gccd() {
|
||||
setopt localoptions extendedglob
|
||||
|
||||
# get repo URI from args based on valid formats: https://git-scm.com/docs/git-clone#URLS
|
||||
local repo="${${@[(r)(ssh://*|git://*|ftp(s)#://*|http(s)#://*|*@*)(.git/#)#]}:-$_}"
|
||||
|
||||
# clone repository and exit if it fails
|
||||
command git clone --recurse-submodules "$@" || return
|
||||
|
||||
# if last arg passed was a directory, that's where the repo was cloned
|
||||
# otherwise parse the repo URI and use the last part as the directory
|
||||
[[ -d "$_" ]] && cd "$_" || cd "${${repo:t}%.git/#}"
|
||||
}
|
||||
compdef _git gccd=git-clone
|
||||
|
||||
alias gcam='git commit --all --message'
|
||||
alias gcas='git commit --all --signoff'
|
||||
alias gcasm='git commit --all --signoff --message'
|
||||
alias gcs='git commit --gpg-sign'
|
||||
alias gcss='git commit --gpg-sign --signoff'
|
||||
alias gcssm='git commit --gpg-sign --signoff --message'
|
||||
alias gcmsg='git commit --message'
|
||||
alias gcsm='git commit --signoff --message'
|
||||
alias gc='git commit --verbose'
|
||||
alias gca='git commit --verbose --all'
|
||||
alias gca!='git commit --verbose --all --amend'
|
||||
alias gcan!='git commit --verbose --all --no-edit --amend'
|
||||
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
|
||||
alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
|
||||
alias gc!='git commit --verbose --amend'
|
||||
alias gcn!='git commit --verbose --no-edit --amend'
|
||||
alias gcf='git config --list'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gd='git diff'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdcw='git diff --cached --word-diff'
|
||||
alias gds='git diff --staged'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
function gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
|
||||
alias gdup='git diff @{upstream}'
|
||||
|
||||
function gdnolock() {
|
||||
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
|
||||
}
|
||||
compdef _git gdnolock=git-diff
|
||||
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gf='git fetch'
|
||||
# --jobs=<n> was added in git 2.8
|
||||
is-at-least 2.8 "$git_version" \
|
||||
&& alias gfa='git fetch --all --prune --jobs=10' \
|
||||
|| alias gfa='git fetch --all --prune'
|
||||
alias gfo='git fetch origin'
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
alias ghh='git help'
|
||||
alias glgg='git log --graph'
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glods='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'
|
||||
alias glod='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'
|
||||
alias glola='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'
|
||||
alias glols='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'
|
||||
alias glol='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
if ! [ -z $1 ]; then
|
||||
git log --pretty=$1
|
||||
fi
|
||||
}
|
||||
compdef _git _git_log_prettily=git-log
|
||||
|
||||
alias glp='_git_log_prettily'
|
||||
alias glg='git log --stat'
|
||||
alias glgp='git log --stat --patch'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias gfg='git ls-files | grep'
|
||||
alias gm='git merge'
|
||||
alias gma='git merge --abort'
|
||||
alias gmc='git merge --continue'
|
||||
alias gms="git merge --squash"
|
||||
alias gmom='git merge origin/$(git_main_branch)'
|
||||
alias gmum='git merge upstream/$(git_main_branch)'
|
||||
alias gmtl='git mergetool --no-prompt'
|
||||
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
||||
|
||||
alias gl='git pull'
|
||||
alias gpr='git pull --rebase'
|
||||
alias gprv='git pull --rebase -v'
|
||||
alias gpra='git pull --rebase --autostash'
|
||||
alias gprav='git pull --rebase --autostash -v'
|
||||
|
||||
function ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
||||
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||
|
||||
function ggl() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
|
||||
alias gluc='git pull upstream $(git_current_branch)'
|
||||
alias glum='git pull upstream $(git_main_branch)'
|
||||
alias gp='git push'
|
||||
alias gpd='git push --dry-run'
|
||||
|
||||
function ggf() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
|
||||
alias gpf!='git push --force'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpf='git push --force-with-lease --force-if-includes' \
|
||||
|| alias gpf='git push --force-with-lease'
|
||||
|
||||
function ggfl() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force-with-lease origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggfl=git-checkout
|
||||
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
is-at-least 2.30 "$git_version" \
|
||||
&& alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes' \
|
||||
|| alias gpsupf='git push --set-upstream origin $(git_current_branch) --force-with-lease'
|
||||
alias gpv='git push --verbose'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
alias gpod='git push origin --delete'
|
||||
alias ggpush='git push origin "$(git_current_branch)"'
|
||||
|
||||
function ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-checkout
|
||||
|
||||
alias gpu='git push upstream'
|
||||
alias grb='git rebase'
|
||||
alias grba='git rebase --abort'
|
||||
alias grbc='git rebase --continue'
|
||||
alias grbi='git rebase --interactive'
|
||||
alias grbo='git rebase --onto'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grbd='git rebase $(git_develop_branch)'
|
||||
alias grbm='git rebase $(git_main_branch)'
|
||||
alias grbom='git rebase origin/$(git_main_branch)'
|
||||
alias grf='git reflog'
|
||||
alias gr='git remote'
|
||||
alias grv='git remote --verbose'
|
||||
alias gra='git remote add'
|
||||
alias grrm='git remote remove'
|
||||
alias grmv='git remote rename'
|
||||
alias grset='git remote set-url'
|
||||
alias grup='git remote update'
|
||||
alias grh='git reset'
|
||||
alias gru='git reset --'
|
||||
alias grhh='git reset --hard'
|
||||
alias grhk='git reset --keep'
|
||||
alias grhs='git reset --soft'
|
||||
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'
|
||||
alias grs='git restore'
|
||||
alias grss='git restore --source'
|
||||
alias grst='git restore --staged'
|
||||
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
|
||||
alias grev='git revert'
|
||||
alias greva='git revert --abort'
|
||||
alias grevc='git revert --continue'
|
||||
alias grm='git rm'
|
||||
alias grmc='git rm --cached'
|
||||
alias gcount='git shortlog --summary --numbered'
|
||||
alias gsh='git show'
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
alias gstall='git stash --all'
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
# use the default stash push on git 2.13 and newer
|
||||
is-at-least 2.13 "$git_version" \
|
||||
&& alias gsta='git stash push' \
|
||||
|| alias gsta='git stash save'
|
||||
alias gsts='git stash show --patch'
|
||||
alias gst='git status'
|
||||
alias gss='git status --short'
|
||||
alias gsb='git status --short --branch'
|
||||
alias gsi='git submodule init'
|
||||
alias gsu='git submodule update'
|
||||
alias gsd='git svn dcommit'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
|
||||
alias gsr='git svn rebase'
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch --create'
|
||||
alias gswd='git switch $(git_develop_branch)'
|
||||
alias gswm='git switch $(git_main_branch)'
|
||||
alias gta='git tag --annotate'
|
||||
alias gts='git tag --sign'
|
||||
alias gtv='git tag | sort -V'
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gunignore='git update-index --no-assume-unchanged'
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwt='git worktree'
|
||||
alias gwta='git worktree add'
|
||||
alias gwtls='git worktree list'
|
||||
alias gwtmv='git worktree move'
|
||||
alias gwtrm='git worktree remove'
|
||||
alias gstu='gsta --include-untracked'
|
||||
alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
|
||||
alias gk='\gitk --all --branches &!'
|
||||
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||
|
||||
unset git_version
|
||||
|
||||
# Logic for adding warnings on deprecated aliases
|
||||
local old_alias new_alias
|
||||
for old_alias new_alias (
|
||||
# TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
|
||||
gup gpr
|
||||
gupv gprv
|
||||
gupa gpra
|
||||
gupav gprav
|
||||
gupom gprom
|
||||
gupomi gpromi
|
||||
); do
|
||||
aliases[$old_alias]="
|
||||
print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
|
||||
$new_alias"
|
||||
done
|
||||
unset old_alias new_alias
|
||||
|
|
|
|||
|
|
@ -7,9 +7,3 @@ To use it, add `gitfast` to the plugins array in your zshrc file:
|
|||
```zsh
|
||||
plugins=(... gitfast)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
An earlier version of the plugin also loaded the git plugin. If you want to keep those
|
||||
aliases enable the [git plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git)
|
||||
as well.
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@
|
|||
#
|
||||
# When set to "1" suggest all options, including options which are
|
||||
# typically hidden (e.g. '--allow-empty' for 'git commit').
|
||||
#
|
||||
# GIT_COMPLETION_IGNORE_CASE
|
||||
#
|
||||
# When set, uses for-each-ref '--ignore-case' to find refs that match
|
||||
# case insensitively, even on systems with case sensitive file systems
|
||||
# (e.g., completing tag name "FOO" on "git checkout f<TAB>").
|
||||
|
||||
# The following functions are meant to modify COMPREPLY, which should not be
|
||||
# modified directly. The purpose is to localize the modifications so it's
|
||||
|
|
@ -320,116 +326,6 @@ else
|
|||
unset $(compgen -v __gitcomp_builtin_)
|
||||
fi
|
||||
|
||||
__gitcomp_builtin_add_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_am_default=" --interactive --3way --quiet --signoff --utf8 --keep --keep-non-patch --message-id --keep-cr --no-keep-cr --scissors --quoted-cr= --whitespace= --ignore-space-change --ignore-whitespace --directory= --exclude= --include= --patch-format= --reject --resolvemsg= --continue --resolved --skip --abort --quit --show-current-patch --allow-empty --committer-date-is-author-date --ignore-date --rerere-autoupdate --gpg-sign --empty= -- --no-interactive --no-3way --no-quiet --no-signoff --no-utf8 --no-keep --no-keep-non-patch --no-message-id --no-scissors --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-directory --no-exclude --no-include --no-patch-format --no-reject --no-resolvemsg --no-committer-date-is-author-date --no-ignore-date --no-rerere-autoupdate --no-gpg-sign"
|
||||
__gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numstat --summary --check --index --intent-to-add --cached --apply --3way --build-fake-ancestor= --whitespace= --ignore-space-change --ignore-whitespace --reverse --unidiff-zero --reject --allow-overlap --verbose --quiet --inaccurate-eof --recount --directory= --allow-empty --add -- --no-stat --no-numstat --no-summary --no-check --no-index --no-intent-to-add --no-cached --no-apply --no-3way --no-build-fake-ancestor --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-reverse --no-unidiff-zero --no-reject --no-allow-overlap --no-verbose --no-quiet --no-inaccurate-eof --no-recount --no-directory --no-allow-empty"
|
||||
__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec"
|
||||
__gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log"
|
||||
__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
|
||||
__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --recurse-submodules --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-recurse-submodules --no-format"
|
||||
__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix"
|
||||
__gitcomp_builtin_cat_file_default=" --allow-unknown-type --batch --batch-check --batch-command --batch-all-objects --buffer --follow-symlinks --unordered --textconv --filters --path= --no-allow-unknown-type -- --no-buffer --no-follow-symlinks --no-unordered --no-path"
|
||||
__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin"
|
||||
__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching"
|
||||
__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin"
|
||||
__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix"
|
||||
__gitcomp_builtin_checkout_index_default=" --all --ignore-skip-worktree-bits --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-ignore-skip-worktree-bits --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
|
||||
__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose"
|
||||
__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits"
|
||||
__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive"
|
||||
__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --also-filter-submodules --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-also-filter-submodules --no-remote-submodules --no-sparse"
|
||||
__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding"
|
||||
__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir"
|
||||
__gitcomp_builtin_config_default=" --global --system --local --worktree --file= --blob= --get --get-all --get-regexp --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section --list --fixed-value --edit --get-color --get-colorbool --type= --bool --int --bool-or-int --bool-or-str --path --expiry-date --null --name-only --includes --show-origin --show-scope --default= --no-global -- --no-system --no-local --no-worktree --no-file --no-blob --no-get --no-get-all --no-get-regexp --no-get-urlmatch --no-replace-all --no-add --no-unset --no-unset-all --no-rename-section --no-remove-section --no-list --no-fixed-value --no-edit --no-get-color --no-get-colorbool --no-type --no-null --no-name-only --no-includes --no-show-origin --no-show-scope --no-default"
|
||||
__gitcomp_builtin_count_objects_default=" --verbose --human-readable --no-verbose -- --no-human-readable"
|
||||
__gitcomp_builtin_credential_cache_default=" --timeout= --socket= --no-timeout -- --no-socket"
|
||||
__gitcomp_builtin_credential_cache__daemon_default=" --debug --no-debug"
|
||||
__gitcomp_builtin_credential_store_default=" --file= --no-file"
|
||||
__gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --first-parent --abbrev --exact-match --candidates= --match= --exclude= --always --dirty --broken --no-contains -- --no-debug --no-all --no-tags --no-long --no-first-parent --no-abbrev --no-exact-match --no-candidates --no-match --no-exclude --no-always --no-dirty --no-broken"
|
||||
__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd"
|
||||
__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code"
|
||||
__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags"
|
||||
__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --refetch --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
|
||||
__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file"
|
||||
__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case"
|
||||
__gitcomp_builtin_for_each_repo_default=" --config= --no-config"
|
||||
__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
|
||||
__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
|
||||
__gitcomp_builtin_fsmonitor__daemon_default=""
|
||||
__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack"
|
||||
__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match"
|
||||
__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path"
|
||||
__gitcomp_builtin_help_default=" --all --external-commands --aliases --man --web --info --verbose --guides --config --no-external-commands -- --no-aliases --no-man --no-web --no-info --no-verbose"
|
||||
__gitcomp_builtin_hook_default=""
|
||||
__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
|
||||
__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
|
||||
__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer"
|
||||
__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse"
|
||||
__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option"
|
||||
__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --object-only --full-name --full-tree --format= --abbrev --no-full-name -- --no-full-tree --no-abbrev"
|
||||
__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff"
|
||||
__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all"
|
||||
__gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet"
|
||||
__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch"
|
||||
__gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir"
|
||||
__gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse"
|
||||
__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --annotate-stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-annotate-stdin --no-undefined --no-always"
|
||||
__gitcomp_builtin_notes_default=" --ref= --no-ref"
|
||||
__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol"
|
||||
__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune"
|
||||
__gitcomp_builtin_pickaxe_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
|
||||
__gitcomp_builtin_prune_default=" --dry-run --verbose --progress --expire= --exclude-promisor-objects --no-dry-run -- --no-verbose --no-progress --no-expire --no-exclude-promisor-objects"
|
||||
__gitcomp_builtin_prune_packed_default=" --dry-run --quiet --no-dry-run -- --no-quiet"
|
||||
__gitcomp_builtin_pull_default=" --verbose --quiet --progress --recurse-submodules --rebase --stat --log --signoff --squash --commit --edit --cleanup= --ff --ff-only --verify --verify-signatures --autostash --strategy= --strategy-option= --gpg-sign --allow-unrelated-histories --all --append --upload-pack= --force --tags --prune --jobs --dry-run --keep --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --show-forced-updates --set-upstream --no-verbose -- --no-quiet --no-progress --no-recurse-submodules --no-rebase --no-stat --no-log --no-signoff --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-verify --no-verify-signatures --no-autostash --no-strategy --no-strategy-option --no-gpg-sign --no-allow-unrelated-histories --no-all --no-append --no-upload-pack --no-force --no-tags --no-prune --no-jobs --no-dry-run --no-keep --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-show-forced-updates --no-set-upstream"
|
||||
__gitcomp_builtin_push_default=" --verbose --quiet --repo= --all --mirror --delete --tags --dry-run --porcelain --force --force-with-lease --force-if-includes --recurse-submodules= --receive-pack= --exec= --set-upstream --progress --prune --no-verify --follow-tags --signed --atomic --push-option= --ipv4 --ipv6 --verify -- --no-verbose --no-quiet --no-repo --no-all --no-mirror --no-delete --no-tags --no-dry-run --no-porcelain --no-force --no-force-with-lease --no-force-if-includes --no-recurse-submodules --no-receive-pack --no-exec --no-set-upstream --no-progress --no-prune --no-follow-tags --no-signed --no-atomic --no-push-option --no-ipv4 --no-ipv6"
|
||||
__gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --notes --left-only --right-only --patch --no-patch --unified --function-context --raw --patch-with-raw --patch-with-stat --numstat --shortstat --dirstat --cumulative --dirstat-by-file --check --summary --name-only --name-status --stat --stat-width= --stat-name-width= --stat-graph-width= --stat-count= --compact-summary --binary --full-index --color --ws-error-highlight= --abbrev --src-prefix= --dst-prefix= --line-prefix= --no-prefix --inter-hunk-context= --output-indicator-new= --output-indicator-old= --output-indicator-context= --break-rewrites --find-renames --irreversible-delete --find-copies --find-copies-harder --no-renames --rename-empty --follow --minimal --ignore-all-space --ignore-space-change --ignore-space-at-eol --ignore-cr-at-eol --ignore-blank-lines --ignore-matching-lines= --indent-heuristic --patience --histogram --diff-algorithm= --anchored= --word-diff --word-diff-regex= --color-words --color-moved --color-moved-ws= --relative --text --exit-code --quiet --ext-diff --textconv --ignore-submodules --submodule --ita-invisible-in-index --ita-visible-in-index --pickaxe-all --pickaxe-regex --rotate-to= --skip-to= --find-object= --diff-filter= --output= --dual-color -- --no-creation-factor --no-notes --no-left-only --no-right-only --no-function-context --no-compact-summary --no-full-index --no-color --no-abbrev --no-find-copies-harder --no-rename-empty --no-follow --no-minimal --no-ignore-matching-lines --no-indent-heuristic --no-color-moved --no-color-moved-ws --no-relative --no-text --no-exit-code --no-quiet --no-ext-diff --no-textconv"
|
||||
__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet"
|
||||
__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks"
|
||||
__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet"
|
||||
__gitcomp_builtin_reflog_default=""
|
||||
__gitcomp_builtin_remote_default=" --verbose --no-verbose"
|
||||
__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx"
|
||||
__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format"
|
||||
__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate"
|
||||
__gitcomp_builtin_reset_default=" --quiet --no-refresh --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --refresh -- --no-quiet --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign"
|
||||
__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_send_pack_default=" --verbose --quiet --receive-pack= --exec= --remote= --all --dry-run --mirror --force --signed --push-option= --progress --thin --atomic --stateless-rpc --stdin --helper-status --force-with-lease --force-if-includes --no-verbose -- --no-quiet --no-receive-pack --no-exec --no-remote --no-all --no-dry-run --no-mirror --no-force --no-signed --no-push-option --no-progress --no-thin --no-atomic --no-stateless-rpc --no-stdin --no-helper-status --no-force-with-lease --no-force-if-includes"
|
||||
__gitcomp_builtin_shortlog_default=" --committer --numbered --summary --email --group= --no-committer -- --no-numbered --no-summary --no-email --no-group"
|
||||
__gitcomp_builtin_show_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_show_branch_default=" --all --remotes --color --more --list --no-name --current --sha1-name --merge-base --independent --topo-order --topics --sparse --date-order --reflog --name -- --no-all --no-remotes --no-color --no-more --no-list --no-current --no-sha1-name --no-merge-base --no-independent --no-topo-order --no-topics --no-sparse --no-date-order"
|
||||
__gitcomp_builtin_show_index_default=" --object-format= --no-object-format"
|
||||
__gitcomp_builtin_show_ref_default=" --tags --heads --verify --head --dereference --hash --abbrev --quiet --exclude-existing --no-tags -- --no-heads --no-verify --no-head --no-dereference --no-hash --no-abbrev --no-quiet"
|
||||
__gitcomp_builtin_sparse_checkout_default=""
|
||||
__gitcomp_builtin_stage_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_stash_default=""
|
||||
__gitcomp_builtin_status_default=" --verbose --short --branch --show-stash --ahead-behind --porcelain --long --null --untracked-files --ignored --ignore-submodules --column --no-renames --find-renames --renames -- --no-verbose --no-short --no-branch --no-show-stash --no-ahead-behind --no-porcelain --no-long --no-null --no-untracked-files --no-ignored --no-ignore-submodules --no-column"
|
||||
__gitcomp_builtin_stripspace_default=" --strip-comments --comment-lines"
|
||||
__gitcomp_builtin_switch_default=" --create= --force-create= --guess --discard-changes --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --no-create -- --no-force-create --no-guess --no-discard-changes --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees"
|
||||
__gitcomp_builtin_symbolic_ref_default=" --quiet --delete --short --no-quiet -- --no-delete --no-short"
|
||||
__gitcomp_builtin_tag_default=" --list --delete --verify --annotate --message= --file= --edit --sign --cleanup= --local-user= --force --create-reflog --column --contains --no-contains --merged --no-merged --sort= --points-at --format= --color --ignore-case -- --no-annotate --no-file --no-edit --no-sign --no-cleanup --no-local-user --no-force --no-create-reflog --no-column --no-sort --no-points-at --no-format --no-color --no-ignore-case"
|
||||
__gitcomp_builtin_update_index_default=" --ignore-submodules --add --replace --remove --unmerged --refresh --really-refresh --cacheinfo --chmod= --assume-unchanged --no-assume-unchanged --skip-worktree --no-skip-worktree --ignore-skip-worktree-entries --info-only --force-remove --stdin --index-info --unresolve --again --ignore-missing --verbose --clear-resolve-undo --index-version= --split-index --untracked-cache --test-untracked-cache --force-untracked-cache --force-write-index --fsmonitor --fsmonitor-valid --no-fsmonitor-valid -- --no-ignore-submodules --no-add --no-replace --no-remove --no-unmerged --no-ignore-skip-worktree-entries --no-info-only --no-force-remove --no-ignore-missing --no-verbose --no-index-version --no-split-index --no-untracked-cache --no-test-untracked-cache --no-force-untracked-cache --no-force-write-index --no-fsmonitor"
|
||||
__gitcomp_builtin_update_ref_default=" --no-deref --stdin --create-reflog --deref -- --no-stdin --no-create-reflog"
|
||||
__gitcomp_builtin_update_server_info_default=" --force --no-force"
|
||||
__gitcomp_builtin_upload_pack_default=" --stateless-rpc --strict --timeout= --no-stateless-rpc -- --no-strict --no-timeout"
|
||||
__gitcomp_builtin_verify_commit_default=" --verbose --raw --no-verbose -- --no-raw"
|
||||
__gitcomp_builtin_verify_pack_default=" --verbose --stat-only --object-format= --no-verbose -- --no-stat-only --no-object-format"
|
||||
__gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose -- --no-raw --no-format"
|
||||
__gitcomp_builtin_version_default=" --build-options --no-build-options"
|
||||
__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix"
|
||||
__gitcomp_builtin_send_email_default="--sender= --from= --smtp-auth= --8bit-encoding= --no-format-patch --no-bcc --no-suppress-from --no-annotate --relogin-delay= --no-cc --no-signed-off-cc --no-signed-off-by-cc --no-chain-reply-to --smtp-debug= --smtp-domain= --chain-reply-to --dry-run --compose --bcc= --smtp-user= --thread --cc-cover --identity= --to= --reply-to= --no-cc-cover --suppress-cc= --to-cmd= --smtp-server= --smtp-ssl-cert-path= --no-thread --smtp-server-option= --quiet --batch-size= --envelope-sender= --smtp-ssl --no-to --validate --format-patch --suppress-from --cc= --compose-encoding= --to-cover --in-reply-to= --annotate --smtp-encryption= --cc-cmd= --smtp-server-port= --smtp-pass= --signed-off-cc --signed-off-by-cc --no-xmailer --subject= --no-to-cover --confirm= --transfer-encoding= --no-smtp-auth --sendmail-cmd= --no-validate --no-identity --dump-aliases --xmailer --force --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
|
||||
__gitcomp_builtin_get_default ()
|
||||
{
|
||||
eval "test -n \"\$${1}_default\" && echo \"\$${1}_default\""
|
||||
}
|
||||
|
||||
# This function is equivalent to
|
||||
#
|
||||
# __gitcomp_opts "$(git xxx --git-completion-helper) ..."
|
||||
|
|
@ -457,11 +353,9 @@ __gitcomp_builtin ()
|
|||
else
|
||||
completion_helper="--git-completion-helper"
|
||||
fi
|
||||
completion="$(__git ${cmd/_/ } $completion_helper ||
|
||||
__gitcomp_builtin_get_default $var)" || return
|
||||
# leading and trailing spaces are significant to make
|
||||
# option removal work correctly.
|
||||
options=" $incl $completion "
|
||||
options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return
|
||||
|
||||
for i in $excl; do
|
||||
options="${options/ $i / }"
|
||||
|
|
@ -604,6 +498,7 @@ __git_heads ()
|
|||
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
|
||||
|
||||
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"refs/heads/$cur_*" "refs/heads/$cur_*/**"
|
||||
}
|
||||
|
||||
|
|
@ -617,6 +512,7 @@ __git_remote_heads ()
|
|||
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
|
||||
|
||||
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"refs/remotes/$cur_*" "refs/remotes/$cur_*/**"
|
||||
}
|
||||
|
||||
|
|
@ -627,6 +523,7 @@ __git_tags ()
|
|||
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
|
||||
|
||||
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"refs/tags/$cur_*" "refs/tags/$cur_*/**"
|
||||
}
|
||||
|
||||
|
|
@ -646,6 +543,7 @@ __git_dwim_remote_heads ()
|
|||
# but only output if the branch name is unique
|
||||
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
|
||||
--sort="refname:strip=3" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \
|
||||
uniq -u
|
||||
}
|
||||
|
|
@ -670,6 +568,7 @@ __git_refs ()
|
|||
local format refs
|
||||
local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
|
||||
local match="${4-}"
|
||||
local umatch="${4-}"
|
||||
local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
|
||||
|
||||
__git_find_repo_path
|
||||
|
|
@ -693,12 +592,19 @@ __git_refs ()
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "${GIT_COMPLETION_IGNORE_CASE:+1}" = "1"
|
||||
then
|
||||
# uppercase with tr instead of ${match,^^} for bash 3.2 compatibility
|
||||
umatch=$(echo "$match" | tr a-z A-Z 2>/dev/null || echo "$match")
|
||||
fi
|
||||
|
||||
if [ "$list_refs_from" = path ]; then
|
||||
if [[ "$cur_" == ^* ]]; then
|
||||
pfx="$pfx^"
|
||||
fer_pfx="$fer_pfx^"
|
||||
cur_=${cur_#^}
|
||||
match=${match#^}
|
||||
umatch=${umatch#^}
|
||||
fi
|
||||
case "$cur_" in
|
||||
refs|refs/*)
|
||||
|
|
@ -709,7 +615,7 @@ __git_refs ()
|
|||
*)
|
||||
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do
|
||||
case "$i" in
|
||||
$match*)
|
||||
$match*|$umatch*)
|
||||
if [ -e "$dir/$i" ]; then
|
||||
echo "$pfx$i$sfx"
|
||||
fi
|
||||
|
|
@ -723,6 +629,7 @@ __git_refs ()
|
|||
;;
|
||||
esac
|
||||
__git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"${refs[@]}"
|
||||
if [ -n "$track" ]; then
|
||||
__git_dwim_remote_heads "$pfx" "$match" "$sfx"
|
||||
|
|
@ -742,15 +649,16 @@ __git_refs ()
|
|||
*)
|
||||
if [ "$list_refs_from" = remote ]; then
|
||||
case "HEAD" in
|
||||
$match*) echo "${pfx}HEAD$sfx" ;;
|
||||
$match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
|
||||
esac
|
||||
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
|
||||
${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
|
||||
"refs/remotes/$remote/$match*" \
|
||||
"refs/remotes/$remote/$match*/**"
|
||||
else
|
||||
local query_symref
|
||||
case "HEAD" in
|
||||
$match*) query_symref="HEAD" ;;
|
||||
$match*|$umatch*) query_symref="HEAD" ;;
|
||||
esac
|
||||
__git ls-remote "$remote" $query_symref \
|
||||
"refs/tags/$match*" "refs/heads/$match*" \
|
||||
|
|
@ -888,7 +796,6 @@ __git_list_merge_strategies ()
|
|||
}'
|
||||
}
|
||||
|
||||
__git_merge_strategies_default='octopus ours recursive resolve subtree'
|
||||
__git_merge_strategies=
|
||||
# 'git merge -s help' (and thus detection of the merge strategy
|
||||
# list) fails, unfortunately, if run outside of any git working
|
||||
|
|
@ -898,8 +805,7 @@ __git_merge_strategies=
|
|||
__git_compute_merge_strategies ()
|
||||
{
|
||||
test -n "$__git_merge_strategies" ||
|
||||
{ __git_merge_strategies=$(__git_list_merge_strategies);
|
||||
__git_merge_strategies="${__git_merge_strategies:-__git_merge_strategies_default}"; }
|
||||
__git_merge_strategies=$(__git_list_merge_strategies)
|
||||
}
|
||||
|
||||
__git_merge_strategy_options="ours theirs subtree subtree= patience
|
||||
|
|
@ -2281,7 +2187,7 @@ _git_reflog ()
|
|||
fi
|
||||
}
|
||||
|
||||
__git_send_email_options="--no-cc-cover --cc= --no-bcc --force --relogin-delay= --to= --suppress-cc= --no-annotate --no-chain-reply-to --sendmail-cmd= --no-identity --transfer-encoding= --validate --no-smtp-auth --confirm= --no-format-patch --reply-to= --smtp-pass= --smtp-server= --annotate --envelope-sender= --no-validate --dry-run --no-thread --smtp-debug= --no-to --thread --no-xmailer --identity= --no-signed-off-cc --no-signed-off-by-cc --smtp-domain= --to-cover --8bit-encoding= --bcc= --smtp-ssl-cert-path= --smtp-user= --cc-cmd= --to-cmd= --no-cc --smtp-server-option= --in-reply-to= --subject= --batch-size= --smtp-auth= --compose --smtp-server-port= --xmailer --no-to-cover --chain-reply-to --smtp-encryption= --dump-aliases --quiet --smtp-ssl --signed-off-cc --signed-off-by-cc --suppress-from --compose-encoding= --no-suppress-from --sender= --from= --format-patch --cc-cover --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
__gitcomp_builtin_send_email_default="--8bit-encoding= --add-header= --annotate --attach --base= --batch-size= --bcc= --binary --cc-cmd= --cc-cover --cc= --chain-reply-to --compose --compose-encoding= --confirm= --cover-from-description= --cover-letter --creation-factor= --dry-run --dump-aliases --envelope-sender= --filename-max-length= --force --force-in-body-from --format-patch --from --from= --identity= --ignore-if-in-upstream --in-reply-to= --inline --interdiff= --keep-subject --numbered --numbered-files --output-directory= --progress --quiet --range-diff= --relogin-delay= --reply-to= --reroll-count= --rfc --sender= --sendmail-cmd= --signature-file= --signature= --signed-off-by-cc --signed-off-cc --signoff --smtp-auth= --smtp-debug= --smtp-domain= --smtp-encryption= --smtp-pass= --smtp-server-option= --smtp-server-port= --smtp-server= --smtp-ssl --smtp-ssl-cert-path= --smtp-user= --start-number= --stdout --subject-prefix= --subject= --suffix= --suppress-cc= --suppress-from --thread --to-cmd= --to-cover --to= --transfer-encoding= --v= --validate --xmailer --zero-commit -- --no-add-header --no-annotate --no-attach --no-base --no-bcc --no-binary --no-cc --no-cc-cover --no-chain-reply-to --no-cover-from-description --no-cover-letter --no-creation-factor --no-filename-max-length --no-force-in-body-from --no-format-patch --no-from --no-identity --no-ignore-if-in-upstream --no-in-reply-to --no-interdiff --no-numbered --no-numbered-files --no-progress --no-quiet --no-range-diff --no-reroll-count --no-signature --no-signature-file --no-signed-off-by-cc --no-signed-off-cc --no-signoff --no-smtp-auth --no-start-number --no-stat --no-stdout --no-suffix --no-suppress-from --no-thread --no-to --no-to-cover --no-validate --no-xmailer --no-zero-commit"
|
||||
__git_send_email_confirm_options="always never auto cc compose"
|
||||
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
|
||||
|
||||
|
|
@ -2321,7 +2227,11 @@ _git_send_email ()
|
|||
return
|
||||
;;
|
||||
--*)
|
||||
__gitcomp_builtin send-email "$__git_send_email_options $__git_format_patch_extra_options"
|
||||
# Older versions of git send-email don't have all the options
|
||||
git send-email --git-completion-helper | grep -q annotate ||
|
||||
__gitcomp_builtin_send_email=$__gitcomp_builtin_send_email_default
|
||||
|
||||
__gitcomp_builtin send-email "$__git_format_patch_extra_options"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
|
@ -2456,7 +2366,25 @@ __git_config_vars=
|
|||
__git_compute_config_vars ()
|
||||
{
|
||||
test -n "$__git_config_vars" ||
|
||||
__git_config_vars="$(git help --config-for-completion | sort -u)"
|
||||
__git_config_vars="$(git help --config-for-completion)"
|
||||
}
|
||||
|
||||
__git_compute_config_sections_old ()
|
||||
{
|
||||
__git_compute_config_vars
|
||||
echo "$__git_config_vars" |
|
||||
awk -F . '{ dict[$1] = 1 } END { for (e in dict) print e }'
|
||||
}
|
||||
|
||||
__git_config_sections=
|
||||
__git_compute_config_sections ()
|
||||
{
|
||||
test -n "$__git_config_sections" ||
|
||||
__git_config_sections="$(
|
||||
git help --config-sections-for-completion > /dev/null 2>&1 &&
|
||||
git help --config-sections-for-completion ||
|
||||
__git_compute_config_sections_old
|
||||
)"
|
||||
}
|
||||
|
||||
# Completes possible values of various configuration variables.
|
||||
|
|
@ -2670,16 +2598,8 @@ __git_complete_config_variable_name ()
|
|||
__gitcomp "$__git_config_vars" "" "$cur_" "$sfx"
|
||||
;;
|
||||
*)
|
||||
__git_compute_config_vars
|
||||
__gitcomp_nl "$(echo "$__git_config_vars" |
|
||||
awk -F . '{
|
||||
sections[$1] = 1
|
||||
}
|
||||
END {
|
||||
for (s in sections)
|
||||
print s "."
|
||||
}
|
||||
')" "" "$cur_" ""
|
||||
__git_compute_config_sections
|
||||
__gitcomp_nl "$__git_config_sections" "" "$cur_" "."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -3628,43 +3548,6 @@ __git_complete ()
|
|||
___git_complete $1 $func
|
||||
}
|
||||
|
||||
if ! git --list-cmds=main >/dev/null 2>&1; then
|
||||
|
||||
declare -A __git_cmds
|
||||
__git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged"
|
||||
__git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows"
|
||||
__git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk"
|
||||
__git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc get-tar-commit-id grep gui gui--askpass hash-object help hook http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers legacy-rebase legacy-stash log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase rebase--helper receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack serve sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
|
||||
__git_cmds[others]=""
|
||||
__git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc grep hash-object help hook init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
|
||||
|
||||
# Override __git
|
||||
__git ()
|
||||
{
|
||||
case "$1" in
|
||||
--list-cmds=*)
|
||||
while read -r -d ',' x; do
|
||||
case "$x" in
|
||||
nohelpers)
|
||||
;;
|
||||
alias)
|
||||
;;
|
||||
config)
|
||||
;;
|
||||
*)
|
||||
echo ${__git_cmds[$x]}
|
||||
;;
|
||||
esac
|
||||
done <<< "${1##--list-cmds=},"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
git ${__git_C_args:+"${__git_C_args[@]}"} \
|
||||
${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
|
||||
}
|
||||
|
||||
fi
|
||||
|
||||
___git_complete git __git_main
|
||||
___git_complete gitk __gitk_main
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@
|
|||
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
|
||||
# by setting GIT_PS1_OMITSPARSESTATE.
|
||||
#
|
||||
# If you would like to see a notification on the prompt when there are
|
||||
# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
|
||||
# prompt will include "|CONFLICT".
|
||||
#
|
||||
# If you would like to see more information about the identity of
|
||||
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
|
||||
# to one of these values:
|
||||
|
|
@ -96,9 +100,7 @@
|
|||
#
|
||||
# If you would like a colored hint about the current dirty state, set
|
||||
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
|
||||
# the colored output of "git status -sb" and are available only when
|
||||
# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
|
||||
# but always available in Zsh.
|
||||
# the colored output of "git status -sb".
|
||||
#
|
||||
# If you would like __git_ps1 to do nothing in the case when the current
|
||||
# directory is set up to be ignored by git, then set
|
||||
|
|
@ -255,12 +257,12 @@ __git_ps1_colorize_gitstring ()
|
|||
local c_lblue='%F{blue}'
|
||||
local c_clear='%f'
|
||||
else
|
||||
# Using \[ and \] around colors is necessary to prevent
|
||||
# Using \001 and \002 around colors is necessary to prevent
|
||||
# issues with command line editing/browsing/completion!
|
||||
local c_red='\[\e[31m\]'
|
||||
local c_green='\[\e[32m\]'
|
||||
local c_lblue='\[\e[1;34m\]'
|
||||
local c_clear='\[\e[0m\]'
|
||||
local c_red=$'\001\e[31m\002'
|
||||
local c_green=$'\001\e[32m\002'
|
||||
local c_lblue=$'\001\e[1;34m\002'
|
||||
local c_clear=$'\001\e[0m\002'
|
||||
fi
|
||||
local bad_color=$c_red
|
||||
local ok_color=$c_green
|
||||
|
|
@ -508,6 +510,12 @@ __git_ps1 ()
|
|||
r="$r $step/$total"
|
||||
fi
|
||||
|
||||
local conflict="" # state indicator for unresolved conflicts
|
||||
if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
|
||||
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
|
||||
conflict="|CONFLICT"
|
||||
fi
|
||||
|
||||
local w=""
|
||||
local i=""
|
||||
local s=""
|
||||
|
|
@ -564,15 +572,12 @@ __git_ps1 ()
|
|||
b="\${__git_ps1_branch_name}"
|
||||
fi
|
||||
|
||||
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
|
||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
|
||||
__git_ps1_colorize_gitstring
|
||||
fi
|
||||
__git_ps1_colorize_gitstring
|
||||
fi
|
||||
|
||||
local f="$h$w$i$s$u$p"
|
||||
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
|
||||
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
|
||||
|
||||
if [ $pcmode = yes ]; then
|
||||
if [ "${__git_printf_supports_v-}" != yes ]; then
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Handle $0 according to the standard:
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
source "${0:A:h}/git-prompt.sh"
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
url="https://raw.githubusercontent.com/felipec/git-completion"
|
||||
version="1.3.7"
|
||||
|
||||
curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
|
||||
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
|
||||
curl -s -o git-prompt.sh "${url}/v${version}/git-prompt.sh"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# gitignore
|
||||
|
||||
This plugin enables you the use of [gitignore.io](https://www.gitignore.io/) from the command line. You need an active internet connection.
|
||||
This plugin enables you the use of [gitignore.io](https://www.toptal.com/developers/gitignore) from the command line. You need an active internet connection.
|
||||
|
||||
To use it, add `gitignore` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
function gi() { curl -fLw '\n' https://www.gitignore.io/api/"${(j:,:)@}" }
|
||||
function gi() { curl -fLw '\n' https://www.toptal.com/developers/gitignore/api/"${(j:,:)@}" }
|
||||
|
||||
_gitignoreio_get_command_list() {
|
||||
curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
|
||||
curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr "," "\n"
|
||||
}
|
||||
|
||||
_gitignoreio () {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ __gnu_utils() {
|
|||
local -a gcmds
|
||||
local gcmd
|
||||
|
||||
# coreutils
|
||||
# coreutils
|
||||
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
|
||||
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
|
||||
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
|
||||
|
|
@ -41,7 +41,7 @@ __gnu_utils() {
|
|||
for gcmd in "${gcmds[@]}"; do
|
||||
# Do nothing if the command isn't found
|
||||
(( ${+commands[$gcmd]} )) || continue
|
||||
|
||||
|
||||
# This method allows for builtin commands to be primary but it's
|
||||
# lost if hash -r or rehash is executed, or if $PATH is updated.
|
||||
# Thus, a preexec hook is needed, which will only run if whoami
|
||||
|
|
|
|||
19
plugins/gradle/LICENSE
Normal file
19
plugins/gradle/LICENSE
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2017 Eric Wendelin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -1,28 +1,4 @@
|
|||
#compdef gradle gradlew gw
|
||||
# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
|
||||
|
||||
#
|
||||
# Taken from https://github.com/gradle/gradle-completion
|
||||
# Copyright (c) 2017 Eric Wendelin
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
# this software and associated documentation files (the "Software"), to deal in
|
||||
# the Software without restriction, including without limitation the rights to
|
||||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
# of the Software, and to permit persons to whom the Software is furnished to do
|
||||
# so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# Terms
|
||||
|
||||
__gradle-set-project-root-dir() {
|
||||
local dir=`pwd`
|
||||
|
|
@ -38,7 +14,7 @@ __gradle-set-project-root-dir() {
|
|||
}
|
||||
|
||||
__gradle-init-cache-dir() {
|
||||
cache_dir="$HOME/.gradle/completion"
|
||||
cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
|
||||
mkdir -p $cache_dir
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +74,7 @@ __gradle-generate-script-cache() {
|
|||
zle -R "Generating Gradle build script cache"
|
||||
# Cache all Gradle scripts
|
||||
local -a gradle_build_scripts
|
||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
|
||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
|
||||
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
||||
fi
|
||||
}
|
||||
|
|
@ -125,7 +101,7 @@ __gradle-generate-tasks-cache() {
|
|||
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
|
||||
local -a match
|
||||
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
|
||||
if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
||||
if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
|
||||
local task_name="${match[1]}"
|
||||
local task_description="${match[3]}"
|
||||
# Completion for subproject tasks with ':' prefix
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ function gradle-or-gradlew() {
|
|||
# taken from https://github.com/gradle/gradle-completion
|
||||
local dir="$PWD" project_root="$PWD"
|
||||
while [[ "$dir" != / ]]; do
|
||||
if [[ -f "$dir/settings.gradle" || -f "$dir/settings.gradle.kts" || -f "$dir/gradlew" ]]; then
|
||||
if [[ -x "$dir/gradlew" ]]; then
|
||||
project_root="$dir"
|
||||
break
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ _enumerateGrailsScripts() {
|
|||
then
|
||||
directories+=(plugins/*/scripts)
|
||||
fi
|
||||
|
||||
|
||||
# Enumerate all of the Groovy files
|
||||
files=()
|
||||
for dir in $directories;
|
||||
|
|
@ -17,13 +17,13 @@ _enumerateGrailsScripts() {
|
|||
files+=($dir/[^_]*.groovy)
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Don't try to basename ()
|
||||
if [ ${#files} -eq 0 ];
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
scripts=()
|
||||
for file in $files
|
||||
do
|
||||
|
|
@ -42,19 +42,19 @@ _enumerateGrailsScripts() {
|
|||
done
|
||||
echo $scripts
|
||||
}
|
||||
|
||||
|
||||
_grails() {
|
||||
if (( CURRENT == 2 )); then
|
||||
scripts=( $(_enumerateGrailsScripts) )
|
||||
|
||||
|
||||
if [ ${#scripts} -ne 0 ];
|
||||
then
|
||||
_multi_parts / scripts
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
_files
|
||||
}
|
||||
|
||||
|
||||
compdef _grails grails
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
# common grc.zsh paths
|
||||
files=(
|
||||
/etc/grc.zsh # default
|
||||
/usr/local/etc/grc.zsh # homebrew
|
||||
/etc/grc.zsh # default
|
||||
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
||||
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
||||
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
|
||||
)
|
||||
|
||||
# verify the file is readable and source it
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@ plugins=(... helm)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Full command |
|
||||
| ----- | ------------ |
|
||||
| h | helm |
|
||||
| hin | helm install |
|
||||
| hse | helm search |
|
||||
| hup | helm upgrade |
|
||||
| Alias | Full command |
|
||||
| ----- | -------------- |
|
||||
| h | helm |
|
||||
| hin | helm install |
|
||||
| hun | helm uninstall |
|
||||
| hse | helm search |
|
||||
| hup | helm upgrade |
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@ fi
|
|||
|
||||
alias h='helm'
|
||||
alias hin='helm install'
|
||||
alias hun='helm uninstall'
|
||||
alias hse='helm search'
|
||||
alias hup='helm upgrade'
|
||||
|
|
|
|||
|
|
@ -23,7 +23,15 @@ Install
|
|||
Using the [Homebrew]( https://brew.sh ) package manager:
|
||||
|
||||
brew install zsh-history-substring-search
|
||||
echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
|
||||
echo 'source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
|
||||
|
||||
Using [Fig](https://fig.io):
|
||||
|
||||
Fig adds apps, shortcuts, and autocomplete to your existing terminal.
|
||||
|
||||
Install `zsh-history-substring-search` in just one click.
|
||||
|
||||
<a href="https://fig.io/plugins/other/zsh-history-substring-search" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>
|
||||
|
||||
Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
|
||||
|
||||
|
|
@ -33,24 +41,63 @@ Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
|
|||
|
||||
2. Activate the plugin in `~/.zshrc`:
|
||||
|
||||
plugins=( [plugins...] history-substring-search)
|
||||
plugins=( [plugins...] zsh-history-substring-search)
|
||||
|
||||
3. Source `~/.zshrc` to take changes into account:
|
||||
3. Run `exec zsh` to take changes into account:
|
||||
|
||||
source ~/.zshrc
|
||||
exec zsh
|
||||
|
||||
Using [zplug](https://github.com/zplug/zplug):
|
||||
|
||||
1. Add this repo to `~/.zshrc`:
|
||||
|
||||
zplug "zsh-users/zsh-history-substring-search", as: plugin
|
||||
|
||||
Using [antigen](https://github.com/zsh-users/antigen):
|
||||
|
||||
1. Add the `antigen bundle` command just before `antigen apply`, like this:
|
||||
|
||||
```
|
||||
antigen bundle zsh-users/zsh-history-substring-search
|
||||
antigen apply
|
||||
```
|
||||
|
||||
2. Then, **after** `antigen apply`, add the key binding configurations, like this:
|
||||
|
||||
```
|
||||
# zsh-history-substring-search configuration
|
||||
bindkey '^[[A' history-substring-search-up # or '\eOA'
|
||||
bindkey '^[[B' history-substring-search-down # or '\eOB'
|
||||
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
|
||||
```
|
||||
|
||||
Using [Zinit](https://github.com/zdharma-continuum/zinit):
|
||||
|
||||
1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
|
||||
|
||||
zinit snippet OMZ::plugins/git/git.plugin.zsh`
|
||||
|
||||
2. Load the plugin in `~/.zshrc`:
|
||||
|
||||
zinit load 'zsh-users/zsh-history-substring-search
|
||||
zinit ice wait atload'_history_substring_search_config'
|
||||
|
||||
3. Run `exec zsh` to take changes into account:
|
||||
|
||||
exec zsh
|
||||
|
||||
Usage
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
1. Load this script into your interactive ZSH session:
|
||||
|
||||
% source zsh-history-substring-search.zsh
|
||||
source zsh-history-substring-search.zsh
|
||||
|
||||
If you want to use [zsh-syntax-highlighting][6] along with this script,
|
||||
then make sure that you load it *before* you load this script:
|
||||
|
||||
% source zsh-syntax-highlighting.zsh
|
||||
% source zsh-history-substring-search.zsh
|
||||
source zsh-syntax-highlighting.zsh
|
||||
source zsh-history-substring-search.zsh
|
||||
|
||||
2. Bind keyboard shortcuts to this script's functions.
|
||||
|
||||
|
|
@ -73,6 +120,10 @@ Usage
|
|||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
|
||||
Users have also observed that `[OA` and `[OB` are correct values,
|
||||
_even if_ these were not the observed values. If you are having trouble
|
||||
with the observed values, give these a try.
|
||||
|
||||
You might also want to bind the Control-P/N keys for use in EMACS mode:
|
||||
|
||||
bindkey -M emacs '^P' history-substring-search-up
|
||||
|
|
@ -115,7 +166,7 @@ Configuration
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
This script defines the following global variables. You may override their
|
||||
default values only after having loaded this script into your ZSH session.
|
||||
default values.
|
||||
|
||||
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
|
||||
how the query should be highlighted inside a matching command. Its default
|
||||
|
|
@ -141,6 +192,12 @@ default values only after having loaded this script into your ZSH session.
|
|||
value, causes this script to perform a fuzzy search by words, matching in
|
||||
given order e.g. `ab c` will match `*ab*c*`
|
||||
|
||||
* `HISTORY_SUBSTRING_SEARCH_PREFIXED` is a global variable that defines how
|
||||
the command history will be searched for your query. If set to a non-empty
|
||||
value, your query will be matched against the start of each history entry.
|
||||
For example, if this variable is empty, `ls` will match `ls -l` and `echo
|
||||
ls`; if it is non-empty, `ls` will only match `ls -l`.
|
||||
|
||||
* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
|
||||
whether all search results returned are _unique_. If set to a non-empty
|
||||
value, then only unique search results are presented. This behaviour is off
|
||||
|
|
@ -155,6 +212,9 @@ default values only after having loaded this script into your ZSH session.
|
|||
receive globally unique search results only once, then use this
|
||||
configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
|
||||
|
||||
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT` is a global variable that
|
||||
defines a timeout in seconds for clearing the search highlight.
|
||||
|
||||
|
||||
History
|
||||
------------------------------------------------------------------------------
|
||||
|
|
@ -175,24 +235,17 @@ History
|
|||
|
||||
* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Oh My Zsh Distribution Notes
|
||||
------------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
|
||||
as an OMZ module inside the Oh My Zsh distribution.
|
||||
## Oh My Zsh Distribution Notes
|
||||
|
||||
The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
|
||||
What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search as an OMZ module inside
|
||||
the Oh My Zsh distribution.
|
||||
|
||||
The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
|
||||
https://github.com/zsh-users/zsh-history-substring-search.
|
||||
|
||||
This downstream copy was last updated from the following upstream commit:
|
||||
|
||||
SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
|
||||
Commit date: 2019-05-12 17:35:54 -0700
|
||||
|
||||
Everything above this section is a copy of the original upstream's README, so things
|
||||
may differ slightly when you're using this inside OMZ. In particular, you do not
|
||||
need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
|
||||
plugin does that for you. You may still want to set up additional emacs- or vi-specific
|
||||
bindings as mentioned above.
|
||||
|
||||
Everything above this section is a copy of the original upstream's README, so things may differ slightly when
|
||||
you're using this inside OMZ. In particular, you do not need to set up key bindings for the up and down arrows
|
||||
yourself in `~/.zshrc`; the OMZ plugin does that for you. You may still want to set up additional emacs- or
|
||||
vi-specific bindings as mentioned above.
|
||||
|
|
|
|||
15
plugins/history-substring-search/dependencies/OMZ-README.md
Normal file
15
plugins/history-substring-search/dependencies/OMZ-README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
---
|
||||
|
||||
## Oh My Zsh Distribution Notes
|
||||
|
||||
What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search as an OMZ module inside
|
||||
the Oh My Zsh distribution.
|
||||
|
||||
The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
|
||||
https://github.com/zsh-users/zsh-history-substring-search.
|
||||
|
||||
Everything above this section is a copy of the original upstream's README, so things may differ slightly when
|
||||
you're using this inside OMZ. In particular, you do not need to set up key bindings for the up and down arrows
|
||||
yourself in `~/.zshrc`; the OMZ plugin does that for you. You may still want to set up additional emacs- or
|
||||
vi-specific bindings as mentioned above.
|
||||
|
|
@ -43,11 +43,12 @@
|
|||
# declare global configuration variables
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
|
||||
typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
|
||||
typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
|
||||
typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
|
||||
typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
|
||||
: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_FUZZY=''}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_PREFIXED=''}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# declare internal global variables
|
||||
|
|
@ -64,6 +65,7 @@ typeset -g -i _history_substring_search_raw_match_index
|
|||
typeset -g -a _history_substring_search_matches
|
||||
typeset -g -i _history_substring_search_match_index
|
||||
typeset -g -A _history_substring_search_unique_filter
|
||||
typeset -g -i _history_substring_search_zsh_5_9
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# the main ZLE widgets
|
||||
|
|
@ -97,6 +99,11 @@ zle -N history-substring-search-down
|
|||
#-----------------------------------------------------------------------------
|
||||
|
||||
zmodload -F zsh/parameter
|
||||
autoload -Uz is-at-least
|
||||
|
||||
if is-at-least 5.9 $ZSH_VERSION; then
|
||||
_history_substring_search_zsh_5_9=1
|
||||
fi
|
||||
|
||||
#
|
||||
# We have to "override" some keys and widgets if the
|
||||
|
|
@ -117,80 +124,125 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
|
|||
}
|
||||
|
||||
#
|
||||
# The following snippet was taken from the zsh-syntax-highlighting project:
|
||||
# Check if $1 denotes the name of a callable function, i.e. it is fully
|
||||
# defined or it is marked for autoloading and autoloading it at the first
|
||||
# call to it will succeed. In particular, if $1 has been marked for
|
||||
# autoloading but is not available in $fpath, then it will return 1 (false).
|
||||
#
|
||||
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161
|
||||
# This is based on the zsh-syntax-highlighting plugin.
|
||||
#
|
||||
# Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
|
||||
# All rights reserved.
|
||||
_history-substring-search-function-callable() {
|
||||
if (( ${+functions[$1]} )) && ! [[ "$functions[$1]" == *"builtin autoload -X"* ]]; then
|
||||
return 0 # already fully loaded
|
||||
else
|
||||
# "$1" is either an autoload stub, or not a function at all.
|
||||
# We expect 'autoload +X' to return non-zero if it fails to fully load
|
||||
# the function.
|
||||
( autoload -U +X -- "$1" 2>/dev/null )
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
# The zsh-syntax-highlighting plugin uses zle-line-pre-redraw hook instead
|
||||
# of the legacy "bind all widgets" if 1) zsh has the memo= feature (added in
|
||||
# version 5.9) and 2) add-zle-hook-widget is available.
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of the zsh-syntax-highlighting contributors nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#--------------8<-------------------8<-------------------8<-----------------
|
||||
# Rebind all ZLE widgets to make them invoke _zsh_highlights.
|
||||
_zsh_highlight_bind_widgets()
|
||||
{
|
||||
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
|
||||
zmodload zsh/zleparameter 2>/dev/null || {
|
||||
echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
|
||||
return 1
|
||||
if [[ $_history_substring_search_zsh_5_9 -eq 1 ]] && _history-substring-search-function-callable add-zle-hook-widget; then
|
||||
#
|
||||
# The following code is based on the zsh-syntax-highlighting plugin.
|
||||
#
|
||||
autoload -U add-zle-hook-widget
|
||||
|
||||
_history-substring-search-zle-line-finish() {
|
||||
#
|
||||
# Reset $WIDGET since the 'main' highlighter depends on it.
|
||||
#
|
||||
# Since $WIDGET is declared by zle as read-only in this function's scope,
|
||||
# a nested function is required in order to shadow its built-in value;
|
||||
# see "User-defined widgets" in zshall.
|
||||
#
|
||||
() {
|
||||
local -h -r WIDGET=zle-line-finish
|
||||
_zsh_highlight
|
||||
}
|
||||
}
|
||||
|
||||
# Override ZLE widgets to make them invoke _zsh_highlight.
|
||||
local cur_widget
|
||||
for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do
|
||||
case $widgets[$cur_widget] in
|
||||
_history-substring-search-zle-line-pre-redraw() {
|
||||
#
|
||||
# If the zsh-syntax-highlighting plugin has been loaded (after our plugin
|
||||
# plugin, otherwise this hook wouldn't be called), remove our hooks.
|
||||
#
|
||||
if [[ $+ZSH_HIGHLIGHT_VERSION -eq 1 ]]; then
|
||||
autoload -U add-zle-hook-widget
|
||||
add-zle-hook-widget -d zle-line-pre-redraw _history-substring-search-zle-line-pre-redraw
|
||||
add-zle-hook-widget -d zle-line-finish _history-substring-search-zle-line-finish
|
||||
return 0
|
||||
fi
|
||||
#
|
||||
# Set $? to 0 for _zsh_highlight. Without this, subsequent
|
||||
# zle-line-pre-redraw hooks won't run, since add-zle-hook-widget happens to
|
||||
# call us with $? == 1 in the common case.
|
||||
#
|
||||
true && _zsh_highlight "$@"
|
||||
}
|
||||
|
||||
# Already rebound event: do nothing.
|
||||
user:$cur_widget|user:_zsh_highlight_widget_*);;
|
||||
if [[ -o zle ]]; then
|
||||
add-zle-hook-widget zle-line-pre-redraw _history-substring-search-zle-line-pre-redraw
|
||||
add-zle-hook-widget zle-line-finish _history-substring-search-zle-line-finish
|
||||
fi
|
||||
else
|
||||
#
|
||||
# The following snippet was taken from the zsh-syntax-highlighting project:
|
||||
# https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161
|
||||
#
|
||||
# SPDX-SnippetBegin
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# SPDX-SnippetCopyrightText: 2010-2011 zsh-syntax-highlighting contributors
|
||||
#--------------8<-------------------8<-------------------8<-----------------
|
||||
# Rebind all ZLE widgets to make them invoke _zsh_highlights.
|
||||
_zsh_highlight_bind_widgets()
|
||||
{
|
||||
# Load ZSH module zsh/zleparameter, needed to override user defined widgets.
|
||||
zmodload zsh/zleparameter 2>/dev/null || {
|
||||
echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
# User defined widget: override and rebind old one with prefix "orig-".
|
||||
user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
|
||||
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
# Override ZLE widgets to make them invoke _zsh_highlight.
|
||||
local cur_widget
|
||||
for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do
|
||||
case $widgets[$cur_widget] in
|
||||
|
||||
# Completion widget: override and rebind old one with prefix "orig-".
|
||||
completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
|
||||
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
# Already rebound event: do nothing.
|
||||
user:$cur_widget|user:_zsh_highlight_widget_*);;
|
||||
|
||||
# Builtin widget: override and make it call the builtin ".widget".
|
||||
builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
# User defined widget: override and rebind old one with prefix "orig-".
|
||||
user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
|
||||
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
|
||||
# Default: unhandled case.
|
||||
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
#-------------->8------------------->8------------------->8-----------------
|
||||
# Completion widget: override and rebind old one with prefix "orig-".
|
||||
completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
|
||||
_zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
|
||||
_zsh_highlight_bind_widgets
|
||||
# Builtin widget: override and make it call the builtin ".widget".
|
||||
builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \
|
||||
zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
|
||||
|
||||
# Default: unhandled case.
|
||||
*) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
#-------------->8------------------->8------------------->8-----------------
|
||||
# SPDX-SnippetEnd
|
||||
|
||||
_zsh_highlight_bind_widgets
|
||||
fi
|
||||
|
||||
unfunction _history-substring-search-function-callable
|
||||
fi
|
||||
|
||||
_history-substring-search-begin() {
|
||||
|
|
@ -243,10 +295,17 @@ _history-substring-search-begin() {
|
|||
fi
|
||||
|
||||
#
|
||||
# Escape and join query parts with wildcard character '*' as separator
|
||||
# `(j:CHAR:)` join array to string with CHAR as separator
|
||||
# Escape and join query parts with wildcard character '*' as seperator
|
||||
# `(j:CHAR:)` join array to string with CHAR as seperator
|
||||
#
|
||||
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
|
||||
#
|
||||
# Support anchoring history search to the beginning of the command
|
||||
#
|
||||
if [[ -z $HISTORY_SUBSTRING_SEARCH_PREFIXED ]]; then
|
||||
search_pattern="*${search_pattern}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Find all occurrences of the search pattern in the history file.
|
||||
|
|
@ -304,12 +363,21 @@ _history-substring-search-begin() {
|
|||
_history-substring-search-end() {
|
||||
setopt localoptions extendedglob
|
||||
|
||||
local highlight_memo=
|
||||
_history_substring_search_result=$BUFFER
|
||||
|
||||
if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
|
||||
highlight_memo='memo=history-substring-search'
|
||||
fi
|
||||
|
||||
# the search was successful so display the result properly by clearing away
|
||||
# existing highlights and moving the cursor to the end of the result buffer
|
||||
if [[ $_history_substring_search_refresh_display -eq 1 ]]; then
|
||||
region_highlight=()
|
||||
if [[ -n $highlight_memo ]]; then
|
||||
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
||||
else
|
||||
region_highlight=()
|
||||
fi
|
||||
CURSOR=${#BUFFER}
|
||||
fi
|
||||
|
||||
|
|
@ -329,7 +397,9 @@ _history-substring-search-end() {
|
|||
if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then
|
||||
highlight_start_index=$(( $highlight_start_index + $query_part_match_index ))
|
||||
highlight_end_index=$(( $highlight_start_index + ${#query_part} ))
|
||||
region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight")
|
||||
region_highlight+=(
|
||||
"$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) ${_history_substring_search_query_highlight}${highlight_memo:+,$highlight_memo}"
|
||||
)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
@ -338,6 +408,23 @@ _history-substring-search-end() {
|
|||
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
|
||||
# read -k -t 200 && zle -U $REPLY
|
||||
|
||||
#
|
||||
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
|
||||
# logic for determining highlight priority, when two different memo= marked
|
||||
# region highlights overlap; instead, it always prioritises itself. Below is
|
||||
# a workaround for dealing with it.
|
||||
#
|
||||
if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
|
||||
zle -R
|
||||
#
|
||||
# After line redraw with desired highlight, wait for timeout or user input
|
||||
# before removing search highlight and exiting. This ensures no highlights
|
||||
# are left lingering after search is finished.
|
||||
#
|
||||
read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U $REPLY
|
||||
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
|
||||
fi
|
||||
|
||||
# Exit successfully from the history-substring-search-* widgets.
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
#
|
||||
# update-from-upstream.zsh
|
||||
#
|
||||
# This script updates the Oh My Zsh version of the zsh-history-substring-search
|
||||
# plugin from the independent upstream repo. This is to be run by OMZ developers
|
||||
# when they want to pull in new changes from upstream to OMZ. It is not run
|
||||
# during normal use of the plugin.
|
||||
#
|
||||
# The official upstream repo is zsh-users/zsh-history-substring-search
|
||||
# https://github.com/zsh-users/zsh-history-substring-search
|
||||
#
|
||||
# This is a zsh script, not a function. Call it with `zsh update-from-upstream.zsh`
|
||||
# from the command line, running it from within the plugin directory.
|
||||
#
|
||||
# You can set the environment variable REPO_PATH to point it at an upstream
|
||||
# repo you have already prepared. Otherwise, it will do a clean checkout of
|
||||
# upstream's HEAD to a temporary local repo and use that.
|
||||
|
||||
|
||||
# Just bail on any error so we don't have to do extra checking.
|
||||
# This is a developer-use script, so terse output like that should
|
||||
# be fine.
|
||||
set -e
|
||||
|
||||
|
||||
upstream_basename=zsh-history-substring-search
|
||||
plugin_basename=history-substring-search
|
||||
UPSTREAM_REPO=zsh-users/$upstream_basename
|
||||
need_repo_cleanup=false
|
||||
upstream_github_url="https://github.com/$UPSTREAM_REPO"
|
||||
|
||||
if [[ -z "$UPSTREAM_REPO_PATH" ]]; then
|
||||
# Do a clean checkout
|
||||
my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch)
|
||||
UPSTREAM_REPO_PATH="$my_tempdir/$upstream_basename"
|
||||
git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH"
|
||||
need_repo_cleanup=true
|
||||
print "Checked out upstream repo to $UPSTREAM_REPO_PATH"
|
||||
else
|
||||
print "Using existing $upstream_basename repo at $UPSTREAM_REPO_PATH"
|
||||
fi
|
||||
|
||||
upstream="$UPSTREAM_REPO_PATH"
|
||||
|
||||
# Figure out what we're pulling in
|
||||
upstream_sha=$(cd $upstream && git rev-parse HEAD)
|
||||
upstream_commit_date=$(cd $upstream && git log -1 --pretty=format:%ci)
|
||||
upstream_just_date=${${=upstream_commit_date}[1]}
|
||||
print "upstream SHA: $upstream_sha"
|
||||
print "upstream commit time: $upstream_commit_date"
|
||||
print "upstream commit date: $upstream_just_date"
|
||||
print
|
||||
|
||||
# Copy the files over, using the OMZ plugin's names where needed
|
||||
cp -v "$upstream"/* .
|
||||
mv -v zsh-history-substring-search.zsh $plugin_basename.zsh
|
||||
mv -v zsh-history-substring-search.plugin.zsh $plugin_basename.plugin.zsh
|
||||
|
||||
if [[ $need_repo_cleanup == true ]]; then
|
||||
print "Removing temporary repo at $my_tempdir"
|
||||
rm -rf "$my_tempdir"
|
||||
fi
|
||||
|
||||
# Do OMZ-specific edits
|
||||
|
||||
print
|
||||
print "Updating files with OMZ-specific stuff"
|
||||
print
|
||||
|
||||
# OMZ binds the keys as part of the plugin loading
|
||||
|
||||
cat >> $plugin_basename.plugin.zsh <<EOF
|
||||
|
||||
|
||||
# Bind terminal-specific up and down keys
|
||||
|
||||
if [[ -n "\$terminfo[kcuu1]" ]]; then
|
||||
bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
|
||||
fi
|
||||
if [[ -n "\$terminfo[kcud1]" ]]; then
|
||||
bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
||||
# Tack OMZ-specific notes on to readme
|
||||
|
||||
thin_line="------------------------------------------------------------------------------"
|
||||
cat >> README.md <<EOF
|
||||
|
||||
$thin_line
|
||||
Oh My Zsh Distribution Notes
|
||||
$thin_line
|
||||
|
||||
What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
|
||||
as an OMZ module inside the Oh My Zsh distribution.
|
||||
|
||||
The upstream repo, $UPSTREAM_REPO, can be found on GitHub at
|
||||
$upstream_github_url.
|
||||
|
||||
This downstream copy was last updated from the following upstream commit:
|
||||
|
||||
SHA: $upstream_sha
|
||||
Commit date: $upstream_commit_date
|
||||
|
||||
Everything above this section is a copy of the original upstream's README, so things
|
||||
may differ slightly when you're using this inside OMZ. In particular, you do not
|
||||
need to set up key bindings for the up and down arrows yourself in \`~/.zshrc\`; the OMZ
|
||||
plugin does that for you. You may still want to set up additional emacs- or vi-specific
|
||||
bindings as mentioned above.
|
||||
|
||||
EOF
|
||||
|
||||
# Announce success and generate git commit messages
|
||||
|
||||
cat <<EOF
|
||||
Done OK
|
||||
|
||||
Now you can check the results and commit like this:
|
||||
|
||||
git add *
|
||||
git commit -m "history-substring-search: update to upstream version $upstream_just_date" \\
|
||||
-m "Updates OMZ's copy to commit $upstream_sha from $UPSTREAM_REPO"
|
||||
|
||||
EOF
|
||||
|
||||
|
|
@ -13,5 +13,6 @@ plugins=(... history)
|
|||
| Alias | Command | Description |
|
||||
|-------|----------------------|------------------------------------------------------------------|
|
||||
| `h` | `history` | Prints your command history |
|
||||
| `hl` | `history \| less` | Pipe history output to less to search and navigate it easily |
|
||||
| `hs` | `history \| grep` | Use grep to search your command history |
|
||||
| `hsi` | `history \| grep -i` | Use grep to do a case-insensitive search of your command history |
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
alias h='history'
|
||||
alias hl='history | less'
|
||||
alias hs='history | grep'
|
||||
alias hsi='history | grep -i'
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
%
|
||||
"The fronting for the eighty-yard-long marble-topped bar had been made by stitching together nearly twenty thousand Antarean Mosaic Lizard skins, despite the fact that the twenty thousand lizards concerned had needed them to keep their insides in."
|
||||
|
||||
- The Book decribing Milliways' politically incorrect decor.
|
||||
- The Book describing Milliways' politically incorrect decor.
|
||||
%
|
||||
"`...and the Universe,' continued the waiter, determined not to be deflected on his home stretch, `will explode later for your pleasure.' Ford's head swivelled slowly towards him. He spoke with feeling. `Wow,' he said, `What sort of drinks do you serve in this place?' The waiter laughed a polite little waiter's laugh. `Ah,' he said, `I think sir has perhaps misunderstood me.' `Oh, I hope not,' breathed Ford."
|
||||
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
%
|
||||
"`The first ten million years were the worst,' said Marvin, `and the second ten million, they were the worst too. The third ten million I didn't enjoy at all. After that I went into a bit of a decline.'"
|
||||
|
||||
- Marvin reflecting back on his 576,000,003,579 year career as Milliways' car park attendent.
|
||||
- Marvin reflecting back on his 576,000,003,579 year career as Milliways' car park attendant.
|
||||
%
|
||||
"`Incidentally,' he said, `what does teleport mean?' Another moment passed. Slowly, the others turned to face him. `Probably the wrong moment to ask,' said Arthur, `It's just I remember you use the word a short while ago and I only bring it up because...' `Where,' said Ford quietly, `does it say teleport?' `Well, just over here in fact,' said Arthur, pointing at a dark control box in the rear of the cabin, `Just under the word "emergency", above the word "system" and beside the sign saying "out of order".'"
|
||||
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
|
||||
- Ford "debating" what to do with fire with a marketing girl.
|
||||
%
|
||||
"The story goes that I first had the idea for THHGTTG while lying drunk in a field in Innsbruck (or `Spain' as the BBC TV publicity department authoritatively has it, probably because it's easier to spell)." - Foreward by DNA.
|
||||
"The story goes that I first had the idea for THHGTTG while lying drunk in a field in Innsbruck (or `Spain' as the BBC TV publicity department authoritatively has it, probably because it's easier to spell)." - Foreword by DNA.
|
||||
|
||||
FORD Six pints of bitter. And quickly please, the world's about to end. BARMAN Oh yes, sir? Nice weather for it.
|
||||
%
|
||||
|
|
@ -162,7 +162,7 @@ ARTHUR It probably seems a terrible thing to say, but you know what I sometimes
|
|||
|
||||
- Arthur discovering a way of coping with life on Prehistoric Earth.
|
||||
%
|
||||
"`... then I decided that I was a lemon for a couple of weeks. I kept myself amused all that time jumping in and out of a gin and tonic.' Arthur cleared his throat, and then did it again. `Where,' he said, `did you...?' `Find a gin and tonic?' said Ford brightly. `I found a small lake that thought it was a gin and tonic, and jumped in and out of that. At least, I think it thought it was a gin and tonic.' `I may,' he addded with a grin which would have sent sane men scampering into the trees, `have been imagining it.'"
|
||||
"`... then I decided that I was a lemon for a couple of weeks. I kept myself amused all that time jumping in and out of a gin and tonic.' Arthur cleared his throat, and then did it again. `Where,' he said, `did you...?' `Find a gin and tonic?' said Ford brightly. `I found a small lake that thought it was a gin and tonic, and jumped in and out of that. At least, I think it thought it was a gin and tonic.' `I may,' he added with a grin which would have sent sane men scampering into the trees, `have been imagining it.'"
|
||||
|
||||
- Ford updating Arthur about what he's been doing for the past four years.
|
||||
%
|
||||
|
|
@ -194,31 +194,31 @@ ARTHUR It probably seems a terrible thing to say, but you know what I sometimes
|
|||
|
||||
- One of the more preferable pieces of advice contained in the Guide.
|
||||
%
|
||||
"His eyes seemed to be popping out of his head. He wasn't certain if this was because they were trying to see more clearly, or if they simply wanted to leave at this point."QUOTEHERESTRINGMAGIC1234- Arthur trying to see who had diverted him from going to a party.
|
||||
"His eyes seemed to be popping out of his head. He wasn't certain if this was because they were trying to see more clearly, or if they simply wanted to leave at this point." - Arthur trying to see who had diverted him from going to a party.
|
||||
%
|
||||
"Arthur yawed wildly as his skin tried to jump one way and his skeleton the other, whilst his brain tried to work out which of his ears it most wanted to crawl out of. `Bet you weren't expecting to see me again,' said the monster, which Arthur couldn't help thinking was a strange remark for it to make, seeing as he had never met the creature before. He could tell that he hadn't met the creature before from the simple fact that he was able to sleep at nights."QUOTEHERESTRINGMAGIC1234- Arthur discovering who had diverted him from going to a party.
|
||||
"Arthur yawed wildly as his skin tried to jump one way and his skeleton the other, whilst his brain tried to work out which of his ears it most wanted to crawl out of. `Bet you weren't expecting to see me again,' said the monster, which Arthur couldn't help thinking was a strange remark for it to make, seeing as he had never met the creature before. He could tell that he hadn't met the creature before from the simple fact that he was able to sleep at nights." - Arthur discovering who had diverted him from going to a party.
|
||||
%
|
||||
"`That young girl is one of the least benightedly unintelligent organic life forms it has been my profound lack of pleasure not to be able to avoid meeting.'"QUOTEHERESTRINGMAGIC1234- Marvin's first ever compliment about anybody.
|
||||
"`That young girl is one of the least benightedly unintelligent organic life forms it has been my profound lack of pleasure not to be able to avoid meeting.'" - Marvin's first ever compliment about anybody.
|
||||
%
|
||||
"Arthur hoped and prayed that there wasn't an afterlife. Then he realised there was a contradiction there and merely hoped that there wasn't an afterlife."QUOTEHERESTRINGMAGIC1234- Arthur realising that he's in a certain death situation with a supernova bomb that is shaped like a cricket ball.
|
||||
"Arthur hoped and prayed that there wasn't an afterlife. Then he realised there was a contradiction there and merely hoped that there wasn't an afterlife." - Arthur realising that he's in a certain death situation with a supernova bomb that is shaped like a cricket ball.
|
||||
%
|
||||
"`Credit?' he said. `Aaaargggh...' These two words are usually coupled together in the Old Pink Dog Bar."QUOTEHERESTRINGMAGIC1234- Ford in a spot of bother.
|
||||
"`Credit?' he said. `Aaaargggh...' These two words are usually coupled together in the Old Pink Dog Bar." - Ford in a spot of bother.
|
||||
%
|
||||
"`...we might as well start with where your hand is now.' Arthur said, `So which way do I go?' `Down,' said Fenchurch, `on this occasion.' He moved his hand. `Down,' she said, `is in fact the other way.' `Oh yes.'"QUOTEHERESTRINGMAGIC1234- Arthur trying to discover which part of Fenchurch is wrong.
|
||||
"`...we might as well start with where your hand is now.' Arthur said, `So which way do I go?' `Down,' said Fenchurch, `on this occasion.' He moved his hand. `Down,' she said, `is in fact the other way.' `Oh yes.'" - Arthur trying to discover which part of Fenchurch is wrong.
|
||||
%
|
||||
"There was a point to this story, but it has temporarily escaped the chronicler's mind."QUOTEHERESTRINGMAGIC1234- This line perhaps best sums up the whole book.
|
||||
"There was a point to this story, but it has temporarily escaped the chronicler's mind." - This line perhaps best sums up the whole book.
|
||||
%
|
||||
"The last time anybody made a list of the top hundred character attributes of New Yorkers, common sense snuck in at number 79. .... When it's fall in New York, the air smells as if someone's been frying goats in it, and if you are keen to breathe the best plan is to open a window and stick your head in a building."QUOTEHERESTRINGMAGIC1234- Nuff said??
|
||||
"The last time anybody made a list of the top hundred character attributes of New Yorkers, common sense snuck in at number 79. .... When it's fall in New York, the air smells as if someone's been frying goats in it, and if you are keen to breathe the best plan is to open a window and stick your head in a building." - Nuff said??
|
||||
%
|
||||
"`What's been happening here?' he demanded. `Oh just the nicest things, sir, just the nicest things. can I sit on your lap please?'" "`Colin, I am going to abandon you to your fate.' `I'm so happy.'" "`It will be very, very nasty for you, and that's just too bad. Got it?' `I gurgle with pleasure.'"QUOTEHERESTRINGMAGIC1234- Ford and Colin the robot.
|
||||
"`What's been happening here?' he demanded. `Oh just the nicest things, sir, just the nicest things. can I sit on your lap please?'" "`Colin, I am going to abandon you to your fate.' `I'm so happy.'" "`It will be very, very nasty for you, and that's just too bad. Got it?' `I gurgle with pleasure.'" - Ford and Colin the robot.
|
||||
%
|
||||
"What the hell, he thought, you're only young once, and threw himself out of the window. That would at least keep the element of surprise on his side."QUOTEHERESTRINGMAGIC1234- Ford outwitting a Vogon with a rocket launcher by going into another certain death situation.
|
||||
"What the hell, he thought, you're only young once, and threw himself out of the window. That would at least keep the element of surprise on his side." - Ford outwitting a Vogon with a rocket launcher by going into another certain death situation.
|
||||
%
|
||||
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."QUOTEHERESTRINGMAGIC1234- One of the laws of computers and programming revealed.
|
||||
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair." - One of the laws of computers and programming revealed.
|
||||
%
|
||||
"`You know they've reintroduced the death penalty for insurance company directors?' `Really?' said Arthur. `No I didn't. For what offence?' Trillian frowned. `What do you mean, offence?' `I see.'"QUOTEHERESTRINGMAGIC1234- Evidence that there will be some justice in the Universe eventually.
|
||||
"`You know they've reintroduced the death penalty for insurance company directors?' `Really?' said Arthur. `No I didn't. For what offence?' Trillian frowned. `What do you mean, offence?' `I see.'" - Evidence that there will be some justice in the Universe eventually.
|
||||
%
|
||||
"`She hit me on the head with the rock again.' `I think I can confirm that that was my daughter.' `Sweet kid.' `You have to get to know her,' said Arthur. `She eases up does she?' `No,' said Arthur, `but you get a better sense of when to duck.'"QUOTEHERESTRINGMAGIC1234- Ford and Arthur on Random.
|
||||
"`She hit me on the head with the rock again.' `I think I can confirm that that was my daughter.' `Sweet kid.' `You have to get to know her,' said Arthur. `She eases up does she?' `No,' said Arthur, `but you get a better sense of when to duck.'" - Ford and Arthur on Random.
|
||||
%
|
||||
"Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun. "
|
||||
%
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef http
|
||||
#compdef http https
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ alias ih="ionic --help"
|
|||
alias ist="ionic start"
|
||||
alias ii="ionic info"
|
||||
alias is="ionic serve"
|
||||
alias icba="ionic cordova build android"
|
||||
alias icbi="ionic cordova build ios"
|
||||
alias icra="ionic cordova run android"
|
||||
alias icri="ionic cordova run ios"
|
||||
alias icrsa="ionic cordova resources android"
|
||||
alias icba="ionic cordova build android"
|
||||
alias icbi="ionic cordova build ios"
|
||||
alias icra="ionic cordova run android"
|
||||
alias icri="ionic cordova run ios"
|
||||
alias icrsa="ionic cordova resources android"
|
||||
alias icrsi="ionic cordova resources ios"
|
||||
alias icpaa="ionic cordova platform add android"
|
||||
alias icpaa="ionic cordova platform add android"
|
||||
alias icpai="ionic cordova platform add ios"
|
||||
alias icpra="ionic cordova platform rm android"
|
||||
alias icpri="ionic cordova platform rm ios"
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ _ipfs_subcommand(){
|
|||
_arguments \
|
||||
'--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
|
||||
'(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
|
||||
'--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
|
||||
'--allow-offline[When offline, save the IPNS record to the local datastore without broadcasting to the network instead of simply failing.]' \
|
||||
'--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
|
||||
'(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
|
||||
'(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ plugins=(... iterm2)
|
|||
```
|
||||
|
||||
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
|
||||
You can enable the integration with zstyle. It's important to add this line
|
||||
You can enable the integration with zstyle. It's important to add this line
|
||||
before the line sourcing oh-my-zsh:
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
|
||||
|
||||
# maybe make it the default in the future and allow opting out?
|
||||
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
|
||||
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
|
||||
# Handle $0 according to the standard:
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
|
|
|||
|
|
@ -16,23 +16,26 @@ This plugin supplies one command, `jira`, through which all its features are exp
|
|||
|
||||
## Commands
|
||||
|
||||
`jira help` or `jira usage` will print the below usage instructions
|
||||
|
||||
| Command | Description |
|
||||
| :------------ | :-------------------------------------------------------- |
|
||||
| `jira` | Performs the default action |
|
||||
| `jira new` | Opens a new Jira issue dialogue |
|
||||
| `jira ABC-123` | Opens an existing issue |
|
||||
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
||||
| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
|
||||
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
|
||||
| `jira mine` | Queries for your own issues |
|
||||
| `jira tempo` | Opens your JIRA Tempo |
|
||||
| `jira reported [username]` | Queries for issues reported by a user |
|
||||
| `jira assigned [username]` | Queries for issues assigned to a user |
|
||||
| `jira branch` | Opens an existing issue matching the current branch name |
|
||||
| `jira help` | Prints usage instructions |
|
||||
|
||||
|
||||
### Jira Branch usage notes
|
||||
|
||||
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
|
||||
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
|
||||
starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234"
|
||||
|
||||
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue