mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
Merge branch 'ohmyzsh:master' into tmux_sessiongroup
This commit is contained in:
commit
f2a2816629
32 changed files with 435 additions and 280 deletions
6
.github/workflows/installer.yml
vendored
6
.github/workflows/installer.yml
vendored
|
@ -3,9 +3,9 @@ on:
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- tools/install.sh
|
- 'tools/install.sh'
|
||||||
- .github/workflows/installer
|
- '.github/workflows/installer/**'
|
||||||
- .github/workflows/installer.yml
|
- '.github/workflows/installer.yml'
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
|
11
.github/workflows/installer/vercel.json
vendored
11
.github/workflows/installer/vercel.json
vendored
|
@ -2,7 +2,16 @@
|
||||||
"headers": [
|
"headers": [
|
||||||
{
|
{
|
||||||
"source": "/((?!favicon.ico).*)",
|
"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": [
|
"rewrites": [
|
||||||
|
|
|
@ -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)
|
[![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)
|
[![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)
|
[![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)
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Table of Contents</summary>
|
<summary>Table of Contents</summary>
|
||||||
|
|
|
@ -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.
|
**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.
|
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.
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ function omz_termsupport_cwd {
|
||||||
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
|
||||||
|
|
||||||
# Konsole errors if the HOST is provided
|
# 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
|
# common control sequence (OSC 7) to set current host and path
|
||||||
printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
|
printf "\e]7;file://%s%s\e\\" "${URL_HOST}" "${URL_PATH}"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef bazel
|
#compdef bazel bazelisk
|
||||||
|
|
||||||
# Copyright 2015 The Bazel Authors. All rights reserved.
|
# Copyright 2015 The Bazel Authors. All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
for file (
|
for file (
|
||||||
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
||||||
/usr/share/doc/pkgfile/command-not-found.zsh
|
/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
|
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||||
/usr/local/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
|
); do
|
||||||
if [[ -r "$file" ]]; then
|
if [[ -r "$file" ]]; then
|
||||||
source "$file"
|
source "$file"
|
||||||
|
|
|
@ -3,7 +3,7 @@ command -v direnv &>/dev/null || return
|
||||||
|
|
||||||
_direnv_hook() {
|
_direnv_hook() {
|
||||||
trap -- '' SIGINT;
|
trap -- '' SIGINT;
|
||||||
eval "$(direnv export zsh)";
|
eval "$(direnv hook zsh)";
|
||||||
trap - SIGINT;
|
trap - SIGINT;
|
||||||
}
|
}
|
||||||
typeset -ag precmd_functions;
|
typeset -ag precmd_functions;
|
||||||
|
|
|
@ -9,7 +9,7 @@ function fwl () {
|
||||||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
||||||
|
|
||||||
for i in $zones; do
|
for i in $zones; do
|
||||||
sudo firewall-cmd --zone $i --list-all
|
sudo firewall-cmd --zone ${i/ \(default\)} --list-all
|
||||||
done
|
done
|
||||||
|
|
||||||
echo 'Direct Rules:'
|
echo 'Direct Rules:'
|
||||||
|
|
|
@ -29,7 +29,7 @@ function git-fetch-all {
|
||||||
date -R &>! "$gitdir/FETCH_LOG"
|
date -R &>! "$gitdir/FETCH_LOG"
|
||||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||||
GIT_TERMINAL_PROMPT=0 \
|
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"
|
||||||
) &|
|
) &|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ plugins=(... git-commit)
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
```zshrc
|
```zsh
|
||||||
git <type> [(-s, --scope) "<scope>"] "<message>"
|
git <type> [(-s, --scope) "<scope>"] "<message>"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -26,11 +26,17 @@ Where `type` is one of the following:
|
||||||
- `fix`
|
- `fix`
|
||||||
- `perf`
|
- `perf`
|
||||||
- `refactor`
|
- `refactor`
|
||||||
- `revert`
|
- `rev`
|
||||||
- `style`
|
- `style`
|
||||||
- `test`
|
- `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: <message>`
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
`git style "remove trailing whitespace"` -> `git commit -m "style: remove trailing whitespace"`
|
| Git alias | Command |
|
||||||
`git fix -s "router" "correct redirect link"` -> `git commit -m "fix(router): correct redirect link"`
|
| --------------------------------------------- | ---------------------------------------------------- |
|
||||||
|
| `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"` |
|
||||||
|
|
|
@ -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
|
local -a _git_commit_aliases
|
||||||
_git_commit_aliases=(
|
_git_commit_aliases=(
|
||||||
'build'
|
'build'
|
||||||
|
@ -19,9 +13,19 @@ _git_commit_aliases=(
|
||||||
'test'
|
'test'
|
||||||
)
|
)
|
||||||
|
|
||||||
for _alias in "${_git_commit_aliases[@]}"; do
|
local alias type
|
||||||
_git_commit_register $_alias
|
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
|
done
|
||||||
|
|
||||||
unfunction _git_commit_register
|
unset _git_commit_aliases alias type func
|
||||||
unset _alias
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ plugins=(... git)
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
|
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` |
|
||||||
| `ggpnp` | `ggl && ggp` |
|
| `ggpnp` | `ggl && ggp` |
|
||||||
| `ggpur` | `ggu` |
|
| `ggpur` | `ggu` |
|
||||||
|
@ -116,13 +116,11 @@ plugins=(... git)
|
||||||
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
|
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` |
|
||||||
| `gl` | `git pull` |
|
| `gl` | `git pull` |
|
||||||
| `gpr` | `git pull --rebase` |
|
| `gpr` | `git pull --rebase` |
|
||||||
| `gup` | `git pull --rebase` |
|
| `gprv` | `git pull --rebase -v` |
|
||||||
| `gupa` | `git pull --rebase --autostash` |
|
| `gpra` | `git pull --rebase --autostash` |
|
||||||
| `gupav` | `git pull --rebase --autostash --verbose` |
|
| `gprav` | `git pull --rebase --autostash -v` |
|
||||||
| `gupv` | `git pull --rebase --verbose` |
|
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
|
||||||
| `ggu` | `git pull --rebase origin $(current_branch)` |
|
| `gpromi` | `git pull --rebase=interactive origin $(git_main_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)"` |
|
| `ggpull` | `git pull origin "$(git_current_branch)"` |
|
||||||
| `ggl` | `git pull origin $(current_branch)` |
|
| `ggl` | `git pull origin $(current_branch)` |
|
||||||
| `gluc` | `git pull upstream $(git_current_branch)` |
|
| `gluc` | `git pull upstream $(git_current_branch)` |
|
||||||
|
@ -225,7 +223,7 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa
|
||||||
receive further support.
|
receive further support.
|
||||||
|
|
||||||
| Alias | Command | Modification |
|
| Alias | Command | Modification |
|
||||||
| :------- | :----------------------------------------------------- | :-------------------------------------------------------- |
|
| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
|
||||||
| `gap` | `git add --patch` | New alias: `gapa`. |
|
| `gap` | `git add --patch` | New alias: `gapa`. |
|
||||||
| `gcl` | `git config --list` | New alias: `gcf`. |
|
| `gcl` | `git config --list` | New alias: `gcf`. |
|
||||||
| `gdc` | `git diff --cached` | New alias: `gdca`. |
|
| `gdc` | `git diff --cached` | New alias: `gdca`. |
|
||||||
|
@ -237,6 +235,12 @@ receive further support.
|
||||||
| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
|
| `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`. |
|
| `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`. |
|
| `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
|
## Functions
|
||||||
|
|
||||||
|
@ -250,7 +254,8 @@ receive further support.
|
||||||
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
|
| `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. |
|
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
|
||||||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
|
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, 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)
|
### Work in Progress (WIP)
|
||||||
|
|
||||||
|
|
|
@ -20,26 +20,31 @@ function current_branch() {
|
||||||
function git_develop_branch() {
|
function git_develop_branch() {
|
||||||
command git rev-parse --git-dir &>/dev/null || return
|
command git rev-parse --git-dir &>/dev/null || return
|
||||||
local branch
|
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
|
if command git show-ref -q --verify refs/heads/$branch; then
|
||||||
echo $branch
|
echo $branch
|
||||||
return
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo develop
|
echo develop
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if main exists and use instead of master
|
# Check if main exists and use instead of master
|
||||||
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}; do
|
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,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
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If no main branch was found, fall back to master but return error
|
||||||
echo master
|
echo master
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function grename() {
|
function grename() {
|
||||||
|
@ -123,16 +128,20 @@ alias gba='git branch --all'
|
||||||
alias gbd='git branch --delete'
|
alias gbd='git branch --delete'
|
||||||
alias gbD='git branch --delete --force'
|
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() {
|
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
|
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)
|
local default_branch=$(git_main_branch)
|
||||||
|
(( ! $? )) || default_branch=$(git_develop_branch)
|
||||||
|
|
||||||
git for-each-ref refs/heads/ "--format=%(refname:short)" | \
|
git for-each-ref refs/heads/ "--format=%(refname:short)" | \
|
||||||
while read branch; do
|
while read branch; do
|
||||||
local merge_base=$(git merge-base $default_branch $branch)
|
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
|
git branch -D $branch
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -157,8 +166,17 @@ alias gclean='git clean --interactive -d'
|
||||||
alias gcl='git clone --recurse-submodules'
|
alias gcl='git clone --recurse-submodules'
|
||||||
|
|
||||||
function gccd() {
|
function gccd() {
|
||||||
command git clone --recurse-submodules "$@"
|
setopt localoptions extendedglob
|
||||||
[[ -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
|
compdef _git gccd=git-clone
|
||||||
|
|
||||||
|
@ -237,12 +255,12 @@ alias gmom='git merge origin/$(git_main_branch)'
|
||||||
alias gmum='git merge upstream/$(git_main_branch)'
|
alias gmum='git merge upstream/$(git_main_branch)'
|
||||||
alias gmtl='git mergetool --no-prompt'
|
alias gmtl='git mergetool --no-prompt'
|
||||||
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
alias gmtlvim='git mergetool --no-prompt --tool=vimdiff'
|
||||||
|
|
||||||
alias gl='git pull'
|
alias gl='git pull'
|
||||||
alias gpr='git pull --rebase'
|
alias gpr='git pull --rebase'
|
||||||
alias gup='git pull --rebase'
|
alias gprv='git pull --rebase -v'
|
||||||
alias gupa='git pull --rebase --autostash'
|
alias gpra='git pull --rebase --autostash'
|
||||||
alias gupav='git pull --rebase --autostash --verbose'
|
alias gprav='git pull --rebase --autostash -v'
|
||||||
alias gupv='git pull --rebase --verbose'
|
|
||||||
|
|
||||||
function ggu() {
|
function ggu() {
|
||||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||||
|
@ -250,8 +268,8 @@ function ggu() {
|
||||||
}
|
}
|
||||||
compdef _git ggu=git-checkout
|
compdef _git ggu=git-checkout
|
||||||
|
|
||||||
alias gupom='git pull --rebase origin $(git_main_branch)'
|
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||||
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)'
|
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||||
alias ggpull='git pull origin "$(git_current_branch)"'
|
alias ggpull='git pull origin "$(git_current_branch)"'
|
||||||
|
|
||||||
function ggl() {
|
function ggl() {
|
||||||
|
@ -379,3 +397,20 @@ alias gk='\gitk --all --branches &!'
|
||||||
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
|
||||||
|
|
||||||
unset git_version
|
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
|
||||||
|
|
|
@ -13,5 +13,6 @@ plugins=(... history)
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-------|----------------------|------------------------------------------------------------------|
|
|-------|----------------------|------------------------------------------------------------------|
|
||||||
| `h` | `history` | Prints your command history |
|
| `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 |
|
| `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 |
|
| `hsi` | `history \| grep -i` | Use grep to do a case-insensitive search of your command history |
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
alias h='history'
|
alias h='history'
|
||||||
|
alias hl='history | less'
|
||||||
alias hs='history | grep'
|
alias hs='history | grep'
|
||||||
alias hsi='history | grep -i'
|
alias hsi='history | grep -i'
|
||||||
|
|
|
@ -162,6 +162,7 @@ alias kdelsa="kubectl delete sa"
|
||||||
|
|
||||||
# DaemonSet management.
|
# DaemonSet management.
|
||||||
alias kgds='kubectl get daemonset'
|
alias kgds='kubectl get daemonset'
|
||||||
|
alias kgdsa='kubectl get daemonset --all-namespaces'
|
||||||
alias kgdsw='kgds --watch'
|
alias kgdsw='kgds --watch'
|
||||||
alias keds='kubectl edit daemonset'
|
alias keds='kubectl edit daemonset'
|
||||||
alias kdds='kubectl describe daemonset'
|
alias kdds='kubectl describe daemonset'
|
||||||
|
|
|
@ -8,7 +8,7 @@ To use it, add `lando` to the plugins array in your zshrc file:
|
||||||
plugins=(... lando)
|
plugins=(... lando)
|
||||||
```
|
```
|
||||||
|
|
||||||
## ALIASES:
|
## Wrapped Commands
|
||||||
|
|
||||||
| Alias | Description |
|
| Alias | Description |
|
||||||
|:----------:|:----------------:|
|
|:----------:|:----------------:|
|
||||||
|
@ -21,16 +21,34 @@ plugins=(... lando)
|
||||||
| `wp` | `lando wp` |
|
| `wp` | `lando wp` |
|
||||||
| `yarn` | `lando yarn` |
|
| `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:
|
## 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:
|
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 `.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.
|
- 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:
|
## Settings:
|
||||||
|
|
||||||
- `LANDO_ZSH_SITES_DIRECTORY`: The plugin will stop searching through parents for `CONFIG_FILE` once it hits this directory.
|
> 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_CONFIG_FILE`: The plugin will check to see if this provided file exists to check for presence of Lando.
|
|
||||||
|
- `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:
|
## Author:
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,36 @@
|
||||||
# Settings
|
# Settings
|
||||||
: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"}
|
: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"}
|
||||||
: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml}
|
: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml}
|
||||||
|
: ${LANDO_ZSH_WRAPPED_COMMANDS:="
|
||||||
|
artisan
|
||||||
|
composer
|
||||||
|
drush
|
||||||
|
gulp
|
||||||
|
npm
|
||||||
|
php
|
||||||
|
wp
|
||||||
|
yarn
|
||||||
|
"}
|
||||||
|
|
||||||
# Enable multiple commands with lando.
|
# Enable multiple commands with lando.
|
||||||
function artisan \
|
function ${=LANDO_ZSH_WRAPPED_COMMANDS} {
|
||||||
composer \
|
# If the lando task is available in `lando --help`, then it means:
|
||||||
drush \
|
#
|
||||||
gulp \
|
# 1. `lando` is in a project with a `.lando.yml` file.
|
||||||
npm \
|
# 2. The lando task is available for lando, based on the .lando.yml config file.
|
||||||
php \
|
#
|
||||||
wp \
|
# This has a penalty of about 250ms, so we still want to check if the lando file
|
||||||
yarn {
|
# exists before, which is the fast path. If it exists, checking help output is
|
||||||
if checkForLandoFile; then
|
# still faster than running the command and failing.
|
||||||
lando "$0" "$@"
|
if _lando_file_exists && lando --help 2>&1 | command grep -Eq "^ +lando $0 "; then
|
||||||
|
command lando "$0" "$@"
|
||||||
else
|
else
|
||||||
command "$0" "$@"
|
command "$0" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for the file in the current and parent directories.
|
# Check for the file in the current and parent directories.
|
||||||
checkForLandoFile() {
|
_lando_file_exists() {
|
||||||
# Only bother checking for lando within the Sites directory.
|
# Only bother checking for lando within the Sites directory.
|
||||||
if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
|
if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
|
||||||
# Not within $LANDO_ZSH_SITES_DIRECTORY
|
# Not within $LANDO_ZSH_SITES_DIRECTORY
|
||||||
|
|
|
@ -30,6 +30,7 @@ plugins=(... npm)
|
||||||
| `npmi` | `npm info` | Run npm info |
|
| `npmi` | `npm info` | Run npm info |
|
||||||
| `npmSe` | `npm search` | Run npm search |
|
| `npmSe` | `npm search` | Run npm search |
|
||||||
| `npmrd` | `npm run dev` | Run npm run dev |
|
| `npmrd` | `npm run dev` | Run npm run dev |
|
||||||
|
| `npmrb` | `npm run build` | Run npm run build |
|
||||||
|
|
||||||
## `npm install` / `npm uninstall` toggle
|
## `npm install` / `npm uninstall` toggle
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ alias npmSe="npm search"
|
||||||
# Run npm run dev
|
# Run npm run dev
|
||||||
alias npmrd="npm run dev"
|
alias npmrd="npm run dev"
|
||||||
|
|
||||||
|
# Run npm run build
|
||||||
|
alias npmrb="npm run build"
|
||||||
|
|
||||||
npm_toggle_install_uninstall() {
|
npm_toggle_install_uninstall() {
|
||||||
# Look up to the previous 2 history commands
|
# Look up to the previous 2 history commands
|
||||||
local line
|
local line
|
||||||
|
|
18
plugins/snap/README.md
Normal file
18
plugins/snap/README.md
Normal file
|
@ -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 |
|
10
plugins/snap/snap.plugin.zsh
Normal file
10
plugins/snap/snap.plugin.zsh
Normal file
|
@ -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"
|
|
@ -13,6 +13,11 @@ function _start_agent() {
|
||||||
fi
|
fi
|
||||||
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
|
# Set a maximum lifetime for identities added to ssh-agent
|
||||||
local lifetime
|
local lifetime
|
||||||
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
||||||
|
|
|
@ -25,6 +25,7 @@ The plugin also supports the following:
|
||||||
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
|
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
|
||||||
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
|
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
|
||||||
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
|
| `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
|
## Configuration Variables
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,19 @@ compdef _tmux _zsh_tmux_plugin_run
|
||||||
# Alias tmux to our wrapper function.
|
# Alias tmux to our wrapper function.
|
||||||
alias tmux=_zsh_tmux_plugin_run
|
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.
|
# 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
|
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.
|
# Actually don't autostart if we already did and multiple autostarts are disabled.
|
||||||
|
|
|
@ -154,7 +154,8 @@ wrap_clipboard_widgets copy \
|
||||||
vi-delete vi-delete-char vi-backward-delete-char
|
vi-delete vi-delete-char vi-backward-delete-char
|
||||||
|
|
||||||
wrap_clipboard_widgets paste \
|
wrap_clipboard_widgets paste \
|
||||||
vi-put-{before,after}
|
vi-put-{before,after} \
|
||||||
|
put-replace-selection
|
||||||
|
|
||||||
unfunction wrap_clipboard_widgets
|
unfunction wrap_clipboard_widgets
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ source $ZSH/oh-my-zsh.sh
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
|
| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
|
||||||
| vsc | code . | Open the current folder in VS code |
|
| 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 |
|
| 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. |
|
| 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. |
|
| vscg `file:line[:char]` | code --goto `file:line[:char]` | Open a file at the path on the specified line and character position. |
|
||||||
|
|
|
@ -23,7 +23,14 @@ if [[ -z "$VSCODE" ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias vsc="$VSCODE ."
|
function vsc {
|
||||||
|
if (( $# )); then
|
||||||
|
$VSCODE $@
|
||||||
|
else
|
||||||
|
$VSCODE .
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
alias vsca="$VSCODE --add"
|
alias vsca="$VSCODE --add"
|
||||||
alias vscd="$VSCODE --diff"
|
alias vscd="$VSCODE --diff"
|
||||||
alias vscg="$VSCODE --goto"
|
alias vscg="$VSCODE --goto"
|
||||||
|
|
|
@ -396,7 +396,7 @@ fi
|
||||||
# disable extendedglob for the complete wd execution time
|
# disable extendedglob for the complete wd execution time
|
||||||
setopt | grep -q extendedglob
|
setopt | grep -q extendedglob
|
||||||
wd_extglob_is_set=$?
|
wd_extglob_is_set=$?
|
||||||
[[ $wd_extglob_is_set ]] && setopt noextendedglob
|
(( ! $wd_extglob_is_set )) && setopt noextendedglob
|
||||||
|
|
||||||
# load warp points
|
# load warp points
|
||||||
typeset -A points
|
typeset -A points
|
||||||
|
@ -484,7 +484,7 @@ fi
|
||||||
# if not, next time warp will pick up variables from this run
|
# if not, next time warp will pick up variables from this run
|
||||||
# remember, there's no sub shell
|
# 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_extglob_is_set
|
||||||
unset wd_warp
|
unset wd_warp
|
||||||
|
|
|
@ -11,7 +11,12 @@ $(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
|
||||||
|
|
||||||
PROMPT2='%{%(!.${fg[red]}.${fg[white]})%}◀%{$reset_color%} '
|
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() {
|
function _user_host() {
|
||||||
local me
|
local me
|
||||||
|
|
|
@ -21,7 +21,7 @@ fi
|
||||||
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
|
||||||
PR_HOST='%F{red}%M%f' # SSH
|
PR_HOST='%F{red}%M%f' # SSH
|
||||||
else
|
else
|
||||||
PR_HOST='%F{green}%M%f' # no SSH
|
PR_HOST='%F{green}%m%f' # no SSH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue