From 91cd5341b9e682bf1c1be4a4051249cffdab7943 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Godde Date: Wed, 20 Sep 2023 12:09:46 +0200 Subject: [PATCH 01/71] fix(gcloud): source `path.zsh.inc` always (#11901) --- plugins/gcloud/gcloud.plugin.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh index 5c57302d3..9a4213aaf 100644 --- a/plugins/gcloud/gcloud.plugin.zsh +++ b/plugins/gcloud/gcloud.plugin.zsh @@ -29,11 +29,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 From 350427dea2293a3e23f9823b5dc2574c1b1ae2a2 Mon Sep 17 00:00:00 2001 From: Trick van Staveren Date: Wed, 20 Sep 2023 09:09:26 -0500 Subject: [PATCH 02/71] feat(hitchhiker): clean up refs to magic string (#11900) --- plugins/hitchhiker/fortunes/hitchhiker | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/hitchhiker/fortunes/hitchhiker b/plugins/hitchhiker/fortunes/hitchhiker index 825b86cd6..b0448b21e 100644 --- a/plugins/hitchhiker/fortunes/hitchhiker +++ b/plugins/hitchhiker/fortunes/hitchhiker @@ -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. " % From 1cc32be5f632ff933b3e3f1c7bd9e612a274c095 Mon Sep 17 00:00:00 2001 From: ajatkj Date: Wed, 20 Sep 2023 20:21:27 +0530 Subject: [PATCH 03/71] feat(poetry-env): create plugin (#11069) --- plugins/poetry-env/README.md | 10 +++++++++ plugins/poetry-env/poetry-env.plugin.zsh | 27 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 plugins/poetry-env/README.md create mode 100644 plugins/poetry-env/poetry-env.plugin.zsh diff --git a/plugins/poetry-env/README.md b/plugins/poetry-env/README.md new file mode 100644 index 000000000..a7d16563e --- /dev/null +++ b/plugins/poetry-env/README.md @@ -0,0 +1,10 @@ +# Poetry Environment Plugin + +This plugin automatically changes poetry environment when you cd into or out of the project directory. +Note: Script looks for pyproject.toml file to determine poetry if its a poetry environment + +To use it, add `poetry-env` to the plugins array in your zshrc file: + +```zsh +plugins=(... poetry-env) +``` diff --git a/plugins/poetry-env/poetry-env.plugin.zsh b/plugins/poetry-env/poetry-env.plugin.zsh new file mode 100644 index 000000000..86e5fad4e --- /dev/null +++ b/plugins/poetry-env/poetry-env.plugin.zsh @@ -0,0 +1,27 @@ +# Automatic poetry environment activation/deactivation +_togglePoetryShell() { + # deactivate environment if pyproject.toml doesn't exist and not in a subdir + if [[ ! -f "$PWD/pyproject.toml" ]] ; then + if [[ "$poetry_active" == 1 ]]; then + if [[ "$PWD" != "$poetry_dir"* ]]; then + export poetry_active=0 + deactivate + return + fi + fi + fi + + # activate the environment if pyproject.toml exists + if [[ "$poetry_active" != 1 ]]; then + if [[ -f "$PWD/pyproject.toml" ]]; then + if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then + export poetry_active=1 + export poetry_dir="$PWD" + source "$(poetry env info --path)/bin/activate" + fi + fi + fi +} +autoload -U add-zsh-hook +add-zsh-hook chpwd _togglePoetryShell +_togglePoetryShell From 1c55a0fe5246487ec9f18e03b7f28862b76cb7ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= Date: Thu, 21 Sep 2023 12:43:00 +0200 Subject: [PATCH 04/71] feat(dnf): use `dnf5` if available (#11904) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcus Müller --- plugins/dnf/README.md | 3 +++ plugins/dnf/dnf.plugin.zsh | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/plugins/dnf/README.md b/plugins/dnf/README.md index dc0d1e0a0..f45c8778c 100644 --- a/plugins/dnf/README.md +++ b/plugins/dnf/README.md @@ -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 | diff --git a/plugins/dnf/dnf.plugin.zsh b/plugins/dnf/dnf.plugin.zsh index 653ce7dda..642422fe1 100644 --- a/plugins/dnf/dnf.plugin.zsh +++ b/plugins/dnf/dnf.plugin.zsh @@ -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 From c91684bb1b723833a96415c2c724332a6e2e620f Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Mon, 25 Sep 2023 08:20:20 +0100 Subject: [PATCH 05/71] docs(web-search): add `youtube` entry --- plugins/web-search/README.md | 62 ++++++++++++------------ plugins/web-search/web-search.plugin.zsh | 1 - 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md index 0bf9f26ad..6e4b4d7b8 100644 --- a/plugins/web-search/README.md +++ b/plugins/web-search/README.md @@ -12,8 +12,8 @@ plugins=( ... web-search) You can use the `web-search` plugin in these two forms: -* `web_search [more terms if you want]` -* ` [more terms if you want]` +- `web_search [more terms if you want]` +- ` [more terms if you want]` For example, these two are equivalent: @@ -24,43 +24,42 @@ $ google oh-my-zsh Available search contexts are: -| Context | URL | -| --------------------- | ---------------------------------------- | -| `bing` | `https://www.bing.com/search?q=` | -| `google` | `https://www.google.com/search?q=` | -| `brs` or `brave` | `https://search.brave.com/search?q=` | -| `yahoo` | `https://search.yahoo.com/search?p=` | -| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` | -| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` | -| `yandex` | `https://yandex.ru/yandsearch?text=` | -| `github` | `https://github.com/search?q=` | -| `baidu` | `https://www.baidu.com/s?wd=` | -| `ecosia` | `https://www.ecosia.org/search?q=` | -| `goodreads` | `https://www.goodreads.com/search?q=` | -| `qwant` | `https://www.qwant.com/?q=` | -| `givero` | `https://www.givero.com/search?q=` | -| `stackoverflow` | `https://stackoverflow.com/search?q=` | -| `wolframalpha` | `https://wolframalpha.com/input?i=` | -| `archive` | `https://web.archive.org/web/*/` | -| `scholar` | `https://scholar.google.com/scholar?q=` | -| `ask` | `https://www.ask.com/web?q=` | +| Context | URL | +| --------------------- | ----------------------------------------------- | +| `bing` | `https://www.bing.com/search?q=` | +| `google` | `https://www.google.com/search?q=` | +| `brs` or `brave` | `https://search.brave.com/search?q=` | +| `yahoo` | `https://search.yahoo.com/search?p=` | +| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` | +| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` | +| `yandex` | `https://yandex.ru/yandsearch?text=` | +| `github` | `https://github.com/search?q=` | +| `baidu` | `https://www.baidu.com/s?wd=` | +| `ecosia` | `https://www.ecosia.org/search?q=` | +| `goodreads` | `https://www.goodreads.com/search?q=` | +| `qwant` | `https://www.qwant.com/?q=` | +| `givero` | `https://www.givero.com/search?q=` | +| `stackoverflow` | `https://stackoverflow.com/search?q=` | +| `wolframalpha` | `https://wolframalpha.com/input?i=` | +| `archive` | `https://web.archive.org/web/*/` | +| `scholar` | `https://scholar.google.com/scholar?q=` | +| `ask` | `https://www.ask.com/web?q=` | +| `youtube` | `https://www.youtube.com/results?search_query=` | Also there are aliases for bang-searching DuckDuckGo: | Context | Bang | -|-----------|-------| +| --------- | ----- | | `wiki` | `!w` | | `news` | `!n` | -| `youtube` | `!yt` | | `map` | `!m` | | `image` | `!i` | | `ducky` | `!` | ### Custom search engines -If you want to add other search contexts to the plugin, you can use the -`$ZSH_WEB_SEARCH_ENGINES` variable. Set it before Oh My Zsh is sourced, -with the following format: +If you want to add other search contexts to the plugin, you can use the `$ZSH_WEB_SEARCH_ENGINES` variable. +Set it before Oh My Zsh is sourced, with the following format: ```zsh ZSH_WEB_SEARCH_ENGINES=( @@ -69,13 +68,12 @@ ZSH_WEB_SEARCH_ENGINES=( ) ``` -where `` is the name of the search context, and `` a URL of -the same type as the search contexts above. For example, to add `reddit`, -you'd do: +where `` is the name of the search context, and `` a URL of the same type as the search contexts +above. For example, to add `reddit`, you'd do: ```zsh ZSH_WEB_SEARCH_ENGINES=(reddit "https://www.reddit.com/search/?q=") ``` -These custom search engines will also be turned to aliases, so you can -both do `web_search reddit ` or `reddit `. +These custom search engines will also be turned to aliases, so you can both do `web_search reddit ` or +`reddit `. diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index fc87a3495..a8848fd95 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -72,7 +72,6 @@ alias youtube='web_search youtube' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' alias news='web_search duckduckgo \!n' -#alias youtube='web_search duckduckgo \!yt' alias map='web_search duckduckgo \!m' alias image='web_search duckduckgo \!i' alias ducky='web_search duckduckgo \!' From a17789eedea4f6b9b5a9c970174d6d5dc0ef64ee Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 25 Sep 2023 09:49:22 +0100 Subject: [PATCH 06/71] docs(git): improve tables and language (#11895) --- plugins/git/README.md | 463 +++++++++++++++++++++--------------------- 1 file changed, 231 insertions(+), 232 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 6eb63ea40..9621a312e 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -10,204 +10,204 @@ plugins=(... git) ## Aliases -| 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 | -| gbda | git branch --no-color --merged | grep -vE "^([+]|\s($(git_main_branch)|$(git_develop_branch))\s\*$)" | xargs git branch --delete 2>/dev/null | -| 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 | -| 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 | -| 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 | -| 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=\ | -| 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 | -| 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 | -| gup | git pull --rebase | -| gupa | git pull --rebase --autostash | -| gupav | git pull --rebase --autostash --verbose | -| gupv | git pull --rebase --verbose | -| ggu | git pull --rebase origin $(current_branch) | -| gupom | git pull --rebase origin $(git_main_branch) | -| gupomi | 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 | git push --force-with-lease --force-if-includes (git version >= 2.30) | -| gpf | git push --force-with-lease (git version < 2.30) | -| ggfl | git push --force-with-lease 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) | -| 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) | -| 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 | -| gpristine | git reset --hard && git clean -dffx | -| 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 | git stash push (git version >= 2.13) | -| gsta | git stash save (git version < 2.13) | -| gsts | git stash show --text | -| 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) | -| 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 | +| 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` | +| `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` | +| `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` | +| `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` | +| `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` | +| `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=` | +| `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` | +| `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` | +| `gup` | `git pull --rebase` | +| `gupa` | `git pull --rebase --autostash` | +| `gupav` | `git pull --rebase --autostash --verbose` | +| `gupv` | `git pull --rebase --verbose` | +| `ggu` | `git pull --rebase origin $(current_branch)` | +| `gupom` | `git pull --rebase origin $(git_main_branch)` | +| `gupomi` | `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)` | +| `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` | +| `gpristine` | `git reset --hard && git clean -dffx` | +| `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 --text` | +| `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)` | +| `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 @@ -221,50 +221,49 @@ branch exists. We do this via the function `git_main_branch`. 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`. | ## Functions ### Current -| Command | Description | -| :--------------------- | :------------------------------------------------------------------------------------------------------- | -| current_branch | Return 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 develop 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 \ \ | Rename `old` branch to `new`, including in origin remote | +| 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 ` | Renames branch `` to ``, including on the origin remote. | ### 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 | -| :--------------- | :---------------------------------------------- | -| 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 | +| 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 effectivly alias, but are also documented here to group all related WIP -features. +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). | From aaa74964a8f5908716f5bc8658116db096467702 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 26 Sep 2023 08:18:54 +0100 Subject: [PATCH 07/71] fix(git): remove `--text` from `gsts` (#11897) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 9621a312e..390f52001 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -183,7 +183,7 @@ plugins=(... git) | `gstp` | `git stash pop` | | `gsta` | On Git >= 2.13: `git stash push` | | `gsta` | On Git < 2.13: `git stash save` | -| `gsts` | `git stash show --text` | +| `gsts` | `git stash show` | | `gst` | `git status` | | `gss` | `git status --short` | | `gsb` | `git status --short -b` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 4afe34e99..426f51979 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -331,7 +331,7 @@ alias gstp='git stash pop' is-at-least 2.13 "$git_version" \ && alias gsta='git stash push' \ || alias gsta='git stash save' -alias gsts='git stash show --text' +alias gsts='git stash show' alias gst='git status' alias gss='git status --short' alias gsb='git status --short --branch' From bca62f78e23247afdc44882111a27a7333e5acb0 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 26 Sep 2023 08:22:32 +0100 Subject: [PATCH 08/71] feat(git): add branch rename alias `gbm` (#11909) Co-authored-by: Gabriel Akinyosoye --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 390f52001..e7c32e97f 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -44,6 +44,7 @@ plugins=(... git) | `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` | | `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)` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 426f51979..01eab682e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -125,6 +125,7 @@ alias gbD='git branch --delete --force' 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 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)' From e2b855341bfd587590734da860d75ead7788810f Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 26 Sep 2023 08:27:48 +0100 Subject: [PATCH 09/71] feat(git): add tag aliases `gt` and `gta` (#11910) Co-authored-by: hasecilu Co-authored-by: Rik Co-authored-by: Carlo Sala --- plugins/git/README.md | 2 ++ plugins/git/git.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index e7c32e97f..5a732ed63 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -197,6 +197,8 @@ plugins=(... git) | `gswc` | `git switch -c` | | `gswd` | `git switch $(git_develop_branch)` | | `gswm` | `git switch $(git_main_branch)` | +| `gt` | `git tag` | +| `gta` | `git tag --annotate` | | `gts` | `git tag -s` | | `gtv` | `git tag \| sort -V` | | `gignore` | `git update-index --assume-unchanged` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 01eab682e..527093c28 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -345,6 +345,8 @@ alias gsw='git switch' alias gswc='git switch --create' alias gswd='git switch $(git_develop_branch)' alias gswm='git switch $(git_main_branch)' +alias gt='git tag' +alias gta='git tag --annotate' alias gts='git tag --sign' alias gtv='git tag | sort -V' alias gignore='git update-index --assume-unchanged' From 4fb5d02db94fa87d22afea9825bd5f866e0cd1ac Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 26 Sep 2023 08:31:32 +0100 Subject: [PATCH 10/71] feat(git): add reset aliases `grhk` and `grhs` (#11896) --- plugins/git/README.md | 2 ++ plugins/git/git.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 5a732ed63..5b2db55fa 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -163,6 +163,8 @@ plugins=(... git) | `grh` | `git reset` | | `gru` | `git reset --` | | `grhh` | `git reset --hard` | +| `grhk` | `git reset --keep` | +| `grhs` | `git reset --soft` | | `gpristine` | `git reset --hard && git clean -dffx` | | `groh` | `git reset origin/$(git_current_branch) --hard` | | `grs` | `git restore` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 527093c28..ba90c936e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -310,6 +310,8 @@ 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 groh='git reset origin/$(git_current_branch) --hard' alias grs='git restore' From 0e1e877ea9182f87b3ab34cbc2ea944b34f5345e Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Wed, 27 Sep 2023 08:19:57 +0200 Subject: [PATCH 11/71] fix(git)!: remove `gt` alias BREAKING CHANGE: `gt` alias clashes with Graphite CLI (https://graphite.dev). See https://github.com/ohmyzsh/ohmyzsh/pull/11910#issuecomment-1736340910 --- plugins/git/README.md | 1 - plugins/git/git.plugin.zsh | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 5b2db55fa..9c16cb6e7 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -199,7 +199,6 @@ plugins=(... git) | `gswc` | `git switch -c` | | `gswd` | `git switch $(git_develop_branch)` | | `gswm` | `git switch $(git_main_branch)` | -| `gt` | `git tag` | | `gta` | `git tag --annotate` | | `gts` | `git tag -s` | | `gtv` | `git tag \| sort -V` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index ba90c936e..cb848b407 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -347,7 +347,6 @@ alias gsw='git switch' alias gswc='git switch --create' alias gswd='git switch $(git_develop_branch)' alias gswm='git switch $(git_main_branch)' -alias gt='git tag' alias gta='git tag --annotate' alias gts='git tag --sign' alias gtv='git tag | sort -V' From d3b6f1fd5e42deafb3a6458213762a492e484073 Mon Sep 17 00:00:00 2001 From: Piotr Minkina Date: Thu, 28 Sep 2023 23:43:06 +0200 Subject: [PATCH 12/71] fix(gradle): remove look for settings.gradle files (#11917) --- plugins/gradle/gradle.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 5bca364d1..dacc46478 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -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 From 27402e2603b9354f419af3695bad8ff17ed33bac Mon Sep 17 00:00:00 2001 From: Jake Conway Date: Fri, 29 Sep 2023 05:24:40 -0500 Subject: [PATCH 13/71] docs(gas): update plugin url (#11918) --- plugins/gas/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gas/README.md b/plugins/gas/README.md index 47b3fb9df..a0a7a568f 100644 --- a/plugins/gas/README.md +++ b/plugins/gas/README.md @@ -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: From 278bcfc93bed91d1095a9ea7981c4a1109da7abd Mon Sep 17 00:00:00 2001 From: Thomas Faugier Date: Mon, 2 Oct 2023 20:25:17 +0200 Subject: [PATCH 14/71] feat(asdf): load zsh completions instead of bash ones Closes #11143 Closes #8779 Co-authored-by: Carlo Sala --- plugins/asdf/asdf.plugin.zsh | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh index 3016282c6..7635d20c3 100644 --- a/plugins/asdf/asdf.plugin.zsh +++ b/plugins/asdf/asdf.plugin.zsh @@ -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 From fea4584cebf98fc58334b7cca841ab1ef224a35e Mon Sep 17 00:00:00 2001 From: HeroCC Date: Mon, 2 Oct 2023 14:34:57 -0400 Subject: [PATCH 15/71] fix(tmux): don't autostart inside background intelliJ (#11927) --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 680f72598..6ed91c447 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -109,7 +109,7 @@ compdef _tmux _zsh_tmux_plugin_run alias tmux=_zsh_tmux_plugin_run # Autostart if not already in tmux and enabled. -if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then +if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" ]]; then # Actually don't autostart if we already did and multiple autostarts are disabled. if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then export ZSH_TMUX_AUTOSTARTED=true From df80a2da5475fc3c068bc5f700fa176a47f7adbe Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 2 Oct 2023 20:41:01 +0200 Subject: [PATCH 16/71] feat(vi-mode): copy to clipboard when using `vi-change*` and `vi-yank*` widgets (#11861) --- plugins/vi-mode/README.md | 6 ++++++ plugins/vi-mode/vi-mode.plugin.zsh | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md index 0cb516751..821c12adb 100644 --- a/plugins/vi-mode/README.md +++ b/plugins/vi-mode/README.md @@ -144,11 +144,17 @@ NOTE: this used to be bound to `v`. That is now the default (`visual-mode`). - `c{motion}` : Delete {motion} text and start insert - `cc` : Delete line and start insert - `C` : Delete to the end of the line and start insert +- `P` : Insert the contents of the clipboard before the cursor +- `p` : Insert the contents of the clipboard after the cursor - `r{char}` : Replace the character under the cursor with {char} - `R` : Enter replace mode: Each character replaces existing one - `x` : Delete `count` characters under and after the cursor - `X` : Delete `count` characters before the cursor +NOTE: delete/kill commands (`dd`, `D`, `c{motion}`, `C`, `x`,`X`) and yank commands +(`y`, `Y`) will copy to the clipboard. Contents can then be put back using paste commands +(`P`, `p`). + ## Known issues ### Low `$KEYTIMEOUT` diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index cc9817a74..d1493e02f 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -147,8 +147,15 @@ function wrap_clipboard_widgets() { done } -wrap_clipboard_widgets copy vi-yank vi-yank-eol vi-backward-kill-word vi-change-whole-line vi-delete vi-delete-char -wrap_clipboard_widgets paste vi-put-{before,after} +wrap_clipboard_widgets copy \ + vi-yank vi-yank-eol vi-yank-whole-line \ + vi-change vi-change-eol vi-change-whole-line \ + vi-kill-line vi-kill-eol vi-backward-kill-word \ + vi-delete vi-delete-char vi-backward-delete-char + +wrap_clipboard_widgets paste \ + vi-put-{before,after} + unfunction wrap_clipboard_widgets # if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default From 7400d469b67e2e72a6405df39c5f28cba646e1a8 Mon Sep 17 00:00:00 2001 From: jack Date: Tue, 3 Oct 2023 02:41:18 +0800 Subject: [PATCH 17/71] fix(ruby): add missing `-run` in `rserver` alias (#11913) --- plugins/ruby/ruby.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 408512110..e09b22c75 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -23,4 +23,4 @@ alias gel="gem lock" alias geo="gem open" alias geoe="gem open -e" alias rrun="ruby -e" -alias rserver="ruby -e httpd . -p 8080" # requires webrick +alias rserver="ruby -run -e httpd . -p 8080" # requires webrick From f36c6db0eac17b022eee87411e6996a5f5fc8457 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Tue, 3 Oct 2023 00:28:42 +0530 Subject: [PATCH 18/71] feat(shell-proxy): allow excluding endpoints with `NO_PROXY` (#11924) --- plugins/shell-proxy/README.md | 5 +++++ plugins/shell-proxy/proxy.py | 23 +++++++++++++++++----- plugins/shell-proxy/shell-proxy.plugin.zsh | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/plugins/shell-proxy/README.md b/plugins/shell-proxy/README.md index b19888c56..102e46b6b 100644 --- a/plugins/shell-proxy/README.md +++ b/plugins/shell-proxy/README.md @@ -23,6 +23,7 @@ Set `SHELLPROXY_URL` environment variable to the URL of the proxy server: ```sh SHELLPROXY_URL="http://127.0.0.1:8123" +SHELLPROXY_NO_PROXY="localhost,127.0.0.1" proxy enable ``` @@ -36,11 +37,15 @@ Example: ```sh #!/bin/bash +# HTTP Proxy if [[ "$(uname)" = Darwin ]]; then echo "http://127.0.0.1:6152" # Surge Mac else echo "http://127.0.0.1:8123" # polipo fi + +# No Proxy +echo "localhost,127.0.0.1" ``` ### Method 3 diff --git a/plugins/shell-proxy/proxy.py b/plugins/shell-proxy/proxy.py index 14f2944cc..8c2aaf9f3 100755 --- a/plugins/shell-proxy/proxy.py +++ b/plugins/shell-proxy/proxy.py @@ -6,6 +6,7 @@ from subprocess import check_output, list2cmdline cwd = os.path.dirname(__file__) ssh_agent = os.path.join(cwd, "ssh-agent.py") proxy_env = "SHELLPROXY_URL" +no_proxy_env = "SHELLPROXY_NO_PROXY" proxy_config = os.environ.get("SHELLPROXY_CONFIG") or os.path.expandvars("$HOME/.config/proxy") usage="""shell-proxy: no proxy configuration found. @@ -15,18 +16,30 @@ See the plugin README for more information.""".format(env=proxy_env, config=prox def get_http_proxy(): default_proxy = os.environ.get(proxy_env) - if default_proxy: - return default_proxy + no_proxy = os.environ.get(no_proxy_env) + if default_proxy and no_proxy: + return default_proxy, no_proxy + if os.path.isfile(proxy_config): - return check_output(proxy_config).decode("utf-8").strip() + proxy_configdata = [line.strip() for line in check_output(proxy_config).decode("utf-8").splitlines()] + if len(proxy_configdata) >= 1: + if not default_proxy: + default_proxy = proxy_configdata[0] + if len(proxy_configdata) == 2 and not no_proxy: + no_proxy = proxy_configdata[1] + + if default_proxy: + return default_proxy, no_proxy print(usage, file=sys.stderr) sys.exit(1) -def make_proxies(url: str): +def make_proxies(url: str, no_proxy: str): proxies = {"%s_PROXY" % _: url for _ in ("HTTP", "HTTPS", "FTP", "RSYNC", "ALL")} proxies.update({name.lower(): value for (name, value) in proxies.items()}) proxies["GIT_SSH"] = ssh_agent + if no_proxy: + proxies.update({"NO_PROXY": no_proxy, "no_proxy": no_proxy}) return proxies @@ -35,7 +48,7 @@ def merge(mapping: dict): class CommandSet: - proxies = make_proxies(get_http_proxy()) + proxies = make_proxies(*get_http_proxy()) aliases = { _: "env __SSH_PROGRAM_NAME__=%s %s" % (_, ssh_agent) for _ in ("ssh", "sftp", "scp", "slogin", "ssh-copy-id") diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh index 4fdbe9322..f6c31da45 100644 --- a/plugins/shell-proxy/shell-proxy.plugin.zsh +++ b/plugins/shell-proxy/shell-proxy.plugin.zsh @@ -27,7 +27,7 @@ eval ' # capture the output of the proxy script and bail out if it fails local output - output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || + output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_NO_PROXY="$SHELLPROXY_NO_PROXY" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" || return $? # evaluate the output generated by the proxy script From 974055f638dac907cfb10281bce9cf998641febd Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 8 Oct 2023 13:47:16 +0200 Subject: [PATCH 19/71] Adding Mastadon and updating X badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a30595581..d915bd720 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ Finally, you'll begin to get the sort of attention that you have always felt you To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh). [![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI) -[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) +![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ohmyzsh?style=flat) +![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?domain=https%3A%2F%2Fmstdn.social&style=flat) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) [![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) From ee857e3acf4beba9e3121bc8e776a048c46fa85f Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 8 Oct 2023 14:05:03 +0200 Subject: [PATCH 20/71] Adding operating system compatibility chart --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d915bd720..70c4faaf0 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,21 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi ## Getting Started +### Operating System Compatibility + +| O/S | Status | +| :---------------- | :------: | +| Android | ✅ | +| FreeBSD | ✅ | +| LCARS | 🛸 | +| Linux | ✅ | +| MacOS | ✅ | +| OS/2 Warp | ❌ | +| Windows (WSL2) | ✅ | + + ### Prerequisites -- A Unix-like operating system: macOS, Linux, BSD. On Windows: WSL2 is preferred, but cygwin or msys also mostly work. - [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent is fine but we prefer 5.0.8 and newer). If not pre-installed (run `zsh --version` to confirm), check the following wiki instructions here: [Installing ZSH](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) - `curl` or `wget` should be installed - `git` should be installed (recommended v2.4.11 or higher) From 7105e37ef09ff890f7eca3e64d48b8b7ff94a494 Mon Sep 17 00:00:00 2001 From: DemonKiller <55846983+demonkillerr@users.noreply.github.com> Date: Sun, 8 Oct 2023 14:27:55 +0100 Subject: [PATCH 21/71] feat(rtx) Added new polyglot runtime manager (asdf rust clone) (#11932) * add readme.md for rtx * add rtx plugin * update install info * remove redundant slashes --- plugins/rtx/README.md | 30 ++++++++++++++++++++++++++++++ plugins/rtx/rtx.plugin.zsh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 plugins/rtx/README.md create mode 100644 plugins/rtx/rtx.plugin.zsh diff --git a/plugins/rtx/README.md b/plugins/rtx/README.md new file mode 100644 index 000000000..c6436d3a7 --- /dev/null +++ b/plugins/rtx/README.md @@ -0,0 +1,30 @@ +## rtx + + +Adds integration with [rtx](https://github.com/jdx/rtx), a runtime executor compatible with npm, nodenv, pyenv, etc. rtx is written in rust and is very fast. 20x-200x faster than asdf. With that being said, rtx is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement. + +### Installation + +1. [Download & install rtx](https://github.com/jdx/rtx#installation) by running the following: + + ``` + curl https://rtx.pub/install.sh | sh + ``` + + +2. [Enable rtx](https://github.com/jdx/rtx#quickstart) by adding it to your `plugins` definition in `~/.zshrc`. + + ``` + plugins=(rtx) + ``` + +### Usage + +See the [rtx readme](https://github.com/jdx/rtx#table-of-contents) for information on how to use rtx. Here are a few examples: + +``` +rtx install node Install the current version specified in .tool-versions/.rtx.toml +rtx use -g node@system Use system node as global default +rtx install node@20.0.0 Install a specific version number +rtx use -g node@20 Use node-20.x as global default +``` diff --git a/plugins/rtx/rtx.plugin.zsh b/plugins/rtx/rtx.plugin.zsh new file mode 100644 index 000000000..aaccaf015 --- /dev/null +++ b/plugins/rtx/rtx.plugin.zsh @@ -0,0 +1,30 @@ +# Find where rtx should be installed +RTX_DIR="${RTX_DIR:-$HOME/.rtx}" +RTX_COMPLETIONS="$RTX_DIR/completions" + +if [[ ! -f "$RTX_DIR/rtx.sh" || ! -f "$RTX_COMPLETIONS/_rtx" ]]; then + # If not found, check for archlinux/AUR package (/opt/rtx-vm/) + if [[ -f "/opt/rtx-vm/rtx.sh" ]]; then + RTX_DIR="/opt/rtx-vm" + RTX_COMPLETIONS="$RTX_DIR" + # If not found, check for Homebrew package + elif (( $+commands[brew] )); then + _RTX_PREFIX="$(brew --prefix rtx)" + RTX_DIR="${_RTX_PREFIX}/libexec" + RTX_COMPLETIONS="${_RTX_PREFIX}/share/zsh/site-functions" + unset _RTX_PREFIX + else + return + fi +fi + +# Load command +if [[ -f "$RTX_DIR/rtx.sh" ]]; then + source "$RTX_DIR/rtx.sh" + # Load completions + if [[ -f "$RTX_COMPLETIONS/_rtx" ]]; then + fpath+=("$RTX_COMPLETIONS") + autoload -Uz _rtx + compdef _rtx rtx # compdef is already loaded before loading plugins + fi +fi From b75b01a3092e59cd10ff01084d4a5e3ac0be3e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 8 Oct 2023 20:01:46 +0200 Subject: [PATCH 22/71] chore: update README badges --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 70c4faaf0..c83e16218 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Finally, you'll begin to get the sort of attention that you have always felt you To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter, and join us on [Discord](https://discord.gg/ohmyzsh). [![CI](https://github.com/ohmyzsh/ohmyzsh/workflows/CI/badge.svg)](https://github.com/ohmyzsh/ohmyzsh/actions?query=workflow%3ACI) -![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ohmyzsh?style=flat) -![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?domain=https%3A%2F%2Fmstdn.social&style=flat) +[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ohmyzsh?label=%40ohmyzsh&logo=x&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) +[![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?label=%40ohmyzsh&domain=https%3A%2F%2Fmstdn.social&logo=mastodon&style=flat)](https://mstdn.social/@ohmyzsh) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) [![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) From 30a8a5d3e2f36e395c439c3346ef96e40e7bd277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 9 Oct 2023 17:53:00 +0200 Subject: [PATCH 23/71] fix(rtx): fix `rtx` init procedure (#11949) --- plugins/rtx/rtx.plugin.zsh | 42 ++++++++++++++------------------------ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/plugins/rtx/rtx.plugin.zsh b/plugins/rtx/rtx.plugin.zsh index aaccaf015..a01828afd 100644 --- a/plugins/rtx/rtx.plugin.zsh +++ b/plugins/rtx/rtx.plugin.zsh @@ -1,30 +1,18 @@ -# Find where rtx should be installed -RTX_DIR="${RTX_DIR:-$HOME/.rtx}" -RTX_COMPLETIONS="$RTX_DIR/completions" - -if [[ ! -f "$RTX_DIR/rtx.sh" || ! -f "$RTX_COMPLETIONS/_rtx" ]]; then - # If not found, check for archlinux/AUR package (/opt/rtx-vm/) - if [[ -f "/opt/rtx-vm/rtx.sh" ]]; then - RTX_DIR="/opt/rtx-vm" - RTX_COMPLETIONS="$RTX_DIR" - # If not found, check for Homebrew package - elif (( $+commands[brew] )); then - _RTX_PREFIX="$(brew --prefix rtx)" - RTX_DIR="${_RTX_PREFIX}/libexec" - RTX_COMPLETIONS="${_RTX_PREFIX}/share/zsh/site-functions" - unset _RTX_PREFIX - else - return - fi +# rtx needs to be in $PATH +if (( ! ${+commands[rtx]} )); then + return fi -# Load command -if [[ -f "$RTX_DIR/rtx.sh" ]]; then - source "$RTX_DIR/rtx.sh" - # Load completions - if [[ -f "$RTX_COMPLETIONS/_rtx" ]]; then - fpath+=("$RTX_COMPLETIONS") - autoload -Uz _rtx - compdef _rtx rtx # compdef is already loaded before loading plugins - fi +# Load rtx hooks +eval "$(rtx activate zsh)" + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `rtx`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_rtx" ]]; then + typeset -g -A _comps + autoload -Uz _rtx + _comps[rtx]=_rtx fi + +# Generate and load rtx completion +rtx completion zsh >! "$ZSH_CACHE_DIR/completions/_rtx" &| From 29b99c2c7b16f22f3ca2bdf9478ba700ac6c48b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 9 Oct 2023 18:00:17 +0200 Subject: [PATCH 24/71] feat(updater): add `background-alpha` update mode (preview) (#11928) NOTE: this feature is in alpha / preview mode, it is not guaranteed to work 100% of the time in all cases. If you experience any issues, open an issue or search for an open one describing your same situation. To use this, use the zstyle update mode settings [1] with the value `background-alpha`: zstyle ':omz:update' mode background-alpha [1] https://github.com/ohmyzsh/ohmyzsh#getting-updates --- tools/check_for_upgrade.sh | 228 +++++++++++++++++++++++++------------ 1 file changed, 155 insertions(+), 73 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 3210e4375..1cc193bde 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -9,6 +9,7 @@ fi # - prompt (default): the user is asked before updating when it's time to update # - auto: the update is performed automatically when it's time # - reminder: a reminder is shown to the user when it's time to update +# - background-alpha: an experimental update-on-the-background option # - disabled: automatic update is turned off zstyle -s ':omz:update' mode update_mode || { update_mode=prompt @@ -91,13 +92,37 @@ function is_update_available() { } function update_last_updated_file() { - echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update" + local exit_status="$1" error="$2" + + if [[ -z "${1}${2}" ]]; then + echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update" + return + fi + + cat >! "${ZSH_CACHE_DIR}/.zsh-update" <&1); then + update_last_updated_file 0 "Update successful" + else + exit_status=$? + update_last_updated_file $exit_status "$error" + return $exit_status fi } @@ -126,88 +151,145 @@ function has_typed_input() { } } -() { - emulate -L zsh +function handle_update() { + () { + emulate -L zsh - local epoch_target mtime option LAST_EPOCH + local epoch_target mtime option LAST_EPOCH - # Remove lock directory if older than a day - zmodload zsh/datetime - zmodload -F zsh/stat b:zstat - if mtime=$(zstat +mtime "$ZSH/log/update.lock" 2>/dev/null); then - if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then - command rm -rf "$ZSH/log/update.lock" + # Remove lock directory if older than a day + zmodload zsh/datetime + zmodload -F zsh/stat b:zstat + if mtime=$(zstat +mtime "$ZSH/log/update.lock" 2>/dev/null); then + if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then + command rm -rf "$ZSH/log/update.lock" + fi fi - fi - # Check for lock directory - if ! command mkdir "$ZSH/log/update.lock" 2>/dev/null; then - return - fi + # Check for lock directory + if ! command mkdir "$ZSH/log/update.lock" 2>/dev/null; then + return + fi - # Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT: - # The return status from the function is handled specially. If it is zero, the signal is - # assumed to have been handled, and execution continues normally. Otherwise, the shell - # will behave as interrupted except that the return status of the trap is retained. - # This means that for a CTRL+C, the trap needs to return the same exit status so that - # the shell actually exits what it's running. - trap " - ret=\$? - unset update_mode - unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh 2>/dev/null - command rm -rf '$ZSH/log/update.lock' - return \$ret - " EXIT INT QUIT + # Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT: + # The return status from the function is handled specially. If it is zero, the signal is + # assumed to have been handled, and execution continues normally. Otherwise, the shell + # will behave as interrupted except that the return status of the trap is retained. + # This means that for a CTRL+C, the trap needs to return the same exit status so that + # the shell actually exits what it's running. + trap " + ret=\$? + unset update_mode + unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh handle_update 2>/dev/null + command rm -rf '$ZSH/log/update.lock' + return \$ret + " EXIT INT QUIT - # Create or update .zsh-update file if missing or malformed - if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then - update_last_updated_file - return - fi + # Create or update .zsh-update file if missing or malformed + if ! source "${ZSH_CACHE_DIR}/.zsh-update" 2>/dev/null || [[ -z "$LAST_EPOCH" ]]; then + update_last_updated_file + return + fi - # Number of days before trying to update again - zstyle -s ':omz:update' frequency epoch_target || epoch_target=${UPDATE_ZSH_DAYS:-13} - # Test if enough time has passed until the next update - if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then - return - fi + # Number of days before trying to update again + zstyle -s ':omz:update' frequency epoch_target || epoch_target=${UPDATE_ZSH_DAYS:-13} + # Test if enough time has passed until the next update + if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then + return + fi - # Test if Oh My Zsh directory is a git repository - if ! (builtin cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then - echo >&2 "[oh-my-zsh] Can't update: not a git repository." - return - fi + # Test if Oh My Zsh directory is a git repository + if ! (builtin cd -q "$ZSH" && LANG= git rev-parse &>/dev/null); then + echo >&2 "[oh-my-zsh] Can't update: not a git repository." + return + fi - # Check if there are updates available before proceeding - if ! is_update_available; then - update_last_updated_file - return - fi + # Check if there are updates available before proceeding + if ! is_update_available; then + update_last_updated_file + return + fi - # If in reminder mode or user has typed input, show reminder and exit - if [[ "$update_mode" = reminder ]] || has_typed_input; then - printf '\r\e[0K' # move cursor to first column and clear whole line - echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`" - return 0 - fi + # If in reminder mode or user has typed input, show reminder and exit + if [[ "$update_mode" = reminder ]] || { [[ "$update_mode" != background-alpha ]] && has_typed_input }; then + printf '\r\e[0K' # move cursor to first column and clear whole line + echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`" + return 0 + fi - # Don't ask for confirmation before updating if in auto mode - if [[ "$update_mode" = auto ]]; then - update_ohmyzsh - return $? - fi + # Don't ask for confirmation before updating if in auto mode + if [[ "$update_mode" = (auto|background-alpha) ]]; then + update_ohmyzsh + return $? + fi - # Ask for confirmation and only update on 'y', 'Y' or Enter - # Otherwise just show a reminder for how to update - echo -n "[oh-my-zsh] Would you like to update? [Y/n] " - read -r -k 1 option - [[ "$option" = $'\n' ]] || echo - case "$option" in - [yY$'\n']) update_ohmyzsh ;; - [nN]) update_last_updated_file ;& - *) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;; - esac + # Ask for confirmation and only update on 'y', 'Y' or Enter + # Otherwise just show a reminder for how to update + echo -n "[oh-my-zsh] Would you like to update? [Y/n] " + read -r -k 1 option + [[ "$option" = $'\n' ]] || echo + case "$option" in + [yY$'\n']) update_ohmyzsh ;; + [nN]) update_last_updated_file ;& + *) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;; + esac + } + + unset update_mode + unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh handle_update } -unset update_mode -unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh +case "$update_mode" in + background-alpha) + autoload -Uz add-zsh-hook + + _omz_bg_update() { + # do the update in a subshell + (handle_update) &| + + # register update results function + add-zsh-hook precmd _omz_bg_update_status + + # deregister background function + add-zsh-hook -d precmd _omz_bg_update + unset -f _omz_bg_update + } + + _omz_bg_update_status() { + { + local LAST_EPOCH EXIT_STATUS ERROR + if [[ ! -f "$ZSH_CACHE_DIR"/.zsh-update ]]; then + return 1 + fi + + # check update results until timeout is reached + . "$ZSH_CACHE_DIR/.zsh-update" + if [[ -z "$EXIT_STATUS" || -z "$ERROR" ]]; then + return 1 + fi + + if [[ "$EXIT_STATUS" -eq 0 ]]; then + print -P "\n%F{green}[oh-my-zsh] Update successful.%f" + return 0 + elif [[ "$EXIT_STATUS" -ne 0 ]]; then + print -P "\n%F{red}[oh-my-zsh] There was an error updating:%f" + printf "\n${fg[yellow]}%s${reset_color}" "$ERROR" + return 0 + fi + } always { + if (( TRY_BLOCK_ERROR == 0 )); then + # if last update results have been handled, remove them from the status file + update_last_updated_file + + # deregister background function + add-zsh-hook -d precmd _omz_bg_update_status + unset -f _omz_bg_update_status + fi + } + } + + add-zsh-hook precmd _omz_bg_update + ;; + *) + handle_update ;; +esac From 24b2600558f999dd53f0d354ad61fc07cf7d6e2b Mon Sep 17 00:00:00 2001 From: tobi1805 <66414944+tobi1805@users.noreply.github.com> Date: Mon, 9 Oct 2023 18:07:51 +0200 Subject: [PATCH 25/71] feat(git): delete squash-merged branches in `gbda` (#11948) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 9c16cb6e7..33c10ffd0 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -41,7 +41,6 @@ plugins=(... git) | `gba` | `git branch --all` | | `gbd` | `git branch --delete` | | `gbD` | `git branch --delete --force` | -| `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` | | `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` | @@ -251,6 +250,7 @@ receive further support. | `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 ` | Renames branch `` to ``, including on the origin remote. | +| `gbda` | Deletes all merged and squash-merged branches | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index cb848b407..ceb2011f9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -122,7 +122,22 @@ alias gb='git branch' alias gba='git branch --all' alias gbd='git branch --delete' alias gbD='git branch --delete --force' -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' + +# Copied and modified from James Roeder (jmaroeder) under MIT License +# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish +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 + + local default_branch=$(git_main_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' From 38db3e16ef3266800e1a9516c0615ff04ec97cb6 Mon Sep 17 00:00:00 2001 From: Adam Henley <71472057+ajh-sr@users.noreply.github.com> Date: Tue, 10 Oct 2023 07:28:09 +1300 Subject: [PATCH 26/71] feat(kind): add plugin for Kind k8s tool (#9827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: jxlwqq Co-authored-by: Francesco Ilario Co-authored-by: Marc Cornellà --- plugins/kind/README.md | 22 ++++++++++++++++++++++ plugins/kind/kind.plugin.zsh | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 plugins/kind/README.md create mode 100644 plugins/kind/kind.plugin.zsh diff --git a/plugins/kind/README.md b/plugins/kind/README.md new file mode 100644 index 000000000..49024648d --- /dev/null +++ b/plugins/kind/README.md @@ -0,0 +1,22 @@ +# Kind plugin + +This plugin adds completion for the [Kind](https://kind.sigs.k8s.io/) tool, as well +as a few aliases for easier use. + +To use it, add `kind` to the plugins array in your zshrc file: + +```zsh +plugins=(... kind) +``` + +## Aliases + +| Alias | Command | +| ------- | ---------------------------- | +| `kicc` | `kind create cluster` | +| `kiccn` | `kind create cluster --name` | +| `kigc` | `kind get clusters` | +| `kidc` | `kind delete cluster` | +| `kidcn` | `kind delete cluster --name` | +| `kidca` | `kind delete clusters -A` | +| `kigk` | `kind get kubeconfig` | diff --git a/plugins/kind/kind.plugin.zsh b/plugins/kind/kind.plugin.zsh new file mode 100644 index 000000000..183eb7bd6 --- /dev/null +++ b/plugins/kind/kind.plugin.zsh @@ -0,0 +1,23 @@ +if (( ! $+commands[kind] )); then + return +fi + +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `kind`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_kind" ]]; then + typeset -g -A _comps + autoload -Uz _kind + _comps[kind]=_kind +fi + +# Generate and load kind completion +kind completion zsh >! "$ZSH_CACHE_DIR/completions/_kind" &| + +# Register aliases +alias kicc="kind create cluster" +alias kiccn="kind create cluster --name" +alias kigc="kind get clusters" +alias kidc="kind delete cluster" +alias kidcn="kind delete cluster --name" +alias kidca="kind delete clusters -A" +alias kigk="kind get kubeconfig" From b1821a24f0574488554de8e7f6d0735fb851de8b Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Tue, 10 Oct 2023 16:56:54 +0100 Subject: [PATCH 27/71] fix(git): restore showing patch in `gsts` (#11951) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 33c10ffd0..a4e9f4c4a 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -185,7 +185,7 @@ plugins=(... git) | `gstp` | `git stash pop` | | `gsta` | On Git >= 2.13: `git stash push` | | `gsta` | On Git < 2.13: `git stash save` | -| `gsts` | `git stash show` | +| `gsts` | `git stash show --patch` | | `gst` | `git status` | | `gss` | `git status --short` | | `gsb` | `git status --short -b` | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index ceb2011f9..b0376308f 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -349,7 +349,7 @@ alias gstp='git stash pop' is-at-least 2.13 "$git_version" \ && alias gsta='git stash push' \ || alias gsta='git stash save' -alias gsts='git stash show' +alias gsts='git stash show --patch' alias gst='git status' alias gss='git status --short' alias gsb='git status --short --branch' From da3b8fcb6a6bcf4d440b9768d2deab27f787929a Mon Sep 17 00:00:00 2001 From: Lukas Elmer Date: Wed, 11 Oct 2023 18:06:22 +0200 Subject: [PATCH 28/71] fix(yarn): output completion entries in UTF-8 (#11955) --- plugins/yarn/_yarn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 1237ba672..f15756ff4 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -144,7 +144,7 @@ _yarn_scripts() { fi if [[ -n $packageJson ]]; then - scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}") + scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E 'binmode(STDOUT, ":encoding(UTF-8)"); %r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}") fi commands=('env' $scripts $binaries) From fedef5dbd5f8ffef16815cb3a2c611eb0f7f00b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 11 Oct 2023 19:23:44 +0200 Subject: [PATCH 29/71] fix(xcode): open Xcode in current Desk if already open in another (#10384) Fixes #10384 --- plugins/xcode/xcode.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index 5d1f901a3..f09434e69 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -17,6 +17,13 @@ function xc { local active_path active_path=${"$(xcode-select -p)"%%/Contents/Developer*} echo "Found ${xcode_files[1]}. Opening with ${active_path}" + + # If Xcode is already opened in another Desk, we need this double call + # with -g to open the project window in the current Desk and focus it. + # See https://github.com/ohmyzsh/ohmyzsh/issues/10384 + if command pgrep -q "^Xcode"; then + open -g -a "$active_path" "${xcode_files[1]}" + fi open -a "$active_path" "${xcode_files[1]}" } From 53cb50acb5c2c70f6ba9d26d3d2ffb37c8a19e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 11 Oct 2023 20:43:55 +0200 Subject: [PATCH 30/71] refactor(systemadmin): use `ss` instead of `netstat` when available (#11957) --- plugins/systemadmin/systemadmin.plugin.zsh | 116 ++++++++++++--------- 1 file changed, 67 insertions(+), 49 deletions(-) diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 7ce62bac1..03dd995b6 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -13,11 +13,11 @@ # ------------------------------------------------------------------------------ function retlog() { - if [[ -z $1 ]];then - echo '/var/log/nginx/access.log' - else - echo $1 - fi + if [[ -z $1 ]];then + echo '/var/log/nginx/access.log' + else + echo $1 + fi } alias ping='ping -c 5' @@ -28,142 +28,160 @@ alias mkdir='mkdir -pv' alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' # get top process eating cpu if not work try execute : export LC_ALL='C' -alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' -alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' +alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr' +alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args | sort -k1,1n -nr | head -n 10' # top10 of the history alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' function ip() { - if [ -t 1 ]; then - command ip -color "$@" - else - command ip "$@" - fi + if [ -t 1 ]; then + command ip -color "$@" + else + command ip "$@" + fi } # directory LS function dls() { - print -l *(/) + print -l *(/) } function psgrep() { - ps aux | grep "${1:-.}" | grep -v grep + ps aux | grep "${1:-.}" | grep -v grep } # Kills any process that matches a regexp passed to it function killit() { - ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill + ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill } # list contents of directories in a tree-like format if ! (( $+commands[tree] )); then - function tree() { - find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' - } + function tree() { + find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' + } fi # Sort connection state function sortcons() { - netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn + { + LANG= ss -nat | awk 'NR > 1 {print $1}' \ + || LANG= netstat -nat | awk 'NR > 2 {print $6}' + } | sort | uniq -c | sort -rn } # View all 80 Port Connections function con80() { - netstat -nat|grep -i ":80"|wc -l + { + LANG= ss -nat || LANG= netstat -nat + } | grep -E ":80[^0-9]" | wc -l } # On the connected IP sorted by the number of connections function sortconip() { - netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n + { + LANG= ss -ntu | awk 'NR > 1 {print $6}' \ + || LANG= netstat -ntu | awk 'NR > 2 {print $5}' + } | cut -d: -f1 | sort | uniq -c | sort -n } # top20 of Find the number of requests on 80 port function req20() { - netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20 + { + LANG= ss -tn | awk '$4 ~ /:80$/ {print $5}' \ + || LANG= netstat -tn | awk '$4 ~ /:80$/ {print $5}' + } | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20 } # top20 of Using tcpdump port 80 access to view function http20() { - sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20 + sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20 } # top20 of Find time_wait connection function timewait20() { - netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20 + { + LANG= ss -nat | awk 'NR > 1 && /TIME-WAIT/ {print $5}' \ + || LANG= netstat -nat | awk 'NR > 2 && /TIME_WAIT/ {print $5}' + } | sort | uniq -c | sort -rn | head -n 20 } # top20 of Find SYN connection function syn20() { - netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20 + { + LANG= ss -an | awk '/SYN/ {print $5}' \ + || LANG= netstat -an | awk '/SYN/ {print $5}' + } | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20 } # Printing process according to the port number function port_pro() { - netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1 + LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/' \ + || LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1 } # top10 of gain access to the ip address function accessip10() { - awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" + awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)" } # top20 of Most Visited file or page function visitpage20() { - awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20 + awk '{print $11}' "$(retlog)" | sort | uniq -c | sort -nr | head -n 20 } # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences function consume100() { - awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 - # if django website or other website make by no suffix language - # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 + awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100 + # if django website or other website make by no suffix language + # awk '{print $7}' "$(retlog)" | sort -n | uniq -c | sort -nr | head -n 100 } # Website traffic statistics (G) function webtraffic() { - awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)" + awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)" } # Statistical connections 404 function c404() { - awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort + awk '($9 ~ /404/)' "$(retlog)" | awk '{print $9,$7}' | sort } # Statistical http status. function httpstatus() { - awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" + awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)" } # Delete 0 byte file function d0() { - find "${1:-.}" -type f -size 0 -exec rm -rf {} \; + find "${1:-.}" -type f -size 0 -exec rm -rf {} \; } # gather external ip address function geteip() { - curl -s -S -4 https://icanhazip.com + curl -s -S -4 https://icanhazip.com - # handle case when there is no IPv6 external IP, which shows error - # curl: (7) Couldn't connect to server - curl -s -S -6 https://icanhazip.com 2>/dev/null - local ret=$? - (( ret == 7 )) && print -P -u2 "%F{red}error: no IPv6 route to host%f" - return $ret + # handle case when there is no IPv6 external IP, which shows error + # curl: (7) Couldn't connect to server + curl -s -S -6 https://icanhazip.com 2>/dev/null + local ret=$? + (( ret == 7 )) && print -P -u2 "%F{red}error: no IPv6 route to host%f" + return $ret } # determine local IP address(es) function getip() { - if (( ${+commands[ip]} )); then - ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1 - else - ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1 - fi + if (( ${+commands[ip]} )); then + ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1 + else + ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1 + fi } # Clear zombie processes function clrz() { - ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 + ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9 } # Second concurrent function conssec() { - awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10 + awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)" | sort -k 2 -nr | head -n10 } From 408330e131110c8b86ce60ab0492b35657cb4d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 11 Oct 2023 20:44:46 +0200 Subject: [PATCH 31/71] ci: remove redundant macos runner for CI tests Currently the macOS runner is not needed, as we are only checking zsh syntax. We can reactivate it in the future if needed. --- .github/workflows/main.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 57403629c..de7d98262 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,16 +20,12 @@ permissions: jobs: tests: name: Run tests - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest if: github.repository == 'ohmyzsh/ohmyzsh' - strategy: - matrix: - os: [ubuntu-latest, macos-latest] steps: - name: Set up git repository uses: actions/checkout@v3 - name: Install zsh - if: runner.os == 'Linux' run: sudo apt-get update; sudo apt-get install zsh - name: Check syntax run: | From 6768906d07151140db901510b2c8b1ce2622f365 Mon Sep 17 00:00:00 2001 From: sattisumasri <73093486+sattisumasri@users.noreply.github.com> Date: Thu, 12 Oct 2023 00:27:01 +0530 Subject: [PATCH 32/71] chore: change headings in README to Title Case (#11956) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc Cornellà --- README.md | 69 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index c83e16218..308d117e1 100644 --- a/README.md +++ b/README.md @@ -23,32 +23,33 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi Table of Contents - [Getting Started](#getting-started) + - [Operating System Compatibility](#operating-system-compatibility) - [Prerequisites](#prerequisites) - [Basic Installation](#basic-installation) - - [Manual inspection](#manual-inspection) + - [Manual Inspection](#manual-inspection) - [Using Oh My Zsh](#using-oh-my-zsh) - [Plugins](#plugins) - [Enabling Plugins](#enabling-plugins) - [Using Plugins](#using-plugins) - [Themes](#themes) - - [Selecting a Theme](#selecting-a-theme) + - [Selecting A Theme](#selecting-a-theme) - [FAQ](#faq) - [Advanced Topics](#advanced-topics) - [Advanced Installation](#advanced-installation) - [Custom Directory](#custom-directory) - - [Unattended install](#unattended-install) - - [Installing from a forked repository](#installing-from-a-forked-repository) + - [Unattended Install](#unattended-install) + - [Installing From A Forked Repository](#installing-from-a-forked-repository) - [Manual Installation](#manual-installation) - [Installation Problems](#installation-problems) - - [Custom Plugins and Themes](#custom-plugins-and-themes) - - [Enable GNU ls in macOS and freeBSD systems](#enable-gnu-ls) - - [Skip aliases](#skip-aliases) + - [Custom Plugins And Themes](#custom-plugins-and-themes) + - [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems) + - [Skip Aliases](#skip-aliases) - [Getting Updates](#getting-updates) - - [Updates verbosity](#updates-verbosity) + - [Updates Verbosity](#updates-verbosity) - [Manual Updates](#manual-updates) - [Uninstalling Oh My Zsh](#uninstalling-oh-my-zsh) -- [How do I contribute to Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh) - - [Do NOT send us themes](#do-not-send-us-themes) +- [How Do I Contribute To Oh My Zsh?](#how-do-i-contribute-to-oh-my-zsh) + - [Do Not Send Us Themes](#do-not-send-us-themes) - [Contributors](#contributors) - [Follow Us](#follow-us) - [Merchandise](#merchandise) @@ -61,15 +62,15 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi ### Operating System Compatibility -| O/S | Status | -| :---------------- | :------: | -| Android | ✅ | -| FreeBSD | ✅ | -| LCARS | 🛸 | -| Linux | ✅ | -| MacOS | ✅ | -| OS/2 Warp | ❌ | -| Windows (WSL2) | ✅ | +| O/S | Status | +| :------------- | :-----: | +| Android | ✅ | +| freeBSD | ✅ | +| LCARS | 🛸 | +| Linux | ✅ | +| macOS | ✅ | +| OS/2 Warp | ❌ | +| Windows (WSL2) | ✅ | ### Prerequisites @@ -90,7 +91,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal _Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._ -#### Manual inspection +#### Manual Inspection It's a good idea to inspect the install script from projects you don't yet know. You can do that by downloading the install script first, looking through it so everything looks normal, @@ -139,7 +140,7 @@ Each built-in plugin includes a **README**, documenting it. This README should s We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred and fifty themes now bundled. Most of them have [screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!). Check them out! -#### Selecting a Theme +#### Selecting A Theme _Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._ @@ -210,7 +211,7 @@ like this: ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh ``` -#### Unattended install +#### Unattended Install If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended` flag to the `install.sh` script. This will have the effect of not trying to change @@ -220,7 +221,7 @@ the default shell, and it also won't run `zsh` when the installation has finishe sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended ``` -#### Installing from a forked repository +#### Installing From A Forked Repository The install script also accepts these variables to allow installation of a different repository: @@ -245,19 +246,19 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh #### Manual Installation -##### 1. Clone the repository +##### 1. Clone The Repository ```sh git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh ``` -##### 2. _Optionally_, backup your existing `~/.zshrc` file +##### 2. _Optionally_, Backup Your Existing `~/.zshrc` File ```sh cp ~/.zshrc ~/.zshrc.orig ``` -##### 3. Create a new zsh configuration file +##### 3. Create A New Zsh Configuration File You can create a new zsh config file by copying the template that we have included for you. @@ -265,7 +266,7 @@ You can create a new zsh config file by copying the template that we have includ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc ``` -##### 4. Change your default shell +##### 4. Change Your Default Shell ```sh chsh -s $(which zsh) @@ -273,7 +274,7 @@ chsh -s $(which zsh) You must log out from your user session and log back in to see this change. -##### 5. Initialize your new zsh configuration +##### 5. Initialize Your New Zsh Configuration Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. @@ -284,7 +285,7 @@ If you have any hiccups installing, here are a few common fixes. - You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. - If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. -### Custom Plugins and Themes +### Custom Plugins And Themes If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. @@ -292,7 +293,7 @@ If you have many functions that go well together, you can put them as a `XYZ.plu If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. -### Enable GNU ls in macOS and freeBSD systems +### Enable GNU ls In macOS And freeBSD Systems @@ -306,7 +307,7 @@ zstyle ':omz:lib:theme-and-appearance' gnu-ls yes _Note: this is not compatible with `DISABLE_LS_COLORS=true`_ -### Skip aliases +### Skip Aliases @@ -389,7 +390,7 @@ zstyle ':omz:update' frequency 7 zstyle ':omz:update' frequency 0 ``` -### Updates verbosity +### Updates Verbosity You can also limit the update verbosity with the following settings: @@ -417,7 +418,7 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. -## How do I contribute to Oh My Zsh? +## How Do I Contribute To Oh My Zsh? Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md). @@ -427,7 +428,7 @@ We also need people to test out pull requests. So take a look through [the open See [Contributing](CONTRIBUTING.md) for more details. -### Do NOT send us themes +### Do Not Send Us Themes We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/ohmyzsh/ohmyzsh/wiki/External-themes) wiki page. From 5743198e0ed5de137b4aa1b948cf4c82b02bdd8e Mon Sep 17 00:00:00 2001 From: Preston Button Date: Thu, 12 Oct 2023 04:32:48 -0400 Subject: [PATCH 33/71] docs(aliases): fix typo (#11958) --- plugins/aliases/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/aliases/README.md b/plugins/aliases/README.md index 53b68ea01..14f9c5c53 100644 --- a/plugins/aliases/README.md +++ b/plugins/aliases/README.md @@ -17,7 +17,7 @@ Requirements: Python needs to be installed. - `als`: show all aliases by group -- `als -h/--help`: print help mesage +- `als -h/--help`: print help message - `als `: filter and highlight aliases by `` From 7329b2fbb1787651d4900d5ef280b926c5696c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 Oct 2023 11:46:49 +0200 Subject: [PATCH 34/71] docs(debian): clarify override behavior for `apt_pref` and `apt_upgr` Fixes #11959 --- plugins/debian/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/debian/README.md b/plugins/debian/README.md index 1db534f13..6835ad65c 100644 --- a/plugins/debian/README.md +++ b/plugins/debian/README.md @@ -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 From 772b41ea5a362206e1498453dd053e638752c5dc Mon Sep 17 00:00:00 2001 From: Sandesh Pyakurel <82999440+Sandesh-Pyakurel@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:09:40 +0545 Subject: [PATCH 35/71] chore(zsh-navigation-tools): fix typo (#11960) --- plugins/zsh-navigation-tools/n-list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index f25db8f60..a852b083a 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -467,7 +467,7 @@ while (( 1 )); do elif [ -n "$keypad" ]; then final_key="$keypad" else - _nlist_status_msg "Inproper input detected" + _nlist_status_msg "Improper input detected" zcurses refresh main inner fi From 3efdbf9e1e6663adf9d8a2d113ec62855c621ef7 Mon Sep 17 00:00:00 2001 From: Sandesh Pyakurel <82999440+Sandesh-Pyakurel@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:38:48 +0545 Subject: [PATCH 36/71] chore(hitchhiker): fix typos (#11961) --- plugins/hitchhiker/fortunes/hitchhiker | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/hitchhiker/fortunes/hitchhiker b/plugins/hitchhiker/fortunes/hitchhiker index b0448b21e..94cc1c835 100644 --- a/plugins/hitchhiker/fortunes/hitchhiker +++ b/plugins/hitchhiker/fortunes/hitchhiker @@ -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. % From 8d9c9b6174466cc432a9946b0459c214586cb1b2 Mon Sep 17 00:00:00 2001 From: Sandesh Pyakurel <82999440+Sandesh-Pyakurel@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:45:28 +0545 Subject: [PATCH 37/71] chore(postgres): fix typo (#11967) --- plugins/postgres/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/postgres/README.md b/plugins/postgres/README.md index 59445f31c..3f59a8fe4 100644 --- a/plugins/postgres/README.md +++ b/plugins/postgres/README.md @@ -19,4 +19,4 @@ plugins=(... postgres) | stoppost | `pg_ctl -D /usr/local/var/postgres stop -s -m fast` | Stop postgres server | | restartpost | `stoppost && sleep 1 && startpost` | Restart (calls stop, then start) | | reloadpost | `pg_ctl reload -D /usr/local/var/postgres -s` | Reload postgres configuration (some setting require restart)| -| statuspost | `pg_ctl status -D /usr/local/var/postgres -s` | Check startus of postgres server (running, stopped) | +| statuspost | `pg_ctl status -D /usr/local/var/postgres -s` | Check status of postgres server (running, stopped) | From 48a62a9f713449a014d66b01afd99a4fcf1911fe Mon Sep 17 00:00:00 2001 From: Kapil Pau Date: Fri, 13 Oct 2023 23:11:47 +0100 Subject: [PATCH 38/71] feat(span): Introducing Snapcraft CLI plugin (#9357) --- plugins/snap/README.md | 18 ++++++++++++++++++ plugins/snap/snap.plugin.zsh | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 plugins/snap/README.md create mode 100644 plugins/snap/snap.plugin.zsh diff --git a/plugins/snap/README.md b/plugins/snap/README.md new file mode 100644 index 000000000..75c5ec19a --- /dev/null +++ b/plugins/snap/README.md @@ -0,0 +1,18 @@ +# snap plugin + +This plugin sets up aliases for the common [snap](https://snapcraft.io/docs/getting-started) commands + +## Aliases + +| Alias | Full command | +| --- | ---| +| sv | snap version | +| sf | snap find | +| si | snap install | +| sin | snap info | +| sr | snap remove | +| sref | snap refresh | +| srev | snap revert | +| sl | snap list | +| sd | snap disable | +| se | snap enable | diff --git a/plugins/snap/snap.plugin.zsh b/plugins/snap/snap.plugin.zsh new file mode 100644 index 000000000..af2346978 --- /dev/null +++ b/plugins/snap/snap.plugin.zsh @@ -0,0 +1,10 @@ +alias sv="snap version" +alias sf="snap find" +alias si="snap install" +alias sin="snap info" +alias sr="snap remove" +alias sref="snap refresh" +alias srev="snap revert" +alias sl="snap list" +alias sd="snap disable" +alias se="snap enable" From 2db53ff1da078b2207cb98736370f1f145e5c667 Mon Sep 17 00:00:00 2001 From: Steve Lessard Jr Date: Fri, 13 Oct 2023 18:26:16 -0400 Subject: [PATCH 39/71] fix(avit): RPROMPT Fix for #10307 (#11131) Co-authored-by: Steve Lessard --- themes/avit.zsh-theme | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 1279ea919..206274462 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -11,7 +11,12 @@ $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info) PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} ' -RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +__RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +if [[ -z $RPROMPT ]]; then + RPROMPT=$__RPROMPT +else + RPROMPT="${RPROMPT} ${__RPROMPT}" +fi function _user_host() { local me From f7130bb529a2d15652f739c552688b34aac63315 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 13 Oct 2023 15:38:13 -0700 Subject: [PATCH 40/71] fix(gnzh): Don't show .local for local hostnames in theme Fixes #10871 --- themes/gnzh.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 1e6c4e93b..ca62320e2 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -21,7 +21,7 @@ fi if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then PR_HOST='%F{red}%M%f' # SSH else - PR_HOST='%F{green}%M%f' # no SSH + PR_HOST='%F{green}%m%f' # no SSH fi From f93976875133409297be864ce94d50f20a9bc18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Oct 2023 16:40:45 +0200 Subject: [PATCH 41/71] fix(git): fix fallback to develop branch if `master` not found (#11966) --- plugins/git/git.plugin.zsh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index b0376308f..d053a7638 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -20,26 +20,31 @@ function current_branch() { function git_develop_branch() { command git rev-parse --git-dir &>/dev/null || return local branch - for branch in dev devel development; do + for branch in dev devel develop development; do if command git show-ref -q --verify refs/heads/$branch; then echo $branch - return + return 0 fi done + 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 } function grename() { @@ -129,6 +134,8 @@ 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 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) From 96c976637a4112e1e72a1a449ac51d78acc67597 Mon Sep 17 00:00:00 2001 From: nishanthps-cai <123212871+nishanthps-cai@users.noreply.github.com> Date: Tue, 17 Oct 2023 00:55:05 -0700 Subject: [PATCH 42/71] feat(bazel): use completion also for bazelisk (#11984) --- plugins/bazel/_bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bazel/_bazel b/plugins/bazel/_bazel index c34c572b0..ea1f4cace 100644 --- a/plugins/bazel/_bazel +++ b/plugins/bazel/_bazel @@ -1,4 +1,4 @@ -#compdef bazel +#compdef bazel bazelisk # Copyright 2015 The Bazel Authors. All rights reserved. # From d3112d67a3eb55fc39975f917467704ebb2c296b Mon Sep 17 00:00:00 2001 From: Vyacheslav Scherbinin Date: Wed, 18 Oct 2023 14:18:05 +0700 Subject: [PATCH 43/71] feat(vscode): allow arguments to `vsc` alias (#11903) Co-authored-by: Carlo Sala --- plugins/vscode/README.md | 3 ++- plugins/vscode/vscode.plugin.zsh | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md index e95ed5d4f..726b23d35 100644 --- a/plugins/vscode/README.md +++ b/plugins/vscode/README.md @@ -31,7 +31,7 @@ the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell ## Using multiple flavours -If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can +If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can manually specify the flavour's executable. Add the following line to the .zshrc file (between the `ZSH_THEME` and the `plugins=()` lines). This will make the plugin use your manually defined executable. @@ -53,6 +53,7 @@ source $ZSH/oh-my-zsh.sh | Alias | Command | Description | | ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- | | vsc | code . | Open the current folder in VS code | +| vsc `dir` | code `dir` | Open passed folder in VS code | | vsca `dir` | code --add `dir` | Add folder(s) to the last active window | | vscd `file` `file` | code --diff `file` `file` | Compare two files with each other. | | vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. | diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh index 48d904377..356c62360 100644 --- a/plugins/vscode/vscode.plugin.zsh +++ b/plugins/vscode/vscode.plugin.zsh @@ -23,7 +23,14 @@ if [[ -z "$VSCODE" ]]; then fi fi -alias vsc="$VSCODE ." +function vsc { + if (( $# )); then + $VSCODE $@ + else + $VSCODE . + fi +} + alias vsca="$VSCODE --add" alias vscd="$VSCODE --diff" alias vscg="$VSCODE --goto" From f10cd5281d805bb5679dd46b304d9b8997f98981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Krawaczy=C5=84ski?= Date: Wed, 18 Oct 2023 13:59:28 +0200 Subject: [PATCH 44/71] feat(history): add `hl` alias (#11990) --- plugins/history/README.md | 1 + plugins/history/history.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/history/README.md b/plugins/history/README.md index a9d480f46..73d6a5052 100644 --- a/plugins/history/README.md +++ b/plugins/history/README.md @@ -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 | diff --git a/plugins/history/history.plugin.zsh b/plugins/history/history.plugin.zsh index 9cee48fe4..fb3e31389 100644 --- a/plugins/history/history.plugin.zsh +++ b/plugins/history/history.plugin.zsh @@ -1,3 +1,4 @@ alias h='history' +alias hl='history | less' alias hs='history | grep' alias hsi='history | grep -i' From b696288337618ca749369a679bd77989bd4cd47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my?= Date: Wed, 18 Oct 2023 19:27:47 +0200 Subject: [PATCH 45/71] feat(kubectl): add `kgdsa` alias (#11863) --- plugins/kubectl/kubectl.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 315d3ce93..0dd4e691a 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -162,6 +162,7 @@ alias kdelsa="kubectl delete sa" # DaemonSet management. alias kgds='kubectl get daemonset' +alias kgdsa='kubectl get daemonset --all-namespaces' alias kgdsw='kgds --watch' alias keds='kubectl edit daemonset' alias kdds='kubectl describe daemonset' From 8152dc673b14c89dc12e816583e24532ed77e8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 18 Oct 2023 20:01:58 +0200 Subject: [PATCH 46/71] fix(git): move squash-merged branch deletion from `gbda` to `gbds` function (#11991) --- plugins/git/README.md | 3 ++- plugins/git/git.plugin.zsh | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index a4e9f4c4a..724965302 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -250,7 +250,8 @@ receive further support. | `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 ` | Renames branch `` to ``, including on the origin remote. | -| `gbda` | Deletes all merged and squash-merged branches | +| `gbda` | Deletes all merged branches | +| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d053a7638..48937cb83 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -128,11 +128,13 @@ alias gba='git branch --all' alias gbd='git branch --delete' alias gbD='git branch --delete --force' -# Copied and modified from James Roeder (jmaroeder) under MIT License -# https://github.com/jmaroeder/plugin-git/blob/216723ef4f9e8dde399661c39c80bdf73f4076c4/functions/gbda.fish 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) From 0da416986aadbaf89dc5596b01f9b42403f4d9fd Mon Sep 17 00:00:00 2001 From: Vishal Sharma <106011641+vishal-sharma-369@users.noreply.github.com> Date: Wed, 18 Oct 2023 23:44:47 +0530 Subject: [PATCH 47/71] fix(ssh-agent): add error message if `~/.ssh` is not found (#11929) Closes #11829 Co-authored-by: Carlo Sala --- plugins/ssh-agent/ssh-agent.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 78ac46b13..49ad95a11 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -13,6 +13,11 @@ function _start_agent() { fi fi + if [[ ! -d "$HOME/.ssh" ]]; then + echo "[oh-my-zsh] ssh-agent plugin requires ~/.ssh directory" + return 1 + fi + # Set a maximum lifetime for identities added to ssh-agent local lifetime zstyle -s :omz:plugins:ssh-agent lifetime lifetime From 104041a018dc9a3eb74f93815192dba4c9386e1a Mon Sep 17 00:00:00 2001 From: Peat Bakke Date: Thu, 19 Oct 2023 02:49:38 -0700 Subject: [PATCH 48/71] feat(tmux): add `tds` alias for directory sessions (#11987) --- plugins/tmux/README.md | 1 + plugins/tmux/tmux.plugin.zsh | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index 0f8473daf..b4516ef26 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -25,6 +25,7 @@ The plugin also supports the following: | `tkss` | tmux kill-session -t | Terminate named running tmux session | | `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session | | `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor | +| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path | ## Configuration Variables diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 6ed91c447..72cdd4818 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -108,6 +108,19 @@ compdef _tmux _zsh_tmux_plugin_run # Alias tmux to our wrapper function. alias tmux=_zsh_tmux_plugin_run +function _tmux_directory_session() { + # current directory without leading path + local dir=${PWD##*/} + # md5 hash for the full working directory path + local md5=$(printf '%s' "$PWD" | md5sum | cut -d ' ' -f 1) + # human friendly unique session name for this directory + local session_name="${dir}-${md5:0:6}" + # create or attach to the session + tmux new -As "$session_name" +} + +alias tds=_tmux_directory_session + # Autostart if not already in tmux and enabled. if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" ]]; then # Actually don't autostart if we already did and multiple autostarts are disabled. From a8dee63ffe8839d3bcf1066f8359fa43caccf3f2 Mon Sep 17 00:00:00 2001 From: Ryan Tvenge Date: Thu, 19 Oct 2023 09:41:36 -0500 Subject: [PATCH 49/71] feat(lando): bypass `lando` if command is not available in container (#11993) Closes #11993 --- plugins/lando/lando.plugin.zsh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/lando/lando.plugin.zsh b/plugins/lando/lando.plugin.zsh index af53e7e5a..b5fa80092 100644 --- a/plugins/lando/lando.plugin.zsh +++ b/plugins/lando/lando.plugin.zsh @@ -11,15 +11,23 @@ function artisan \ php \ wp \ yarn { - if checkForLandoFile; then - lando "$0" "$@" + # If the lando task is available in `lando --help`, then it means: + # + # 1. `lando` is in a project with a `.lando.yml` file. + # 2. The lando task is available for lando, based on the .lando.yml config file. + # + # This has a penalty of about 250ms, so we still want to check if the lando file + # exists before, which is the fast path. If it exists, checking help output is + # still faster than running the command and failing. + if _lando_file_exists && lando --help 2>&1 | command grep -Eq "^ +lando $0 "; then + command lando "$0" "$@" else command "$0" "$@" fi } # Check for the file in the current and parent directories. -checkForLandoFile() { +_lando_file_exists() { # Only bother checking for lando within the Sites directory. if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then # Not within $LANDO_ZSH_SITES_DIRECTORY @@ -38,4 +46,4 @@ checkForLandoFile() { # Could not find $LANDO_ZSH_CONFIG_FILE in the current directory # or in any of its parents up to $LANDO_ZSH_SITES_DIRECTORY. return 1 -} \ No newline at end of file +} From d082d87580f05cca524c546d54eb8009cf8bb10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Oct 2023 20:35:01 +0200 Subject: [PATCH 50/71] refactor(lando): add `LANDO_ZSH_WRAPPED_COMMANDS` setting and refactor --- plugins/lando/README.md | 24 +++++++++++++++++++++--- plugins/lando/lando.plugin.zsh | 19 +++++++++++-------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/plugins/lando/README.md b/plugins/lando/README.md index 6daeae4e4..2f881cf3d 100644 --- a/plugins/lando/README.md +++ b/plugins/lando/README.md @@ -8,7 +8,7 @@ To use it, add `lando` to the plugins array in your zshrc file: plugins=(... lando) ``` -## ALIASES: +## Wrapped Commands | Alias | Description | |:----------:|:----------------:| @@ -21,16 +21,34 @@ plugins=(... lando) | `wp` | `lando wp` | | `yarn` | `lando yarn` | +More or different commands can be wrapped by setting the `LANDO_ZSH_WRAPPED_COMMANDS` setting, see [Settings](#settings) below. + ## How It Works: This plugin removes the requirement to type `lando` before a command. It utilizes the lando version of supported commands run within directories with the following criteria: + - The `.lando.yml` file is found in the current directory or any parent directory within `$LANDO_ZSH_SITES_DIRECTORY`. - The current directory is within `$LANDO_ZSH_SITES_DIRECTORY` but is not `$LANDO_ZSH_SITES_DIRECTORY` itself. +- If the command is not a part of the commands available in the lando environment, it will run the command without `lando`. ## Settings: -- `LANDO_ZSH_SITES_DIRECTORY`: The plugin will stop searching through parents for `CONFIG_FILE` once it hits this directory. -- `LANDO_ZSH_CONFIG_FILE`: The plugin will check to see if this provided file exists to check for presence of Lando. +> NOTE: these settings must be set *before* the plugin is loaded, and any changes require a restart of the shell to be applied. + +- `LANDO_ZSH_SITES_DIRECTORY`: The plugin will stop searching through parents for `CONFIG_FILE` once it hits this directory: + ```sh + LANDO_ZSH_SITES_DIRECTORY="$HOME/Code" + ``` + +- `LANDO_ZSH_CONFIG_FILE`: The plugin will check to see if this provided file exists to check for presence of Lando: + ```sh + LANDO_ZSH_CONFIG_FILE=".lando.dev.yml" + ``` + +- `LANDO_ZSH_WRAPPED_COMMANDS`: The list of commands to wrap, as a string of commands separated by whitespace: + ```sh + LANDO_ZSH_WRAPPED_COMMANDS="mysql php composer test artisan" + ``` ## Author: diff --git a/plugins/lando/lando.plugin.zsh b/plugins/lando/lando.plugin.zsh index b5fa80092..ee796d212 100644 --- a/plugins/lando/lando.plugin.zsh +++ b/plugins/lando/lando.plugin.zsh @@ -1,16 +1,19 @@ # Settings : ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"} : ${LANDO_ZSH_CONFIG_FILE:=.lando.yml} +: ${LANDO_ZSH_WRAPPED_COMMANDS:=" + artisan + composer + drush + gulp + npm + php + wp + yarn +"} # Enable multiple commands with lando. -function artisan \ - composer \ - drush \ - gulp \ - npm \ - php \ - wp \ - yarn { +function ${=LANDO_ZSH_WRAPPED_COMMANDS} { # If the lando task is available in `lando --help`, then it means: # # 1. `lando` is in a project with a `.lando.yml` file. From 9f84ba085425800dee0b4e391d8cf377806dc75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Oct 2023 20:47:26 +0200 Subject: [PATCH 51/71] feat(command-not-found): add support for Homebrew on Linux Fixes #11151 --- plugins/command-not-found/command-not-found.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index cb8a8989c..c741e18a2 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -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" From 207d29b716301c77392ae140b1482eeba44e9102 Mon Sep 17 00:00:00 2001 From: Zeeshan Date: Tue, 4 Oct 2022 18:51:24 +0530 Subject: [PATCH 52/71] fix(git)!: standardize `git pull --rebase` aliases (#11224) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BREAKING CHANGE: The alias `gup` for `git pull --rebase` and its derivatives are replaced by `gpr` for standardization. This means the previous aliases will no longer be available after a few months. Meanwhile, the original aliases are still working, with a deprecation notice. See https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/git/README.md#deprecated-aliases for the full list of deprecated aliases. Fixes #11104 Closes #11224 Co-authored-by: Marc Cornellà --- plugins/git/README.md | 434 +++++++++++++++++++------------------ plugins/git/git.plugin.zsh | 29 ++- 2 files changed, 242 insertions(+), 221 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 724965302..93dc8ccea 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -10,207 +10,205 @@ plugins=(... git) ## Aliases -| 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` | -| `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` | -| `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=` | -| `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` | -| `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` | -| `gup` | `git pull --rebase` | -| `gupa` | `git pull --rebase --autostash` | -| `gupav` | `git pull --rebase --autostash --verbose` | -| `gupv` | `git pull --rebase --verbose` | -| `ggu` | `git pull --rebase origin $(current_branch)` | -| `gupom` | `git pull --rebase origin $(git_main_branch)` | -| `gupomi` | `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)` | -| `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 -dffx` | -| `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` | +| 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` | +| `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` | +| `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=` | +| `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` | +| `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)` | +| `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 -dffx` | +| `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 @@ -224,19 +222,25 @@ branch exists. We do this via the function `git_main_branch`. 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 @@ -250,7 +254,7 @@ receive further support. | `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 ` | Renames branch `` to ``, including on the origin remote. | -| `gbda` | Deletes all merged branches | +| `gbda` | Deletes all merged branches | | `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 48937cb83..5ec2bbe2b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -246,12 +246,12 @@ 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 gup='git pull --rebase' -alias gupa='git pull --rebase --autostash' -alias gupav='git pull --rebase --autostash --verbose' -alias gupv='git pull --rebase --verbose' +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)" @@ -259,8 +259,8 @@ function ggu() { } compdef _git ggu=git-checkout -alias gupom='git pull --rebase origin $(git_main_branch)' -alias gupomi='git pull --rebase=interactive origin $(git_main_branch)' +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() { @@ -388,3 +388,20 @@ 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 From f79647dba5df47cd87917bcf527c5825be6511dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Oct 2023 22:05:03 +0200 Subject: [PATCH 53/71] fix(git): fix check in `gbds` function --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5ec2bbe2b..eef538b75 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -141,7 +141,7 @@ function gbds() { 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 + if [[ $(git cherry $default_branch $(git commit-tree $(git rev-parse $branch\^{tree}) -p $merge_base -m _)) = -* ]]; then git branch -D $branch fi done From ff6dac56a256e376a10b19a4948ada7df4509c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Oct 2023 23:04:08 +0200 Subject: [PATCH 54/71] fix(git): fix smart cd to cloned directory in `gccd` function --- plugins/git/git.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index eef538b75..6ea1d1177 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -166,8 +166,15 @@ alias gclean='git clean --interactive -d' alias gcl='git clone --recurse-submodules' function gccd() { - command git clone --recurse-submodules "$@" - [[ -d "$_" ]] && cd "$_" || cd "${${_:t}%.git}" + # 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 From 8428442ff0e0114fab32b90443911b11a4b7f5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Oct 2023 23:24:55 +0200 Subject: [PATCH 55/71] fix(termsupport): add workaround for directory tracking issues in Konsole Fixes #11683 Related: 50c6786 --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index a800e651f..d170ffcbf 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -151,7 +151,7 @@ function omz_termsupport_cwd { URL_PATH="$(omz_urlencode -P $PWD)" || return 1 # Konsole errors if the HOST is provided - [[ -z "$KONSOLE_VERSION" ]] || URL_HOST="" + [[ -z "$KONSOLE_PROFILE_NAME" && -z "$KONSOLE_DBUS_SESSION" ]] || URL_HOST="" # common control sequence (OSC 7) to set current host and path printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}" From 465253396df1865d3c73b1b3cff243798960ca3f Mon Sep 17 00:00:00 2001 From: Amir Hosseini <19665344+itsamirhn@users.noreply.github.com> Date: Sun, 22 Oct 2023 12:00:25 +0330 Subject: [PATCH 56/71] fix(direnv): use `hook` instead of `export` (#12000) --- plugins/direnv/direnv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh index 5e32c4c23..6f8debb62 100644 --- a/plugins/direnv/direnv.plugin.zsh +++ b/plugins/direnv/direnv.plugin.zsh @@ -3,7 +3,7 @@ command -v direnv &>/dev/null || return _direnv_hook() { trap -- '' SIGINT; - eval "$(direnv export zsh)"; + eval "$(direnv hook zsh)"; trap - SIGINT; } typeset -ag precmd_functions; From 1868c15ec6b13c2da20375780f1e8b8f61458be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 23 Oct 2023 13:24:35 +0200 Subject: [PATCH 57/71] chore: remove mentions of huntr.dev huntr.dev has pivoted to ML/AI-only vulnerability reporting, and we are now already using GitHub's private vulnerability reports. --- README.md | 1 - SECURITY.md | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 308d117e1..499986879 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi [![Mastodon Follow](https://img.shields.io/mastodon/follow/111169632522566717?label=%40ohmyzsh&domain=https%3A%2F%2Fmstdn.social&logo=mastodon&style=flat)](https://mstdn.social/@ohmyzsh) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) -[![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh)
Table of Contents diff --git a/SECURITY.md b/SECURITY.md index 7e5c8eed0..ae7458ee2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -17,8 +17,7 @@ In the near future we will introduce versioning, so expect this section to chang **Do not submit an issue or pull request**: this might reveal the vulnerability. -Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh). +Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh), +or using the link to [privately report a vulnerability with GitHub](https://github.com/ohmyzsh/ohmyzsh/security/advisories/new). We will deal with the vulnerability privately and submit a patch as soon as possible. - -You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward. From b7904ae54867cd9e64dfd3c1f952d72b5cfe17be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=B6=E9=B3=96=E5=A4=A7=E5=B8=9D?= Date: Tue, 24 Oct 2023 19:33:04 +0800 Subject: [PATCH 58/71] fix(firewalld): remove ` (default)` from the end of zone string (#11998) --- plugins/firewalld/firewalld.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/firewalld/firewalld.plugin.zsh b/plugins/firewalld/firewalld.plugin.zsh index 5b1090636..b2c0f64be 100644 --- a/plugins/firewalld/firewalld.plugin.zsh +++ b/plugins/firewalld/firewalld.plugin.zsh @@ -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:' From 5c22c5812ec8b980d223b8252edc7759dd354014 Mon Sep 17 00:00:00 2001 From: alps2006 Date: Tue, 24 Oct 2023 20:00:26 +0800 Subject: [PATCH 59/71] feat(vi-mode): allow replacing on visual mode (#12006) --- plugins/vi-mode/vi-mode.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index d1493e02f..8fefaf86c 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -154,7 +154,8 @@ wrap_clipboard_widgets copy \ vi-delete vi-delete-char vi-backward-delete-char wrap_clipboard_widgets paste \ - vi-put-{before,after} + vi-put-{before,after} \ + put-replace-selection unfunction wrap_clipboard_widgets From 048455ccefdc67c4f137b8f7886769c55c2e5417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 25 Oct 2023 19:47:10 +0200 Subject: [PATCH 60/71] fix(git-commit): fix revert alias conflict (#12007) Fixes #12007 --- plugins/git-commit/README.md | 14 ++++++++++---- plugins/git-commit/git-commit.plugin.zsh | 24 ++++++++++++++---------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plugins/git-commit/README.md b/plugins/git-commit/README.md index dc10d8ad5..91cc73b44 100644 --- a/plugins/git-commit/README.md +++ b/plugins/git-commit/README.md @@ -10,7 +10,7 @@ plugins=(... git-commit) ## Syntax -```zshrc +```zsh git [(-s, --scope) ""] "" ``` @@ -26,11 +26,17 @@ Where `type` is one of the following: - `fix` - `perf` - `refactor` -- `revert` +- `rev` - `style` - `test` +> 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: ` + ## Examples -`git style "remove trailing whitespace"` -> `git commit -m "style: remove trailing whitespace"` -`git fix -s "router" "correct redirect link"` -> `git commit -m "fix(router): correct redirect link"` +| Git alias | Command | +| --------------------------------------------- | ---------------------------------------------------- | +| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` | +| `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"` | diff --git a/plugins/git-commit/git-commit.plugin.zsh b/plugins/git-commit/git-commit.plugin.zsh index 4ad4c0177..72cecb1d6 100644 --- a/plugins/git-commit/git-commit.plugin.zsh +++ b/plugins/git-commit/git-commit.plugin.zsh @@ -1,9 +1,3 @@ -function _git_commit_register { - if ! git config --global --get-all alias.$1 >/dev/null 2>&1; then - git config --global alias.$1 '!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$1'(${scope}): ${@}"; else git commit -m "'$1': ${@}"; fi }; a' - fi -} - local -a _git_commit_aliases _git_commit_aliases=( 'build' @@ -19,9 +13,19 @@ _git_commit_aliases=( 'test' ) -for _alias in "${_git_commit_aliases[@]}"; do - _git_commit_register $_alias +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() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$type'(${scope}): ${@}"; else git commit -m "'$type': ${@}"; fi }; a' + if ! git config --global --get-all alias.${alias} >/dev/null 2>&1; then + git config --global alias.${alias} "$func" + fi done -unfunction _git_commit_register -unset _alias +unset _git_commit_aliases alias type func From 7348d12f8e5cd755037aa6f5d347eab0ac2efb0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 28 Oct 2023 10:24:24 +0200 Subject: [PATCH 61/71] ci(vercel): add Content-Disposition header on installer This allows doing something like curl -O https://install.ohmyz.sh and have the `install.sh` file automatically saved to its right name. --- .github/workflows/installer/vercel.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/installer/vercel.json b/.github/workflows/installer/vercel.json index 8c5aec5e0..524dc3c0f 100644 --- a/.github/workflows/installer/vercel.json +++ b/.github/workflows/installer/vercel.json @@ -2,7 +2,16 @@ "headers": [ { "source": "/((?!favicon.ico).*)", - "headers": [{ "key": "Content-Type", "value": "text/plain" }] + "headers": [ + { + "key": "Content-Type", + "value": "text/plain" + }, + { + "key": "Content-Disposition", + "value": "inline; filename=\"install.sh\"" + } + ] } ], "rewrites": [ From 7733e3ab57ee3f666cf6f3e699d03b69aca2d373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 28 Oct 2023 10:29:54 +0200 Subject: [PATCH 62/71] ci: fix path filtering in installer workflow See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-paths --- .github/workflows/installer.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index 4a25c8079..a70c483d1 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -3,9 +3,9 @@ on: workflow_dispatch: {} push: paths: - - tools/install.sh - - .github/workflows/installer - - .github/workflows/installer.yml + - 'tools/install.sh' + - '.github/workflows/installer/**' + - '.github/workflows/installer.yml' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} From cb86d378f287f1731cc6ad907f6248e35b52dc25 Mon Sep 17 00:00:00 2001 From: Josh Hubbard Date: Sat, 28 Oct 2023 04:37:50 -0400 Subject: [PATCH 63/71] feat(git-auto-fetch): fetch also submodules (#12001) --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 2df34bb7b..f8dfec759 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -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" ) &| } From 38c01a235fef0d990be5ece0d62f94fd06b10571 Mon Sep 17 00:00:00 2001 From: Sarah Noor <88581241+sarah-noor-12232@users.noreply.github.com> Date: Sat, 28 Oct 2023 20:48:45 +0500 Subject: [PATCH 64/71] feat(npm): add alias for `npm run build` (#12012) Closes #12010 --- plugins/npm/README.md | 1 + plugins/npm/npm.plugin.zsh | 3 +++ 2 files changed, 4 insertions(+) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index 420dd710a..7848a1290 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -30,6 +30,7 @@ plugins=(... npm) | `npmi` | `npm info` | Run npm info | | `npmSe` | `npm search` | Run npm search | | `npmrd` | `npm run dev` | Run npm run dev | +| `npmrb` | `npm run build` | Run npm run build | ## `npm install` / `npm uninstall` toggle diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 3cba18f6c..23377b085 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -73,6 +73,9 @@ alias npmSe="npm search" # Run npm run dev alias npmrd="npm run dev" +# Run npm run build +alias npmrb="npm run build" + npm_toggle_install_uninstall() { # Look up to the previous 2 history commands local line From 632ed413a9ce62747ded83d7736491b081be4b49 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Wed, 1 Nov 2023 21:24:28 +0100 Subject: [PATCH 65/71] fix(wd): use `(( ))` instead of `[[ ]]` zsh versions prior to 5.0.6 mark `[[ ]]` as invalid syntax Closes #12017 --- plugins/wd/wd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index e51cf906a..840e92d61 100644 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -396,7 +396,7 @@ fi # disable extendedglob for the complete wd execution time setopt | grep -q extendedglob wd_extglob_is_set=$? -[[ $wd_extglob_is_set ]] && setopt noextendedglob +(( ! $wd_extglob_is_set )) && setopt noextendedglob # load warp points typeset -A points @@ -484,7 +484,7 @@ fi # if not, next time warp will pick up variables from this run # remember, there's no sub shell -[[ $wd_extglob_is_set ]] && setopt extendedglob +(( ! $wd_extglob_is_set )) && setopt extendedglob unset wd_extglob_is_set unset wd_warp From b6bb133f230847ed0b3f9f4e25f2ceb874ca6c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 8 Nov 2023 08:42:34 +0100 Subject: [PATCH 66/71] fix(git): fix repository detection in `gccd` function (#12023) Fixes #12023 --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6ea1d1177..2a824444b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -166,6 +166,8 @@ 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/#)#]}:-$_}" From c8e600f39779c6d2ef75b40304b5391a541c41df Mon Sep 17 00:00:00 2001 From: Thomas Luzat Date: Wed, 15 Nov 2023 12:53:39 +0100 Subject: [PATCH 67/71] fix(direnv): initialize properly direnv Closes #12038 Closes #12039 Co-authored-by: Carlo Sala --- plugins/direnv/direnv.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh index 6f8debb62..0a33194dd 100644 --- a/plugins/direnv/direnv.plugin.zsh +++ b/plugins/direnv/direnv.plugin.zsh @@ -3,14 +3,14 @@ command -v direnv &>/dev/null || return _direnv_hook() { trap -- '' SIGINT; - eval "$(direnv hook zsh)"; + eval "$(direnv export zsh)"; 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 From 6165c257ae56921bf44bfa7488fd5bf179ea0e61 Mon Sep 17 00:00:00 2001 From: nexpspace <380097+nexpspace@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:25:22 +0100 Subject: [PATCH 68/71] fix(grc): source grc.zsh on gentoo (#12050) Co-authored-by: mphi Co-authored-by: Carlo Sala --- plugins/grc/grc.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/grc/grc.plugin.zsh b/plugins/grc/grc.plugin.zsh index e036b8d89..55ffc1a1e 100644 --- a/plugins/grc/grc.plugin.zsh +++ b/plugins/grc/grc.plugin.zsh @@ -5,6 +5,7 @@ files=( /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 From e0213342d12808e916dd02f8ac28509e71dc3283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9E=C3=B3rhallur=20Sverrisson?= Date: Mon, 20 Nov 2023 11:27:54 +0000 Subject: [PATCH 69/71] feat(vi-mode): add option to disable clipboard (#12037) --- plugins/vi-mode/README.md | 2 ++ plugins/vi-mode/vi-mode.plugin.zsh | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md index 821c12adb..84ba30105 100644 --- a/plugins/vi-mode/README.md +++ b/plugins/vi-mode/README.md @@ -37,6 +37,8 @@ plugins=(... vi-mode) - `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode. See [Mode indicators](#mode-indicators) for details. +- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste + ## Mode indicators *Normal mode* is indicated with a red `<<<` mark at the right prompt, when it diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 8fefaf86c..5c104f7bb 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -147,17 +147,19 @@ function wrap_clipboard_widgets() { done } -wrap_clipboard_widgets copy \ - vi-yank vi-yank-eol vi-yank-whole-line \ - vi-change vi-change-eol vi-change-whole-line \ - vi-kill-line vi-kill-eol vi-backward-kill-word \ - vi-delete vi-delete-char vi-backward-delete-char +if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then + wrap_clipboard_widgets copy \ + vi-yank vi-yank-eol vi-yank-whole-line \ + vi-change vi-change-eol vi-change-whole-line \ + vi-kill-line vi-kill-eol vi-backward-kill-word \ + vi-delete vi-delete-char vi-backward-delete-char -wrap_clipboard_widgets paste \ - vi-put-{before,after} \ - put-replace-selection + wrap_clipboard_widgets paste \ + vi-put-{before,after} \ + put-replace-selection -unfunction wrap_clipboard_widgets + unfunction wrap_clipboard_widgets +fi # if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default if [[ -z "$MODE_INDICATOR" ]]; then From 22f9a8d3b8e3c229409579caff077ec90fbac9a3 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 20 Nov 2023 14:52:32 +0200 Subject: [PATCH 70/71] fix(juju): add `public-address` fallback to `jaddr` (#12046) --- plugins/juju/juju.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/juju/juju.plugin.zsh b/plugins/juju/juju.plugin.zsh index 0c60e35ce..a82ebaf84 100644 --- a/plugins/juju/juju.plugin.zsh +++ b/plugins/juju/juju.plugin.zsh @@ -98,7 +98,7 @@ jaddr() { elif [[ $# -eq 2 ]]; then # Get unit address juju status "$1/$2" --format=json \ - | jq -r ".applications.\"$1\".units.\"$1/$2\".address" + | jq -r ".applications.\"$1\".units.\"$1/$2\" | .address // .\"public-address\"" else echo "Invalid number of arguments." echo "Usage: jaddr []" From e6a1db213d66efdaec00469e58d4f9f3f2a78bd0 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 20 Nov 2023 13:54:56 +0100 Subject: [PATCH 71/71] feat(bgnotify): add support to wayland (#12045) --- plugins/bgnotify/bgnotify.plugin.zsh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index ed2653aa8..9ad989c0b 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -59,11 +59,14 @@ function bgnotify_formatted { fi } -# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116) function bgnotify_appid { if (( ${+commands[osascript]} )); then + # output is "app ID, window ID" (com.googlecode.iterm2, 116) 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 + elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway + # output is "app_id, container id" (Alacritty, 1694) + swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' + elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 else echo $EPOCHSECONDS @@ -71,7 +74,8 @@ function bgnotify_appid { } function bgnotify { - # $1: title, $2: message + local title="$1" + local message="$2" if (( ${+commands[terminal-notifier]} )); then # macOS local term_id="${bgnotify_termid%%,*}" # remove window id if [[ -z "$term_id" ]]; then @@ -82,18 +86,22 @@ function bgnotify { fi if [[ -z "$term_id" ]]; then - terminal-notifier -message "$2" -title "$1" &>/dev/null + terminal-notifier -message "$message" -title "$title" &>/dev/null else - terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null + terminal-notifier -message "$message" -title "$title" -activate "$term_id" -sender "$term_id" &>/dev/null fi 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 + if [[ -n $ALACRITTY_WINDOW_ID ]]; then + notify-send -i Alacritty "$title" "$message" + else + notify-send "$title" "$message" + fi 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" fi }