Merge branch 'ohmyzsh:master' into recursive_dotenv

This commit is contained in:
Heitor Polidoro 2024-06-05 10:19:59 -03:00 committed by GitHub
commit 439343b76a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 196 additions and 69 deletions

View file

@ -89,7 +89,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | | **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` | | **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're in a country like India or China, that blocks `raw.githubusercontent.com`: Alternatively, the installer is also mirrored outside GitHub. Using this URL instead may be required if you're in a country like China or India (for certain ISPs), that blocks `raw.githubusercontent.com`:
| Method | Command | | Method | Command |
| :-------- | :------------------------------------------------------------------------------------------------ | | :-------- | :------------------------------------------------------------------------------------------------ |
@ -235,7 +235,7 @@ If you're in China, India, or another country that blocks `raw.githubusercontent
#### Installing From A Forked Repository #### Installing From A Forked Repository
The install script also accepts these variables to allow installation of a different repository: The install script also accepts these variables to allow the installation of a different repository:
- `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set - `REPO` (default: `ohmyzsh/ohmyzsh`): this takes the form of `owner/repository`. If you set
this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`. this variable, the installer will look for a repository at `https://github.com/{owner}/{repository}`.
@ -309,7 +309,7 @@ If you would like to override the functionality of a plugin distributed with Oh
<a name="enable-gnu-ls"></a> <a name="enable-gnu-ls"></a>
The default behaviour in Oh My Zsh is to use BSD `ls` in macOS and freeBSD systems. If GNU `ls` is installed The default behaviour in Oh My Zsh is to use BSD `ls` in macOS and FreeBSD systems. If GNU `ls` is installed
(as `gls` command), you can choose to use it instead. To do it, you can use zstyle-based config before (as `gls` command), you can choose to use it instead. To do it, you can use zstyle-based config before
sourcing `oh-my-zsh.sh`: sourcing `oh-my-zsh.sh`:
@ -342,7 +342,7 @@ zstyle ':omz:plugins:*' aliases no
zstyle ':omz:plugins:git' aliases no zstyle ':omz:plugins:git' aliases no
``` ```
You can combine these in other ways taking into account that more specific scopes takes precedence: You can combine these in other ways taking into account that more specific scopes take precedence:
```sh ```sh
# Skip all plugin aliases, except for the git plugin # Skip all plugin aliases, except for the git plugin
@ -365,7 +365,7 @@ zstyle ':omz:lib:directories' aliases no
### Disable async git prompt ### Disable async git prompt
Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an asynchronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file, issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
before Oh My Zsh is sourced: before Oh My Zsh is sourced:

View file

@ -117,7 +117,7 @@ function bgnotify {
local icon="$3" local icon="$3"
if (( ${+commands[terminal-notifier]} )); then # macOS if (( ${+commands[terminal-notifier]} )); then # macOS
local term_id=$(bgnotify_programid) local term_id=$(bgnotify_programid)
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} &>/dev/null
elif (( ${+commands[growlnotify]} )); then # macOS growl elif (( ${+commands[growlnotify]} )); then # macOS growl
growlnotify -m "$title" "$message" growlnotify -m "$title" "$message"
elif (( ${+commands[notify-send]} )); then elif (( ${+commands[notify-send]} )); then

View file

@ -55,6 +55,16 @@ If `yes` (default), always add `-g` flag to show the group ownership.
Default: `yes` Default: `yes`
### `icons`
```zsh
zstyle ':omz:plugins:eza' 'icons' yes|no
```
If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders.
Default: `no`
### `size-prefix` ### `size-prefix`
```zsh ```zsh

View file

@ -31,6 +31,9 @@ function _configure_eza() {
if zstyle -t ':omz:plugins:eza' 'git-status'; then if zstyle -t ':omz:plugins:eza' 'git-status'; then
_EZA_TAIL+=("--git") _EZA_TAIL+=("--git")
fi fi
if zstyle -t ':omz:plugins:eza' 'icons'; then
_EZA_TAIL+=("--icons")
fi
zstyle -s ':omz:plugins:eza' 'time-style' _val zstyle -s ':omz:plugins:eza' 'time-style' _val
if [[ $_val ]]; then if [[ $_val ]]; then
_EZA_TAIL+=("--time-style='$_val'") _EZA_TAIL+=("--time-style='$_val'")

View file

@ -35,7 +35,7 @@ function git_develop_branch() {
function git_main_branch() { function git_main_branch() {
command git rev-parse --git-dir &>/dev/null || return command git rev-parse --git-dir &>/dev/null || return
local ref local ref
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,master}; do for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,stable,master}; do
if command git show-ref -q --verify $ref; then if command git show-ref -q --verify $ref; then
echo ${ref:t} echo ${ref:t}
return 0 return 0

View file

@ -25,6 +25,7 @@ plugins=(... golang)
| goi | `go install` | Compiles and installs packages to $GOPATH | | goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages | | gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules | | gom | `go mod` | Access to operations on modules |
| gomt | `go mod tidy` | Tidies up the go.mod file |
| gopa | `cd $GOPATH` | Takes you to `$GOPATH` | | gopa | `cd $GOPATH` | Takes you to `$GOPATH` |
| gopb | `cd $GOPATH/bin` | Takes you to `$GOPATH/bin` | | gopb | `cd $GOPATH/bin` | Takes you to `$GOPATH/bin` |
| gops | `cd $GOPATH/src` | Takes you to `$GOPATH/src` | | gops | `cd $GOPATH/src` | Takes you to `$GOPATH/src` |

View file

@ -22,6 +22,7 @@ alias goga='go get ./...'
alias goi='go install' alias goi='go install'
alias gol='go list' alias gol='go list'
alias gom='go mod' alias gom='go mod'
alias gomt='go mod tidy'
alias gopa='cd $GOPATH' alias gopa='cd $GOPATH'
alias gopb='cd $GOPATH/bin' alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src' alias gops='cd $GOPATH/src'

23
plugins/kitty/README.md Normal file
View file

@ -0,0 +1,23 @@
# Kitty plugin
This plugin adds a few aliases and functions that are useful for users of the [Kitty](https://sw.kovidgoyal.net/kitty/) terminal.
To use it, add _kitty_ to the plugins array of your zshrc file:
```
plugins=(... kitty)
```
## Plugin commands
* `kssh`
Runs a kitten ssh session that ensures your terminfo settings are copied
correctly to the remote hose.
* `kssh-slow`
A slower form of `kssh` that should always work. Use this if `kssh` fails
to set terminfo correctly for you on the remote host.
* `kitty-theme`
Browse and change the theme of your Kitty terminal.
## Contributors
- [Ian Chesal](https://github.com/ianchesal)

View file

@ -0,0 +1,16 @@
#####################################################
# Kitty plugin for oh-my-zsh #
#####################################################
if [[ "$TERM" == 'xterm-kitty' ]]; then
## kssh
# Use this when your terminfo isn't recognized on remote hosts.
# See: https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-when-sshing-into-a-different-computer
alias kssh="kitty +kitten ssh"
compdef kssh='ssh'
# Use this if kssh fails
alias kssh-slow="infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin"
# Change the colour theme
alias kitty-theme="kitty +kitten themes"
fi

View file

@ -180,13 +180,11 @@ alias kej='kubectl edit job'
alias kdj='kubectl describe job' alias kdj='kubectl describe job'
alias kdelj='kubectl delete job' alias kdelj='kubectl delete job'
# Only run if the user actually has kubectl installed function kj() { kubectl "$@" -o json | jq; }
if (( ${+_comps[kubectl]} )); then function kjx() { kubectl "$@" -o json | fx; }
function kj() { kubectl "$@" -o json | jq; } function ky() { kubectl "$@" -o yaml | yh; }
function kjx() { kubectl "$@" -o json | fx; } if (( ${+functions[compdef]} )); then
function ky() { kubectl "$@" -o yaml | yh; } compdef _kubectl kj
compdef _kubectl kjx
compdef kj=kubectl compdef _kubectl ky
compdef kjx=kubectl
compdef ky=kubectl
fi fi

View file

@ -8,7 +8,11 @@ To start using it, add the `macos` plugin to your plugins array in `~/.zshrc`:
plugins=(... macos) plugins=(... macos)
``` ```
Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) ## Supported Terminals
- [iTerm](https://iterm.sourceforge.net/)
- [iTerm2](https://iterm2.com/)
- [Hyper](https://hyper.is/)
- [Tabby](https://tabby.sh/)
## Commands ## Commands
@ -37,7 +41,9 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
## Acknowledgements ## Acknowledgements
This application makes use of the following third party scripts: Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
This application makes use of the following third-party scripts:
[shpotify](https://github.com/hnarayanan/shpotify) [shpotify](https://github.com/hnarayanan/shpotify)

View file

@ -79,6 +79,13 @@ EOF
key code 36 #(presses enter) key code 36 #(presses enter)
end tell end tell
EOF EOF
elif [[ "$the_app" == 'Tabby' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Tabby" to keystroke "t" using command down
end tell
EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2
return 1 return 1
@ -126,6 +133,12 @@ EOF
delay 1 delay 1
keystroke "${command} \n" keystroke "${command} \n"
end tell end tell
EOF
elif [[ "$the_app" == 'Tabby' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Tabby" to keystroke "D" using command down
end tell
EOF EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2
@ -175,6 +188,12 @@ EOF
delay 1 delay 1
keystroke "${command} \n" keystroke "${command} \n"
end tell end tell
EOF
elif [[ "$the_app" == 'Tabby' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Tabby" to keystroke "d" using command down
end tell
EOF EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2

View file

@ -20,6 +20,8 @@
_pass () { _pass () {
local cmd local cmd
local rootcontext
rootcontext=$curcontext
if (( CURRENT > 2)); then if (( CURRENT > 2)); then
cmd=${words[2]} cmd=${words[2]}
# Set the context for the subcommand. # Set the context for the subcommand.
@ -123,7 +125,8 @@ _pass_cmd_show () {
_pass_complete_entries_helper () { _pass_complete_entries_helper () {
local IFS=$'\n' local IFS=$'\n'
local prefix local prefix
zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" zstyle -s ":completion:${rootcontext}:" prefix prefix ||
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""} _values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""}
} }

View file

@ -1,4 +1,4 @@
# Struoe # Stripe
This plugin provides completion for the [Stripe CLI](https://stripe.com/docs/stripe-cli). This plugin provides completion for the [Stripe CLI](https://stripe.com/docs/stripe-cli).

View file

@ -57,6 +57,19 @@ function _build_tmux_alias {
tmux $2 $3 \"\$@\" tmux $2 $3 \"\$@\"
fi fi
}" }"
local f s
f="_omz_tmux_alias_${1}"
s=(${(z)2})
eval "function ${f}() {
shift words;
words=(tmux ${@:2} \$words);
((CURRENT+=${#s[@]}+1))
_tmux
}"
compdef "$f" "$1"
} }
alias tksv='tmux kill-server' alias tksv='tmux kill-server'

View file

@ -1,7 +1,7 @@
# Yarn plugin # Yarn plugin
This plugin adds completion for the [Yarn package manager](https://yarnpkg.com/en/), This plugin adds completion for the [Yarn package manager](https://yarnpkg.com/en/), as well as some aliases
as well as some aliases for common Yarn commands. for common Yarn commands.
To use it, add `yarn` to the plugins array in your zshrc file: To use it, add `yarn` to the plugins array in your zshrc file:
@ -11,17 +11,29 @@ plugins=(... yarn)
## Global scripts directory ## Global scripts directory
It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`. It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`. To disable this feature, set
To disable this feature, set the following style in your `.zshrc`: the following style in your `.zshrc`:
```zsh ```zsh
zstyle ':omz:plugins:yarn' global-path no zstyle ':omz:plugins:yarn' global-path no
``` ```
## Yarn Berry
If you are using Yarn berry (a.k.a. Yarn version 2 or higher) as your global Yarn version you should configure
this plugin to configure its aliases accordingly, set the following style in your `.zshrc`:
```zsh
zstyle ':omz:plugins:yarn' berry yes
```
## Aliases ## Aliases
- Aliases marked with <sup>`*`</sup> are only available when using Yarn v1 (non-berry)
- Aliases marked with <sup>`b`</sup> are only available when using Yarn berry
| Alias | Command | Description | | Alias | Command | Description |
| ----- | ----------------------------------------- | ----------------------------------------------------------------------------- | | ------------------ | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| y | `yarn` | The Yarn command | | y | `yarn` | The Yarn command |
| ya | `yarn add` | Install a package in dependencies (`package.json`) | | ya | `yarn add` | Install a package in dependencies (`package.json`) |
| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) | | yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
@ -30,17 +42,11 @@ zstyle ':omz:plugins:yarn' global-path no
| ycc | `yarn cache clean` | Clean yarn's global cache of packages | | ycc | `yarn cache clean` | Clean yarn's global cache of packages |
| yd | `yarn dev` | Run the dev script defined in `package.json` | | yd | `yarn dev` | Run the dev script defined in `package.json` |
| yf | `yarn format` | Run the dev script defined in `package.json` | | yf | `yarn format` | Run the dev script defined in `package.json` |
| yga | `yarn global add` | Install packages globally on your operating system |
| ygls | `yarn global list` | Lists global installed packages |
| ygrm | `yarn global remove` | Remove global installed packages from your OS |
| ygu | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
| yh | `yarn help` | Show help for a yarn command | | yh | `yarn help` | Show help for a yarn command |
| yi | `yarn init` | Interactively creates or updates a package.json file | | yi | `yarn init` | Interactively creates or updates a package.json file |
| yin | `yarn install` | Install dependencies defined in `package.json` | | yin | `yarn install` | Install dependencies defined in `package.json` |
| yln | `yarn lint` | Run the lint script defined in `package.json` | | yln | `yarn lint` | Run the lint script defined in `package.json` |
| ylnf | `yarn lint --fix` | Run the lint script defined in `package.json`to automatically fix problems | | ylnf | `yarn lint --fix` | Run the lint script defined in `package.json`to automatically fix problems |
| yls | `yarn list` | List installed packages |
| yout | `yarn outdated` | Check for outdated package dependencies |
| yp | `yarn pack` | Create a compressed gzip archive of package dependencies | | yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
| yrm | `yarn remove` | Remove installed packages | | yrm | `yarn remove` | Remove installed packages |
| yrun | `yarn run` | Run a defined package script | | yrun | `yarn run` | Run a defined package script |
@ -48,11 +54,21 @@ zstyle ':omz:plugins:yarn' global-path no
| yst | `yarn start` | Run the start script defined in `package.json` | | yst | `yarn start` | Run the start script defined in `package.json` |
| yt | `yarn test` | Run the test script defined in `package.json` | | yt | `yarn test` | Run the test script defined in `package.json` |
| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage | | ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade | | yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
| yuil | `yarn upgrade-interactive --latest` | Prompt for which outdated packages to upgrade to the latest available version | | yuil | `yarn upgrade-interactive --latest` (or see `yui` when using [yarn berry](#yarn-berry)) | Prompt for which outdated packages to upgrade to the latest available version |
| yii | `yarn install --frozen-lockfile` (or `yarn install --immutable` when using [yarn berry](#yarn-berry)) | Install dependencies and abort if the lockfile was to be modified |
| yifl | `yii` | Install dependencies and abort if the lockfile was to be modified |
| yup | `yarn upgrade` | Upgrade packages to their latest version | | yup | `yarn upgrade` | Upgrade packages to their latest version |
| yv | `yarn version` | Update the version of your package | | yv | `yarn version` | Update the version of your package |
| yw | `yarn workspace` | Run a command within a single workspace. | | yw | `yarn workspace` | Run a command within a single workspace. |
| yws | `yarn workspaces` | Run a command within all defined workspaces. | | yws | `yarn workspaces` | Run a command within all defined workspaces. |
| yy | `yarn why` | Show why a package has been installed, detailing which other packages depend on it | | yy | `yarn why` | Show why a package has been installed, detailing which other packages depend on it |
| yga<sup>`*`</sup> | `yarn global add` | Install packages globally on your operating system |
| ygls<sup>`*`</sup> | `yarn global list` | Lists global installed packages |
| ygrm<sup>`*`</sup> | `yarn global remove` | Remove global installed packages from your OS |
| ygu<sup>`*`</sup> | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
| yls<sup>`*`</sup> | `yarn list` | List installed packages |
| yout<sup>`*`</sup> | `yarn outdated` | Check for outdated package dependencies |
| yuca<sup>`*`</sup> | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
| ydlx<sup>`b`</sup> | `yarn dlx` | Run a package in a temporary environment. |
| yn<sup>`b`</sup> | `yarn node` | Run node with the hook already setup. |

View file

@ -18,17 +18,11 @@ alias yb="yarn build"
alias ycc="yarn cache clean" alias ycc="yarn cache clean"
alias yd="yarn dev" alias yd="yarn dev"
alias yf="yarn format" alias yf="yarn format"
alias yga="yarn global add"
alias ygls="yarn global list"
alias ygrm="yarn global remove"
alias ygu="yarn global upgrade"
alias yh="yarn help" alias yh="yarn help"
alias yi="yarn init" alias yi="yarn init"
alias yin="yarn install" alias yin="yarn install"
alias yln="yarn lint" alias yln="yarn lint"
alias ylnf="yarn lint --fix" alias ylnf="yarn lint --fix"
alias yls="yarn list"
alias yout="yarn outdated"
alias yp="yarn pack" alias yp="yarn pack"
alias yrm="yarn remove" alias yrm="yarn remove"
alias yrun="yarn run" alias yrun="yarn run"
@ -36,11 +30,35 @@ alias ys="yarn serve"
alias yst="yarn start" alias yst="yarn start"
alias yt="yarn test" alias yt="yarn test"
alias ytc="yarn test --coverage" alias ytc="yarn test --coverage"
alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive" alias yui="yarn upgrade-interactive"
alias yuil="yarn upgrade-interactive --latest"
alias yup="yarn upgrade" alias yup="yarn upgrade"
alias yv="yarn version" alias yv="yarn version"
alias yw="yarn workspace" alias yw="yarn workspace"
alias yws="yarn workspaces" alias yws="yarn workspaces"
alias yy="yarn why" alias yy="yarn why"
# Commands that are specific to the yarn version being used
if zstyle -t ':omz:plugins:yarn' berry; then
# aliases that differ
alias yuil='yui' # --latest flag was removed in yarn berry
alias yii='yarn install --immutable'
alias yifl='yarn install --immutable'
# unique aliases
alias ydlx="yarn dlx"
alias yn="yarn node"
else
# aliases that differ
alias yuil='yarn upgrade-interactive --latest'
alias yii='yarn install --frozen-lockfile'
alias yifl='yarn install --frozen-lockfile'
# unique aliases
alias yga="yarn global add"
alias ygls="yarn global list"
alias ygrm="yarn global remove"
alias ygu="yarn global upgrade"
alias yls="yarn list"
alias yout="yarn outdated"
alias yuca="yarn global upgrade && yarn cache clean"
fi