Merge branch 'ohmyzsh:master' into master
This commit is contained in:
commit
dcd33a3fba
46 changed files with 587 additions and 375 deletions
10
.github/workflows/installer.yml
vendored
10
.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 }}
|
||||||
|
|
@ -17,6 +17,7 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test installer
|
name: Test installer
|
||||||
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -48,7 +49,8 @@ jobs:
|
||||||
env:
|
env:
|
||||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cp tools/install.sh .github/workflows/installer/install.sh
|
cp tools/install.sh .github/workflows/installer/install.sh
|
||||||
cd .github/workflows/installer
|
cd .github/workflows/installer
|
||||||
vc deploy --prod -t ${{ secrets.VERCEL_TOKEN }}
|
vc deploy --prod -t "$VERCEL_TOKEN"
|
||||||
|
|
|
||||||
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": [
|
||||||
|
|
|
||||||
13
README.md
13
README.md
|
|
@ -17,7 +17,6 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
|
||||||
[](https://mstdn.social/@ohmyzsh)
|
[](https://mstdn.social/@ohmyzsh)
|
||||||
[](https://discord.gg/ohmyzsh)
|
[](https://discord.gg/ohmyzsh)
|
||||||
[](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
|
[](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
|
||||||
[](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>
|
||||||
|
|
@ -89,6 +88,14 @@ 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`:
|
||||||
|
|
||||||
|
| Method | Command |
|
||||||
|
| :-------- | :------------------------------------------------------------------------------------------------ |
|
||||||
|
| **curl** | `sh -c "$(curl -fsSL https://install.ohmyz.sh/)"` |
|
||||||
|
| **wget** | `sh -c "$(wget -O- https://install.ohmyz.sh/)"` |
|
||||||
|
| **fetch** | `sh -c "$(fetch -o - https://install.ohmyz.sh/)"` |
|
||||||
|
|
||||||
_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`._
|
_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
|
||||||
|
|
@ -102,6 +109,8 @@ wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||||
sh install.sh
|
sh install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If the above URL times out or otherwise fails, you may have to substitute the URL for `https://install.ohmyz.sh` to be able to get the script.
|
||||||
|
|
||||||
## Using Oh My Zsh
|
## Using Oh My Zsh
|
||||||
|
|
||||||
### Plugins
|
### Plugins
|
||||||
|
|
@ -221,6 +230,8 @@ 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
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you're in China, India, or another country that blocks `raw.githubusercontent.com`, you may have to substitute the URL for `https://install.ohmyz.sh` for it to install.
|
||||||
|
|
||||||
#### 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 installation of a different repository:
|
||||||
|
|
|
||||||
|
|
@ -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.
|
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,8 @@ function omz_urlencode() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use LC_CTYPE=C to process text byte-by-byte
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
|
||||||
|
# Characters will be processed as UTF-8, which is fine for URLs.
|
||||||
local i byte ord LC_ALL=C
|
local i byte ord LC_ALL=C
|
||||||
export LC_ALL
|
export LC_ALL
|
||||||
local reserved=';/?:@&=+$,'
|
local reserved=';/?:@&=+$,'
|
||||||
|
|
@ -206,6 +208,9 @@ function omz_urlencode() {
|
||||||
else
|
else
|
||||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
url_str+="+"
|
url_str+="+"
|
||||||
|
elif [[ "$PREFIX" = *com.termux* ]]; then
|
||||||
|
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
|
||||||
|
url_str+="$byte"
|
||||||
else
|
else
|
||||||
ord=$(( [##16] #byte ))
|
ord=$(( [##16] #byte ))
|
||||||
url_str+="%$ord"
|
url_str+="%$ord"
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,13 @@ setopt multios # enable redirect to multiple streams: echo >file1 >
|
||||||
setopt long_list_jobs # show long list format job notifications
|
setopt long_list_jobs # show long list format job notifications
|
||||||
setopt interactivecomments # recognize comments
|
setopt interactivecomments # recognize comments
|
||||||
|
|
||||||
env_default 'PAGER' 'less'
|
# define pager dependant on what is available (less or more)
|
||||||
env_default 'LESS' '-R'
|
if (( ${+commands[less]} )); then
|
||||||
|
env_default 'PAGER' 'less'
|
||||||
|
env_default 'LESS' '-R'
|
||||||
|
elif (( ${+commands[more]} )); then
|
||||||
|
env_default 'PAGER' 'more'
|
||||||
|
fi
|
||||||
|
|
||||||
## super user alias
|
## super user alias
|
||||||
alias _='sudo '
|
alias _='sudo '
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
# bgnotify zsh plugin
|
# bgnotify zsh plugin
|
||||||
|
|
||||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
|
cross-platform background notifications for long running commands! Supports OSX and Linux.
|
||||||
|
|
||||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
||||||
|
|
||||||
----------------------------------
|
---
|
||||||
|
|
||||||
## How to use!
|
## How to use
|
||||||
|
|
||||||
Just add bgnotify to your plugins list in your `.zshrc`
|
Just add bgnotify to your plugins list in your `.zshrc`
|
||||||
|
|
||||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||||
- On ubuntu you're already all set!
|
- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
|
||||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||||
|
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
@ -35,20 +35,29 @@ Just add bgnotify to your plugins list in your `.zshrc`
|
||||||
|
|
||||||
One can configure a few things:
|
One can configure a few things:
|
||||||
|
|
||||||
|
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||||
- `function bgnotify_formatted` lets you change the notification
|
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||||
|
|
||||||
Use these by adding a function definition before the your call to source. Example:
|
Use these by adding a function definition before the your call to source. Example:
|
||||||
|
|
||||||
~~~ sh
|
```sh
|
||||||
|
bgnotify_bell=false ## disable terminal bell
|
||||||
bgnotify_threshold=4 ## set your own notification threshold
|
bgnotify_threshold=4 ## set your own notification threshold
|
||||||
|
|
||||||
function bgnotify_formatted {
|
function bgnotify_formatted {
|
||||||
## $1=exit_status, $2=command, $3=elapsed_time
|
## $1=exit_status, $2=command, $3=elapsed_time
|
||||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
|
|
||||||
bgnotify "$title -- after $3 s" "$2";
|
# Humanly readable elapsed time
|
||||||
|
local elapsed="$(( $3 % 60 ))s"
|
||||||
|
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||||
|
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||||
|
|
||||||
|
[ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
|
||||||
|
[ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
|
||||||
|
bgnotify "$title - took ${elapsed}" "$2" "$icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins=(git bgnotify) ## add to plugins list
|
plugins=(git bgnotify) ## add to plugins list
|
||||||
source $ZSH/oh-my-zsh.sh ## existing source call
|
source $ZSH/oh-my-zsh.sh ## existing source call
|
||||||
~~~
|
```
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ function bgnotify_end {
|
||||||
# check if Terminal app is not active
|
# check if Terminal app is not active
|
||||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
||||||
|
|
||||||
printf '\a' # beep sound
|
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
||||||
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
||||||
} always {
|
} always {
|
||||||
bgnotify_timestamp=0
|
bgnotify_timestamp=0
|
||||||
|
|
@ -52,27 +52,60 @@ function bgnotify_formatted {
|
||||||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||||
|
|
||||||
if [[ $1 -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
bgnotify "#win (took $elapsed)" "$2"
|
bgnotify "#win (took $elapsed)" "$cmd"
|
||||||
else
|
else
|
||||||
bgnotify "#fail (took $elapsed)" "$2"
|
bgnotify "#fail (took $elapsed)" "$cmd"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
|
||||||
function bgnotify_appid {
|
function bgnotify_appid {
|
||||||
if (( ${+commands[osascript]} )); then
|
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
|
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]} )); then # wayland+sway
|
||||||
|
local app_id=$(find_sway_appid)
|
||||||
|
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||||
|
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||||
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
||||||
else
|
else
|
||||||
echo $EPOCHSECONDS
|
echo $EPOCHSECONDS
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function bgnotify {
|
|
||||||
# $1: title, $2: message
|
function find_sway_appid {
|
||||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
# output is "app_id,container_id", for example "Alacritty,1694"
|
||||||
|
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
|
||||||
|
if (( ${+commands[jq]} )); then
|
||||||
|
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")'
|
||||||
|
else
|
||||||
|
swaymsg -t get_tree | awk '
|
||||||
|
BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 }
|
||||||
|
{
|
||||||
|
# Enter a block
|
||||||
|
if ($0 ~ /.*{$/) Nesting++
|
||||||
|
|
||||||
|
# Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 }
|
||||||
|
|
||||||
|
# Save the Id, it is potentially what we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 }
|
||||||
|
|
||||||
|
# Save the Appid, it is potentially what we are looking for
|
||||||
|
if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 }
|
||||||
|
|
||||||
|
# Window is focused, this nesting block contains the Id and Appid we want!
|
||||||
|
if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting }
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id
|
||||||
|
else print ""
|
||||||
|
}'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_term_id {
|
||||||
local term_id="${bgnotify_termid%%,*}" # remove window id
|
local term_id="${bgnotify_termid%%,*}" # remove window id
|
||||||
if [[ -z "$term_id" ]]; then
|
if [[ -z "$term_id" ]]; then
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
|
|
@ -80,25 +113,32 @@ function bgnotify {
|
||||||
Apple_Terminal) term_id='com.apple.terminal' ;;
|
Apple_Terminal) term_id='com.apple.terminal' ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
echo "$term_id"
|
||||||
|
}
|
||||||
|
|
||||||
if [[ -z "$term_id" ]]; then
|
function bgnotify {
|
||||||
terminal-notifier -message "$2" -title "$1" &>/dev/null
|
local title="$1"
|
||||||
else
|
local message="$2"
|
||||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
|
local icon="$3"
|
||||||
fi
|
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||||
|
local term_id=$(find_term_id)
|
||||||
|
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
|
||||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||||
growlnotify -m "$1" "$2"
|
growlnotify -m "$title" "$message"
|
||||||
elif (( ${+commands[notify-send]} )); then # GNOME
|
elif (( ${+commands[notify-send]} )); then
|
||||||
notify-send "$1" "$2"
|
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
|
||||||
elif (( ${+commands[kdialog]} )); then # KDE
|
elif (( ${+commands[kdialog]} )); then # KDE
|
||||||
kdialog --title "$1" --passivepopup "$2" 5
|
kdialog --title "$title" --passivepopup "$message" 5
|
||||||
elif (( ${+commands[notifu]} )); then # cygwin
|
elif (( ${+commands[notifu]} )); then # cygwin
|
||||||
notifu /m "$2" /p "$1"
|
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## Defaults
|
## Defaults
|
||||||
|
|
||||||
|
# enable terminal bell on notify by default
|
||||||
|
bgnotify_bell=${bgnotify_bell:-true}
|
||||||
|
|
||||||
# notify if command took longer than 5s by default
|
# notify if command took longer than 5s by default
|
||||||
bgnotify_threshold=${bgnotify_threshold:-5}
|
bgnotify_threshold=${bgnotify_threshold:-5}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ _direnv_hook() {
|
||||||
trap - SIGINT;
|
trap - SIGINT;
|
||||||
}
|
}
|
||||||
typeset -ag precmd_functions;
|
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[@]} )
|
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
||||||
fi
|
fi
|
||||||
typeset -ag chpwd_functions;
|
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[@]} )
|
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ plugins=(... docker-compose)
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-----------|--------------------------------|----------------------------------------------------------------------------------|
|
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||||
| dco | `docker-compose` | Docker-compose main command |
|
| dco | `docker-compose` | Docker-compose main command |
|
||||||
| dcb | `docker-compose build` | Build containers |
|
| dcb | `docker-compose build` | Build containers |
|
||||||
| dce | `docker-compose exec` | Execute command inside a container |
|
| dce | `docker-compose exec` | Execute command inside a container |
|
||||||
|
|
@ -28,6 +28,7 @@ plugins=(... docker-compose)
|
||||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||||
| dcl | `docker-compose logs` | Show logs of container |
|
| dcl | `docker-compose logs` | Show logs of container |
|
||||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||||
|
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||||
| dcstart | `docker-compose start` | Start a container |
|
| dcstart | `docker-compose start` | Start a container |
|
||||||
| dck | `docker-compose kill` | Kills containers |
|
| dck | `docker-compose kill` | Kills containers |
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ alias dcupdb="$dccmd up -d --build"
|
||||||
alias dcdn="$dccmd down"
|
alias dcdn="$dccmd down"
|
||||||
alias dcl="$dccmd logs"
|
alias dcl="$dccmd logs"
|
||||||
alias dclf="$dccmd logs -f"
|
alias dclf="$dccmd logs -f"
|
||||||
|
alias dclF="$dccmd logs -f --tail 0"
|
||||||
alias dcpull="$dccmd pull"
|
alias dcpull="$dccmd pull"
|
||||||
alias dcstart="$dccmd start"
|
alias dcstart="$dccmd start"
|
||||||
alias dck="$dccmd kill"
|
alias dck="$dccmd kill"
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,14 @@
|
||||||
# This scripts is copied from (MIT License):
|
# This scripts is copied from (MIT License):
|
||||||
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
|
# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
|
||||||
|
|
||||||
_dotnet_zsh_complete()
|
#compdef dotnet
|
||||||
{
|
_dotnet_completion() {
|
||||||
local completions=("$(dotnet complete "$words")")
|
local -a completions=("${(@f)$(dotnet complete "${words}")}")
|
||||||
|
compadd -a completions
|
||||||
# If the completion list is empty, just continue with filename selection
|
_files
|
||||||
if [ -z "$completions" ]
|
|
||||||
then
|
|
||||||
_arguments '*::arguments: _normal'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This is not a variable assignment, don't remove spaces!
|
|
||||||
_values = "${(ps:\n:)completions}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _dotnet_zsh_complete dotnet
|
compdef _dotnet_completion dotnet
|
||||||
|
|
||||||
# Aliases bellow are here for backwards compatibility
|
# Aliases bellow are here for backwards compatibility
|
||||||
# added by Shaun Tabone (https://github.com/xontab)
|
# added by Shaun Tabone (https://github.com/xontab)
|
||||||
|
|
|
||||||
|
|
@ -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:'
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,22 @@ Available search contexts are:
|
||||||
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
||||||
| unheap | `http://www.unheap.com/?s=` |
|
| unheap | `http://www.unheap.com/?s=` |
|
||||||
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
||||||
|
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
|
||||||
|
|
||||||
If you want to have another context, open an Issue and tell us!
|
If you want to have another context, open an Issue and tell us!
|
||||||
|
|
||||||
## Fallback search behaviour
|
## Fallback search behaviour
|
||||||
|
|
||||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
The plugin will use Google as a fallback if the docs site for a search context does not have a search
|
||||||
|
function. You can set the fallback search engine to DuckDuckGo by setting
|
||||||
|
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||||
|
|
||||||
|
## DuckDuckGo Lucky Search
|
||||||
|
|
||||||
|
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
|
||||||
|
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
|
||||||
|
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
|
||||||
|
setting unnecessary in this context.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
|
||||||
alias typescript='frontend typescript'
|
alias typescript='frontend typescript'
|
||||||
alias unheap='frontend unheap'
|
alias unheap='frontend unheap'
|
||||||
alias vuejs='frontend vuejs'
|
alias vuejs='frontend vuejs'
|
||||||
|
alias nextjs='frontend nextjs'
|
||||||
|
|
||||||
function _frontend_fallback() {
|
function _frontend_fallback() {
|
||||||
|
if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
|
||||||
|
case true in
|
||||||
|
*) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||||
esac
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function frontend() {
|
function frontend() {
|
||||||
|
|
@ -70,6 +77,7 @@ function frontend() {
|
||||||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||||
unheap 'http://www.unheap.com/?s='
|
unheap 'http://www.unheap.com/?s='
|
||||||
vuejs $(_frontend_fallback 'vuejs.org')
|
vuejs $(_frontend_fallback 'vuejs.org')
|
||||||
|
nextjs $(_frontend_fallback 'nextjs.org')
|
||||||
)
|
)
|
||||||
|
|
||||||
# show help for command list
|
# show help for command list
|
||||||
|
|
@ -81,7 +89,7 @@ function frontend() {
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
||||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||||
print -P ""
|
print -P ""
|
||||||
|
|
@ -96,7 +104,7 @@ function frontend() {
|
||||||
echo ""
|
echo ""
|
||||||
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
||||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
echo ""
|
echo ""
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,18 +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)
|
(( ! $? )) || 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
|
||||||
|
|
@ -164,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
|
||||||
|
|
||||||
|
|
@ -244,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)"
|
||||||
|
|
@ -257,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() {
|
||||||
|
|
@ -386,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
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ files=(
|
||||||
/etc/grc.zsh # default
|
/etc/grc.zsh # default
|
||||||
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
||||||
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
/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
|
# verify the file is readable and source it
|
||||||
|
|
|
||||||
|
|
@ -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'
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ jaddr() {
|
||||||
elif [[ $# -eq 2 ]]; then
|
elif [[ $# -eq 2 ]]; then
|
||||||
# Get unit address
|
# Get unit address
|
||||||
juju status "$1/$2" --format=json \
|
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
|
else
|
||||||
echo "Invalid number of arguments."
|
echo "Invalid number of arguments."
|
||||||
echo "Usage: jaddr <app-name> [<unit-number>]"
|
echo "Usage: jaddr <app-name> [<unit-number>]"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
|
||||||
and global histories.
|
and global histories.
|
||||||
* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
|
* `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history
|
||||||
function above (default `^G`)
|
function above (default `^G`)
|
||||||
|
* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
|
||||||
|
the current mode is printed to the screen following a mode change (default `true`)
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
|
[[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history"
|
||||||
[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
|
[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false
|
||||||
[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G'
|
[[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G'
|
||||||
|
[[ -z $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE ]] && PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE=true
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# toggle global/directory history used for searching - ctrl-G by default
|
# toggle global/directory history used for searching - ctrl-G by default
|
||||||
|
|
@ -68,14 +69,16 @@ function per-directory-history-toggle-history() {
|
||||||
if [[ $_per_directory_history_is_global == true ]]; then
|
if [[ $_per_directory_history_is_global == true ]]; then
|
||||||
_per-directory-history-set-directory-history
|
_per-directory-history-set-directory-history
|
||||||
_per_directory_history_is_global=false
|
_per_directory_history_is_global=false
|
||||||
print -n "\nusing local history"
|
if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
|
||||||
|
zle -M "using local history"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
_per-directory-history-set-global-history
|
_per-directory-history-set-global-history
|
||||||
_per_directory_history_is_global=true
|
_per_directory_history_is_global=true
|
||||||
print -n "\nusing global history"
|
if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
|
||||||
|
zle -M "using global history"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
zle .push-line
|
|
||||||
zle .accept-line
|
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload per-directory-history-toggle-history
|
autoload per-directory-history-toggle-history
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ plugins=(... python)
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| ---------------- | -------------------------------------------------------------------------------------- |
|
| ---------------- | -------------------------------------------------------------------------------------- |
|
||||||
| `py` | Runs `python3` |
|
| `py` | Runs `python3`. Only set if `py` is not installed. |
|
||||||
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
|
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
|
||||||
| `pyfind` | Finds .py files recursively in the current directory |
|
| `pyfind` | Finds .py files recursively in the current directory |
|
||||||
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
|
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# python command
|
# set python command if 'py' not installed
|
||||||
alias py='python3'
|
builtin which py > /dev/null || alias py='python3'
|
||||||
|
|
||||||
# Find python file
|
# Find python file
|
||||||
alias pyfind='find . -name "*.py"'
|
alias pyfind='find . -name "*.py"'
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,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.
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ plugins=(... vi-mode)
|
||||||
- `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
|
- `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
|
||||||
See [Mode indicators](#mode-indicators) for details.
|
See [Mode indicators](#mode-indicators) for details.
|
||||||
|
|
||||||
|
- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
|
||||||
|
|
||||||
## Mode indicators
|
## Mode indicators
|
||||||
|
|
||||||
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
|
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
|
||||||
|
|
|
||||||
|
|
@ -147,16 +147,19 @@ function wrap_clipboard_widgets() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap_clipboard_widgets copy \
|
if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then
|
||||||
|
wrap_clipboard_widgets copy \
|
||||||
vi-yank vi-yank-eol vi-yank-whole-line \
|
vi-yank vi-yank-eol vi-yank-whole-line \
|
||||||
vi-change vi-change-eol vi-change-whole-line \
|
vi-change vi-change-eol vi-change-whole-line \
|
||||||
vi-kill-line vi-kill-eol vi-backward-kill-word \
|
vi-kill-line vi-kill-eol vi-backward-kill-word \
|
||||||
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
|
||||||
|
fi
|
||||||
|
|
||||||
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
|
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
|
||||||
if [[ -z "$MODE_INDICATOR" ]]; then
|
if [[ -z "$MODE_INDICATOR" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%}"
|
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%c%{$reset_color%}"
|
||||||
PROMPT+=' $(git_prompt_info)'
|
PROMPT+=' $(git_prompt_info)'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%1{✗%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ zdot="${ZDOTDIR:-$HOME}"
|
||||||
# Default value for $ZSH
|
# Default value for $ZSH
|
||||||
# a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh
|
# a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh
|
||||||
# b) otherwise, $HOME/.oh-my-zsh
|
# b) otherwise, $HOME/.oh-my-zsh
|
||||||
[ "$ZDOTDIR" = "$HOME" ] || ZSH="${ZSH:-${ZDOTDIR:+$ZDOTDIR/ohmyzsh}}"
|
if [ -n "$ZDOTDIR" ] && [ "$ZDOTDIR" != "$HOME" ]; then
|
||||||
|
ZSH="${ZSH:-$ZDOTDIR/ohmyzsh}"
|
||||||
|
fi
|
||||||
ZSH="${ZSH:-$HOME/.oh-my-zsh}"
|
ZSH="${ZSH:-$HOME/.oh-my-zsh}"
|
||||||
|
|
||||||
# Default settings
|
# Default settings
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue