From b6bb133f230847ed0b3f9f4e25f2ceb874ca6c91 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 8 Nov 2023 08:42:34 +0100 Subject: fix(git): fix repository detection in `gccd` function (#12023) Fixes #12023 --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6ea1d1177..2a824444b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -166,6 +166,8 @@ alias gclean='git clean --interactive -d' alias gcl='git clone --recurse-submodules' function gccd() { + setopt localoptions extendedglob + # get repo URI from args based on valid formats: https://git-scm.com/docs/git-clone#URLS local repo="${${@[(r)(ssh://*|git://*|ftp(s)#://*|http(s)#://*|*@*)(.git/#)#]}:-$_}" -- cgit v1.2.3-70-g09d2 From c8e600f39779c6d2ef75b40304b5391a541c41df Mon Sep 17 00:00:00 2001 From: Thomas Luzat Date: Wed, 15 Nov 2023 12:53:39 +0100 Subject: fix(direnv): initialize properly direnv Closes #12038 Closes #12039 Co-authored-by: Carlo Sala --- plugins/direnv/direnv.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh index 6f8debb62..0a33194dd 100644 --- a/plugins/direnv/direnv.plugin.zsh +++ b/plugins/direnv/direnv.plugin.zsh @@ -3,14 +3,14 @@ command -v direnv &>/dev/null || return _direnv_hook() { trap -- '' SIGINT; - eval "$(direnv hook zsh)"; + eval "$(direnv export zsh)"; trap - SIGINT; } typeset -ag precmd_functions; -if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then +if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then precmd_functions=( _direnv_hook ${precmd_functions[@]} ) fi typeset -ag chpwd_functions; -if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then +if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then chpwd_functions=( _direnv_hook ${chpwd_functions[@]} ) fi -- cgit v1.2.3-70-g09d2 From 6165c257ae56921bf44bfa7488fd5bf179ea0e61 Mon Sep 17 00:00:00 2001 From: nexpspace <380097+nexpspace@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:25:22 +0100 Subject: fix(grc): source grc.zsh on gentoo (#12050) Co-authored-by: mphi Co-authored-by: Carlo Sala --- plugins/grc/grc.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/grc/grc.plugin.zsh b/plugins/grc/grc.plugin.zsh index e036b8d89..55ffc1a1e 100644 --- a/plugins/grc/grc.plugin.zsh +++ b/plugins/grc/grc.plugin.zsh @@ -5,6 +5,7 @@ files=( /etc/grc.zsh # default /usr/local/etc/grc.zsh # homebrew darwin-x64 /opt/homebrew/etc/grc.zsh # homebrew darwin-arm64 + /usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc) ) # verify the file is readable and source it -- cgit v1.2.3-70-g09d2 From e0213342d12808e916dd02f8ac28509e71dc3283 Mon Sep 17 00:00:00 2001 From: Þórhallur Sverrisson Date: Mon, 20 Nov 2023 11:27:54 +0000 Subject: feat(vi-mode): add option to disable clipboard (#12037) --- plugins/vi-mode/README.md | 2 ++ plugins/vi-mode/vi-mode.plugin.zsh | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md index 821c12adb..84ba30105 100644 --- a/plugins/vi-mode/README.md +++ b/plugins/vi-mode/README.md @@ -37,6 +37,8 @@ plugins=(... vi-mode) - `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode. See [Mode indicators](#mode-indicators) for details. +- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste + ## Mode indicators *Normal mode* is indicated with a red `<<<` mark at the right prompt, when it diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 8fefaf86c..5c104f7bb 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -147,17 +147,19 @@ function wrap_clipboard_widgets() { done } -wrap_clipboard_widgets copy \ - vi-yank vi-yank-eol vi-yank-whole-line \ - vi-change vi-change-eol vi-change-whole-line \ - vi-kill-line vi-kill-eol vi-backward-kill-word \ - vi-delete vi-delete-char vi-backward-delete-char - -wrap_clipboard_widgets paste \ - vi-put-{before,after} \ - put-replace-selection - -unfunction wrap_clipboard_widgets +if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then + wrap_clipboard_widgets copy \ + vi-yank vi-yank-eol vi-yank-whole-line \ + vi-change vi-change-eol vi-change-whole-line \ + vi-kill-line vi-kill-eol vi-backward-kill-word \ + vi-delete vi-delete-char vi-backward-delete-char + + wrap_clipboard_widgets paste \ + vi-put-{before,after} \ + put-replace-selection + + unfunction wrap_clipboard_widgets +fi # if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default if [[ -z "$MODE_INDICATOR" ]]; then -- cgit v1.2.3-70-g09d2 From 22f9a8d3b8e3c229409579caff077ec90fbac9a3 Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Mon, 20 Nov 2023 14:52:32 +0200 Subject: fix(juju): add `public-address` fallback to `jaddr` (#12046) --- plugins/juju/juju.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/juju/juju.plugin.zsh b/plugins/juju/juju.plugin.zsh index 0c60e35ce..a82ebaf84 100644 --- a/plugins/juju/juju.plugin.zsh +++ b/plugins/juju/juju.plugin.zsh @@ -98,7 +98,7 @@ jaddr() { elif [[ $# -eq 2 ]]; then # Get unit address juju status "$1/$2" --format=json \ - | jq -r ".applications.\"$1\".units.\"$1/$2\".address" + | jq -r ".applications.\"$1\".units.\"$1/$2\" | .address // .\"public-address\"" else echo "Invalid number of arguments." echo "Usage: jaddr []" -- cgit v1.2.3-70-g09d2 From e6a1db213d66efdaec00469e58d4f9f3f2a78bd0 Mon Sep 17 00:00:00 2001 From: bretello Date: Mon, 20 Nov 2023 13:54:56 +0100 Subject: feat(bgnotify): add support to wayland (#12045) --- plugins/bgnotify/bgnotify.plugin.zsh | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index ed2653aa8..9ad989c0b 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -59,11 +59,14 @@ function bgnotify_formatted { fi } -# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116) function bgnotify_appid { if (( ${+commands[osascript]} )); then + # output is "app ID, window ID" (com.googlecode.iterm2, 116) osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null - elif (( ${+commands[xprop]} )); then + elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway + # output is "app_id, container id" (Alacritty, 1694) + swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' + elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 else echo $EPOCHSECONDS @@ -71,7 +74,8 @@ function bgnotify_appid { } function bgnotify { - # $1: title, $2: message + local title="$1" + local message="$2" if (( ${+commands[terminal-notifier]} )); then # macOS local term_id="${bgnotify_termid%%,*}" # remove window id if [[ -z "$term_id" ]]; then @@ -82,18 +86,22 @@ function bgnotify { fi if [[ -z "$term_id" ]]; then - terminal-notifier -message "$2" -title "$1" &>/dev/null + terminal-notifier -message "$message" -title "$title" &>/dev/null else - terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null + terminal-notifier -message "$message" -title "$title" -activate "$term_id" -sender "$term_id" &>/dev/null fi elif (( ${+commands[growlnotify]} )); then # macOS growl - growlnotify -m "$1" "$2" - elif (( ${+commands[notify-send]} )); then # GNOME - notify-send "$1" "$2" + growlnotify -m "$title" "$message" + elif (( ${+commands[notify-send]} )); then + if [[ -n $ALACRITTY_WINDOW_ID ]]; then + notify-send -i Alacritty "$title" "$message" + else + notify-send "$title" "$message" + fi elif (( ${+commands[kdialog]} )); then # KDE - kdialog --title "$1" --passivepopup "$2" 5 + kdialog --title "$title" --passivepopup "$message" 5 elif (( ${+commands[notifu]} )); then # cygwin - notifu /m "$2" /p "$1" + notifu /m "$message" /p "$title" fi } -- cgit v1.2.3-70-g09d2 From 18073af622703a8aca28c630614d13d2f50d30fe Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Wed, 22 Nov 2023 15:22:36 +0100 Subject: fix(bgnotify): detect properly if `swaymsg` is installed Closes #12053 --- plugins/bgnotify/bgnotify.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index 9ad989c0b..493a20815 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -63,10 +63,10 @@ function bgnotify_appid { if (( ${+commands[osascript]} )); then # output is "app ID, window ID" (com.googlecode.iterm2, 116) osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null - elif [[ -n $WAYLAND_DISPLAY && ${+commands[swaymsg]} && ${+commands[jq]} ]]; then # wayland+sway + elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )) && (( ${+commands[jq]} )); then # wayland+sway # output is "app_id, container id" (Alacritty, 1694) swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' - elif [[ -n $DISPLAY && ${+commands[xprop]} ]]; then + elif [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 else echo $EPOCHSECONDS -- cgit v1.2.3-70-g09d2 From 44a5513fcb3f528afb056490908d216f926497e6 Mon Sep 17 00:00:00 2001 From: Saduff <11700507+Saduff@users.noreply.github.com> Date: Wed, 22 Nov 2023 10:44:21 -0700 Subject: fix(per-directory-history): print toggle message properly (#10872) --- plugins/per-directory-history/per-directory-history.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index acbd64757..cfc4535d3 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -68,14 +68,14 @@ function per-directory-history-toggle-history() { if [[ $_per_directory_history_is_global == true ]]; then _per-directory-history-set-directory-history _per_directory_history_is_global=false - print -n "\nusing local history" + zle -I + echo "using local history" else _per-directory-history-set-global-history _per_directory_history_is_global=true - print -n "\nusing global history" + zle -I + echo "using global history" fi - zle .push-line - zle .accept-line } autoload per-directory-history-toggle-history -- cgit v1.2.3-70-g09d2 From 38e80e9f21ee981b5f616003c788dcbb9267466c Mon Sep 17 00:00:00 2001 From: Johan Sjöblom Date: Thu, 23 Nov 2023 10:11:08 +0000 Subject: feat(bgnotify): add icon parameter (#12055) --- plugins/bgnotify/bgnotify.plugin.zsh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index 493a20815..a4a7b621b 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -52,10 +52,10 @@ function bgnotify_formatted { (( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed" (( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed" - if [[ $1 -eq 0 ]]; then - bgnotify "#win (took $elapsed)" "$2" + if [[ $exit_status -eq 0 ]]; then + bgnotify "#win (took $elapsed)" "$cmd" else - bgnotify "#fail (took $elapsed)" "$2" + bgnotify "#fail (took $elapsed)" "$cmd" fi } @@ -66,7 +66,7 @@ function bgnotify_appid { elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )) && (( ${+commands[jq]} )); then # wayland+sway # output is "app_id, container id" (Alacritty, 1694) swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' - elif [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then + elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5 else echo $EPOCHSECONDS @@ -76,6 +76,7 @@ function bgnotify_appid { function bgnotify { local title="$1" local message="$2" + local icon="$3" if (( ${+commands[terminal-notifier]} )); then # macOS local term_id="${bgnotify_termid%%,*}" # remove window id if [[ -z "$term_id" ]]; then @@ -85,23 +86,15 @@ function bgnotify { esac fi - if [[ -z "$term_id" ]]; then - terminal-notifier -message "$message" -title "$title" &>/dev/null - else - terminal-notifier -message "$message" -title "$title" -activate "$term_id" -sender "$term_id" &>/dev/null - fi + terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null elif (( ${+commands[growlnotify]} )); then # macOS growl growlnotify -m "$title" "$message" elif (( ${+commands[notify-send]} )); then - if [[ -n $ALACRITTY_WINDOW_ID ]]; then - notify-send -i Alacritty "$title" "$message" - else - notify-send "$title" "$message" - fi + notify-send "$title" "$message" ${=icon:+--icon "$icon"} elif (( ${+commands[kdialog]} )); then # KDE kdialog --title "$title" --passivepopup "$message" 5 elif (( ${+commands[notifu]} )); then # cygwin - notifu /m "$message" /p "$title" + notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} fi } -- cgit v1.2.3-70-g09d2 From 6c5586cb085d5cc6fb42b7304428654cc6bf5f31 Mon Sep 17 00:00:00 2001 From: Johan Sjöblom Date: Thu, 23 Nov 2023 19:00:34 +0000 Subject: docs(bgnotify): match README with current features (#12057) --- plugins/bgnotify/README.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md index 1d8fac54d..6bbe3b302 100644 --- a/plugins/bgnotify/README.md +++ b/plugins/bgnotify/README.md @@ -1,19 +1,19 @@ # bgnotify zsh plugin -cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux. +cross-platform background notifications for long running commands! Supports OSX and Linux. Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify) ----------------------------------- +--- -## How to use! +## How to use Just add bgnotify to your plugins list in your `.zshrc` - On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier) * `brew install terminal-notifier` (or `gem install terminal-notifier`) -- On ubuntu you're already all set! -- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package +- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set! +- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package ## Screenshots @@ -36,19 +36,26 @@ Just add bgnotify to your plugins list in your `.zshrc` One can configure a few things: - `bgnotify_threshold` sets the notification threshold time (default 6 seconds) -- `function bgnotify_formatted` lets you change the notification +- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon. Use these by adding a function definition before the your call to source. Example: -~~~ sh +```sh bgnotify_threshold=4 ## set your own notification threshold function bgnotify_formatted { ## $1=exit_status, $2=command, $3=elapsed_time - [ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!" - bgnotify "$title -- after $3 s" "$2"; + + # Humanly readable elapsed time + local elapsed="$(( $3 % 60 ))s" + (( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed" + (( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed" + + [ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin" + [ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png" + bgnotify "$title - took ${elapsed}" "$2" "$icon" } plugins=(git bgnotify) ## add to plugins list source $ZSH/oh-my-zsh.sh ## existing source call -~~~ +``` -- cgit v1.2.3-70-g09d2 From 76a1dfcf2b5365e966bbc75749d9ced985c2d674 Mon Sep 17 00:00:00 2001 From: Mamad Kajbaf Date: Thu, 23 Nov 2023 11:03:59 -0800 Subject: feat(docker-compose): add `dclF` alias (#10603) --- plugins/docker-compose/README.md | 41 ++++++++++++------------ plugins/docker-compose/docker-compose.plugin.zsh | 1 + 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md index bbcff2e0c..66d4e0521 100644 --- a/plugins/docker-compose/README.md +++ b/plugins/docker-compose/README.md @@ -11,23 +11,24 @@ plugins=(... docker-compose) ## Aliases -| Alias | Command | Description | -|-----------|--------------------------------|----------------------------------------------------------------------------------| -| dco | `docker-compose` | Docker-compose main command | -| dcb | `docker-compose build` | Build containers | -| dce | `docker-compose exec` | Execute command inside a container | -| dcps | `docker-compose ps` | List containers | -| dcrestart | `docker-compose restart` | Restart container | -| dcrm | `docker-compose rm` | Remove container | -| dcr | `docker-compose run` | Run a command in container | -| dcstop | `docker-compose stop` | Stop a container | -| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | -| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | -| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | -| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon | -| dcdn | `docker-compose down` | Stop and remove containers | -| dcl | `docker-compose logs` | Show logs of container | -| dclf | `docker-compose logs -f` | Show logs and follow output | -| dcpull | `docker-compose pull` | Pull image of a service | -| dcstart | `docker-compose start` | Start a container | -| dck | `docker-compose kill` | Kills containers | +| Alias | Command | Description | +|-----------|----------------------------------|----------------------------------------------------------------------------------| +| dco | `docker-compose` | Docker-compose main command | +| dcb | `docker-compose build` | Build containers | +| dce | `docker-compose exec` | Execute command inside a container | +| dcps | `docker-compose ps` | List containers | +| dcrestart | `docker-compose restart` | Restart container | +| dcrm | `docker-compose rm` | Remove container | +| dcr | `docker-compose run` | Run a command in container | +| dcstop | `docker-compose stop` | Stop a container | +| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | +| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | +| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | +| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon | +| dcdn | `docker-compose down` | Stop and remove containers | +| dcl | `docker-compose logs` | Show logs of container | +| dclf | `docker-compose logs -f` | Show logs and follow output | +| dclF | `docker-compose logs -f --tail0` | Just follow recent logs | +| dcpull | `docker-compose pull` | Pull image of a service | +| dcstart | `docker-compose start` | Start a container | +| dck | `docker-compose kill` | Kills containers | diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 7a8bf4a03..d1823f535 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -16,6 +16,7 @@ alias dcupdb="$dccmd up -d --build" alias dcdn="$dccmd down" alias dcl="$dccmd logs" alias dclf="$dccmd logs -f" +alias dclF="$dccmd logs -f --tail 0" alias dcpull="$dccmd pull" alias dcstart="$dccmd start" alias dck="$dccmd kill" -- cgit v1.2.3-70-g09d2 From ddf673b36dd43e5ca60189a117c25ad6f55457e7 Mon Sep 17 00:00:00 2001 From: MikuHatsune39 <32179075+MikuHatsune39@users.noreply.github.com> Date: Fri, 24 Nov 2023 00:35:46 -0800 Subject: fix(python): set `py` alias if `py` is not installed (#12059) Co-authored-by: Carlo Sala --- plugins/python/README.md | 2 +- plugins/python/python.plugin.zsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/python/README.md b/plugins/python/README.md index 97c1a34ee..7bf1b34ac 100644 --- a/plugins/python/README.md +++ b/plugins/python/README.md @@ -12,7 +12,7 @@ plugins=(... python) | 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 | | `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 | diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 2fbb59577..3d7ca55c9 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -1,5 +1,5 @@ -# python command -alias py='python3' +# set python command if 'py' not installed +builtin which py > /dev/null || alias py='python3' # Find python file alias pyfind='find . -name "*.py"' -- cgit v1.2.3-70-g09d2 From e11d81303753b0fefbc50ce10ec4612c7ff33e84 Mon Sep 17 00:00:00 2001 From: Yuxuan Lu Date: Fri, 24 Nov 2023 03:45:32 -0500 Subject: fix(robbyrussell): line wrapping for some systems (#12058) --- themes/robbyrussell.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 173e6d579..cfecfc892 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -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)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" 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]%})" -- cgit v1.2.3-70-g09d2 From 7e3fdf33ec53821e574b8d6df43bec7264c507ee Mon Sep 17 00:00:00 2001 From: Bernard Grymonpon Date: Mon, 27 Nov 2023 11:07:51 +0100 Subject: fix(misc): only set PAGER if `less` or `more` are available (#12060) --- lib/misc.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 132f33551..ff2017713 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -19,8 +19,13 @@ setopt multios # enable redirect to multiple streams: echo >file1 > setopt long_list_jobs # show long list format job notifications setopt interactivecomments # recognize comments -env_default 'PAGER' 'less' -env_default 'LESS' '-R' +# define pager dependant on what is available (less or more) +if (( ${+commands[less]} )); then + env_default 'PAGER' 'less' + env_default 'LESS' '-R' +elif (( ${+commands[more]} )); then + env_default 'PAGER' 'more' +fi ## super user alias alias _='sudo ' -- cgit v1.2.3-70-g09d2 From 418046e9583f635b0303e4b8cf31c356b175cec3 Mon Sep 17 00:00:00 2001 From: cohml <62400541+cohml@users.noreply.github.com> Date: Wed, 29 Nov 2023 04:15:32 -0500 Subject: feat(per-directory-history): add option to reduce verbosity (#12069) Co-authored-by: Chris Hamill --- plugins/per-directory-history/README.md | 2 ++ plugins/per-directory-history/per-directory-history.zsh | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md index 69854aa38..11150b059 100644 --- a/plugins/per-directory-history/README.md +++ b/plugins/per-directory-history/README.md @@ -34,6 +34,8 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable. and global histories. * `PER_DIRECTORY_HISTORY_TOGGLE` is the key binding used to run the toggle-history 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 diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index cfc4535d3..b33e0b5dd 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -59,6 +59,7 @@ [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" [[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false [[ -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 @@ -68,13 +69,15 @@ function per-directory-history-toggle-history() { if [[ $_per_directory_history_is_global == true ]]; then _per-directory-history-set-directory-history _per_directory_history_is_global=false - zle -I - echo "using local history" + if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then + zle -M "using local history" + fi else _per-directory-history-set-global-history _per_directory_history_is_global=true - zle -I - echo "using global history" + if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then + zle -M "using global history" + fi fi } -- cgit v1.2.3-70-g09d2 From 7a30bcae40dfd19153ad6fc4abd52dfa805dbd03 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 30 Nov 2023 14:15:21 +0100 Subject: ci(installer): fix token passing and only run on main repo --- .github/workflows/installer.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/installer.yml b/.github/workflows/installer.yml index a70c483d1..cad5d445b 100644 --- a/.github/workflows/installer.yml +++ b/.github/workflows/installer.yml @@ -17,6 +17,7 @@ permissions: jobs: test: name: Test installer + if: github.repository == 'ohmyzsh/ohmyzsh' runs-on: ${{ matrix.os }} strategy: matrix: @@ -48,7 +49,8 @@ jobs: env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} run: | cp tools/install.sh .github/workflows/installer/install.sh cd .github/workflows/installer - vc deploy --prod -t ${{ secrets.VERCEL_TOKEN }} + vc deploy --prod -t "$VERCEL_TOKEN" -- cgit v1.2.3-70-g09d2 From f9993d0c687c0fb50490aa530adee57ea4c70c12 Mon Sep 17 00:00:00 2001 From: "Olivia (Zoe)" Date: Fri, 1 Dec 2023 16:06:50 +0100 Subject: docs: document the off-GitHub installation URL (#12079) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 499986879..98743432d 100644 --- a/README.md +++ b/README.md @@ -88,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)"` | | **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`._ #### Manual Inspection @@ -101,6 +109,8 @@ wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/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 ### Plugins @@ -220,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 ``` +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 The install script also accepts these variables to allow installation of a different repository: -- cgit v1.2.3-70-g09d2 From 9b5b389c22396552086480474c108380817a44a7 Mon Sep 17 00:00:00 2001 From: Johan Sjöblom Date: Sat, 25 Nov 2023 11:27:59 +0100 Subject: refactor(bgnotify): get Sway AppId with `awk` as fallback (#12062) Closes #12062 --- plugins/bgnotify/bgnotify.plugin.zsh | 58 +++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index a4a7b621b..4499d816c 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -63,9 +63,9 @@ function bgnotify_appid { if (( ${+commands[osascript]} )); then # output is "app ID, window ID" (com.googlecode.iterm2, 116) osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null - elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )) && (( ${+commands[jq]} )); then # wayland+sway - # output is "app_id, container id" (Alacritty, 1694) - swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(", ")' + elif [[ -n $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 else @@ -73,19 +73,55 @@ function bgnotify_appid { fi } + +function find_sway_appid { + # output is "app_id,container_id", for example "Alacritty,1694" + # see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json + if (( ${+commands[jq]} )); then + swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")' + else + swaymsg -t get_tree | awk ' + BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 } + { + # Enter a block + if ($0 ~ /.*{$/) Nesting++ + + # Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for + if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 } + + # Save the Id, it is potentially what we are looking for + if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 } + + # Save the Appid, it is potentially what we are looking for + if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 } + + # Window is focused, this nesting block contains the Id and Appid we want! + if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting } + } + END { + if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id + else print "" + }' + fi +} + +function find_term_id { + local term_id="${bgnotify_termid%%,*}" # remove window id + if [[ -z "$term_id" ]]; then + case "$TERM_PROGRAM" in + iTerm.app) term_id='com.googlecode.iterm2' ;; + Apple_Terminal) term_id='com.apple.terminal' ;; + esac + fi + echo "$term_id" +} + function bgnotify { local title="$1" local message="$2" local icon="$3" if (( ${+commands[terminal-notifier]} )); then # macOS - local term_id="${bgnotify_termid%%,*}" # remove window id - if [[ -z "$term_id" ]]; then - case "$TERM_PROGRAM" in - iTerm.app) term_id='com.googlecode.iterm2' ;; - Apple_Terminal) term_id='com.apple.terminal' ;; - esac - fi - + 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 growlnotify -m "$title" "$message" -- cgit v1.2.3-70-g09d2 From b6afbbea3a6f41e4016e967da57b33872aff9944 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 1 Dec 2023 17:03:15 +0100 Subject: fix(installer): fix path logic and improve clarity on ZDOTDIR use --- tools/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index fcfbcf778..508fc2f77 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -63,7 +63,9 @@ zdot="${ZDOTDIR:-$HOME}" # Default value for $ZSH # a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh # 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}" # Default settings -- cgit v1.2.3-70-g09d2 From 0a9d82780e20e24b6fafc5b2aaefedb0957986c9 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Fri, 1 Dec 2023 17:09:48 +0100 Subject: feat(bgnotify): add option to disable terminal bell (#12077) --- plugins/bgnotify/README.md | 2 ++ plugins/bgnotify/bgnotify.plugin.zsh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md index 6bbe3b302..33d529f15 100644 --- a/plugins/bgnotify/README.md +++ b/plugins/bgnotify/README.md @@ -35,12 +35,14 @@ Just add bgnotify to your plugins list in your `.zshrc` One can configure a few things: +- `bgnotify_bell` enabled or disables the terminal bell (default true) - `bgnotify_threshold` sets the notification threshold time (default 6 seconds) - `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon. Use these by adding a function definition before the your call to source. Example: ```sh +bgnotify_bell=false ## disable terminal bell bgnotify_threshold=4 ## set your own notification threshold function bgnotify_formatted { diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index 4499d816c..3c0766191 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -27,7 +27,7 @@ function bgnotify_end { # check if Terminal app is not active [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return - printf '\a' # beep sound + [[ $bgnotify_bell = true ]] && printf '\a' # beep sound bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed" } always { bgnotify_timestamp=0 @@ -136,6 +136,9 @@ function bgnotify { ## Defaults +# enable terminal bell on notify by default +bgnotify_bell=${bgnotify_bell:-true} + # notify if command took longer than 5s by default bgnotify_threshold=${bgnotify_threshold:-5} -- cgit v1.2.3-70-g09d2 From 1ae0515a80686d33406c9a2c58c0c9666ca47c77 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 6 Dec 2023 08:09:45 +0100 Subject: fix(lib): patch `omz_urlencode` to not encode UTF-8 chars in Termux (#12076) Fixes #12061 --- lib/functions.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index a252d0a33..f5c671f9c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -182,6 +182,8 @@ function omz_urlencode() { fi # 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 export LC_ALL local reserved=';/?:@&=+$,' @@ -206,6 +208,9 @@ function omz_urlencode() { else if [[ "$byte" == " " && -n $spaces_as_plus ]]; then 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 ord=$(( [##16] #byte )) url_str+="%$ord" -- cgit v1.2.3-70-g09d2 From c37df3ebd48df98b0987d891acc7ea30044bb113 Mon Sep 17 00:00:00 2001 From: Josh Hubbard Date: Wed, 6 Dec 2023 09:13:19 +0100 Subject: feat(frontend-search): add nextjs --- plugins/frontend-search/README.md | 1 + plugins/frontend-search/frontend-search.plugin.zsh | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index 050058931..619d31e7f 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -60,6 +60,7 @@ Available search contexts are: | typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` | | unheap | `http://www.unheap.com/?s=` | | vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` | +| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` | If you want to have another context, open an Issue and tell us! diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index b9e2fe95d..541b23701 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -27,6 +27,7 @@ alias stackoverflow='frontend stackoverflow' alias typescript='frontend typescript' alias unheap='frontend unheap' alias vuejs='frontend vuejs' +alias nextjs='frontend nextjs' function _frontend_fallback() { case "$FRONTEND_SEARCH_FALLBACK" in @@ -70,6 +71,7 @@ function frontend() { typescript $(_frontend_fallback 'www.typescriptlang.org/docs') unheap 'http://www.unheap.com/?s=' vuejs $(_frontend_fallback 'vuejs.org') + nextjs $(_frontend_fallback 'nextjs.org') ) # show help for command list @@ -81,7 +83,7 @@ function frontend() { print -P "" print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash," - print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" + print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs" print -P "" print -P "For example: frontend npmjs mocha (or just: npmjs mocha)." print -P "" @@ -96,7 +98,7 @@ function frontend() { echo "" echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash," - echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" + echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs" echo "" return 1 fi -- cgit v1.2.3-70-g09d2 From 346bd1cd53e1bd3bd881f94552efadeebab430e4 Mon Sep 17 00:00:00 2001 From: Josh Hubbard Date: Wed, 6 Dec 2023 09:15:53 +0100 Subject: feat(frontend-search): add `I am lucky` option --- plugins/frontend-search/README.md | 11 ++++++++++- plugins/frontend-search/frontend-search.plugin.zsh | 14 ++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index 619d31e7f..920795060 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -66,7 +66,16 @@ If you want to have another context, open an Issue and tell us! ## Fallback search behaviour -The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced. +The plugin will use Google as a fallback if the docs site for a search context does not have a search +function. You can set the fallback search engine to DuckDuckGo by setting +`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced. + +## DuckDuckGo Lucky Search + +Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature +is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY +environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK +setting unnecessary in this context. ## Author diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 541b23701..c96596eb9 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -30,10 +30,16 @@ alias vuejs='frontend vuejs' alias nextjs='frontend nextjs' function _frontend_fallback() { - case "$FRONTEND_SEARCH_FALLBACK" in - duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;; - *) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;; - esac + if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then + case true in + *) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;; + esac + else + case "$FRONTEND_SEARCH_FALLBACK" in + duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;; + *) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;; + esac + fi } function frontend() { -- cgit v1.2.3-70-g09d2 From 48ccc7b36de8efb2bd7beb9bd6e0a6f6fe03b95d Mon Sep 17 00:00:00 2001 From: Jasmin Date: Wed, 6 Dec 2023 08:22:06 +0000 Subject: feat(dotnet): update completion script (#12028) --- plugins/dotnet/dotnet.plugin.zsh | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh index 89d464670..40ee7efae 100644 --- a/plugins/dotnet/dotnet.plugin.zsh +++ b/plugins/dotnet/dotnet.plugin.zsh @@ -1,22 +1,14 @@ # This scripts is copied from (MIT License): -# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh +# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh -_dotnet_zsh_complete() -{ - local completions=("$(dotnet complete "$words")") - - # If the completion list is empty, just continue with filename selection - if [ -z "$completions" ] - then - _arguments '*::arguments: _normal' - return - fi - - # This is not a variable assignment, don't remove spaces! - _values = "${(ps:\n:)completions}" +#compdef dotnet +_dotnet_completion() { + local -a completions=("${(@f)$(dotnet complete "${words}")}") + compadd -a completions + _files } -compdef _dotnet_zsh_complete dotnet +compdef _dotnet_completion dotnet # Aliases bellow are here for backwards compatibility # added by Shaun Tabone (https://github.com/xontab) -- cgit v1.2.3-70-g09d2