summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-12-09 13:20:13 -0800
committerTuowen Zhao <ztuowen@gmail.com>2023-12-09 13:20:13 -0800
commit7e951c254e779ff0620537cf43ca69dd878387b4 (patch)
treecb042e695bb3e11ed0483fad1af8a5b4f1bfc8d8 /plugins
parent4d908094fdc2a0c0e9a0a072eba213fab7adef43 (diff)
parent48ccc7b36de8efb2bd7beb9bd6e0a6f6fe03b95d (diff)
downloadzsh-7e951c254e779ff0620537cf43ca69dd878387b4.tar.gz
zsh-7e951c254e779ff0620537cf43ca69dd878387b4.tar.bz2
zsh-7e951c254e779ff0620537cf43ca69dd878387b4.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bgnotify/README.md29
-rw-r--r--plugins/bgnotify/bgnotify.plugin.zsh88
-rw-r--r--plugins/direnv/direnv.plugin.zsh6
-rw-r--r--plugins/docker-compose/README.md41
-rw-r--r--plugins/docker-compose/docker-compose.plugin.zsh1
-rw-r--r--plugins/dotnet/dotnet.plugin.zsh22
-rw-r--r--plugins/frontend-search/README.md12
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh20
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/grc/grc.plugin.zsh1
-rw-r--r--plugins/juju/juju.plugin.zsh2
-rw-r--r--plugins/per-directory-history/README.md2
-rw-r--r--plugins/per-directory-history/per-directory-history.zsh11
-rw-r--r--plugins/python/README.md2
-rw-r--r--plugins/python/python.plugin.zsh4
-rw-r--r--plugins/vi-mode/README.md2
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh20
17 files changed, 169 insertions, 96 deletions
diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md
index 1d8fac54d..33d529f15 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
@@ -35,20 +35,29 @@ 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
+- `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_bell=false ## disable terminal bell
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
-~~~
+```
diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
index ed2653aa8..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
@@ -52,53 +52,93 @@ 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
}
-# 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]} )); 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
echo $EPOCHSECONDS
fi
}
-function bgnotify {
- # $1: title, $2: message
- if (( ${+commands[terminal-notifier]} )); then # macOS
- local term_id="${bgnotify_termid%%,*}" # remove window id
- if [[ -z "$term_id" ]]; then
- case "$TERM_PROGRAM" in
+
+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
+ esac
+ fi
+ echo "$term_id"
+}
- if [[ -z "$term_id" ]]; then
- terminal-notifier -message "$2" -title "$1" &>/dev/null
- else
- terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
- fi
+function bgnotify {
+ local title="$1"
+ local message="$2"
+ local icon="$3"
+ 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
- growlnotify -m "$1" "$2"
- elif (( ${+commands[notify-send]} )); then # GNOME
- notify-send "$1" "$2"
+ growlnotify -m "$title" "$message"
+ elif (( ${+commands[notify-send]} )); then
+ notify-send "$title" "$message" ${=icon:+--icon "$icon"}
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" ${=icon:+/i "$icon"}
fi
}
## 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}
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
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"
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)
diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
index 050058931..920795060 100644
--- a/plugins/frontend-search/README.md
+++ b/plugins/frontend-search/README.md
@@ -60,12 +60,22 @@ 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!
## 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 b9e2fe95d..c96596eb9 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -27,12 +27,19 @@ 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
- 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() {
@@ -70,6 +77,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 +89,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 +104,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
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/#)#]}:-$_}"
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
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 <app-name> [<unit-number>]"
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 acbd64757..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,14 +69,16 @@ 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"
+ 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
- print -n "\nusing global history"
+ if [[ $PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE == true ]]; then
+ zle -M "using global history"
+ fi
fi
- zle .push-line
- zle .accept-line
}
autoload per-directory-history-toggle-history
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"'
diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md
index 821c12adb..84ba30105 100644
--- a/plugins/vi-mode/README.md
+++ b/plugins/vi-mode/README.md
@@ -37,6 +37,8 @@ plugins=(... vi-mode)
- `INSERT_MODE_INDICATOR`: controls the string displayed when the shell is in insert mode.
See [Mode indicators](#mode-indicators) for details.
+- `VI_MODE_DISABLE_CLIPBOARD`: If set, disables clipboard integration on yank/paste
+
## Mode indicators
*Normal mode* is indicated with a red `<<<` mark at the right prompt, when it
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 8fefaf86c..5c104f7bb 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -147,17 +147,19 @@ function wrap_clipboard_widgets() {
done
}
-wrap_clipboard_widgets copy \
- vi-yank vi-yank-eol vi-yank-whole-line \
- vi-change vi-change-eol vi-change-whole-line \
- vi-kill-line vi-kill-eol vi-backward-kill-word \
- vi-delete vi-delete-char vi-backward-delete-char
+if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then
+ wrap_clipboard_widgets copy \
+ vi-yank vi-yank-eol vi-yank-whole-line \
+ vi-change vi-change-eol vi-change-whole-line \
+ vi-kill-line vi-kill-eol vi-backward-kill-word \
+ vi-delete vi-delete-char vi-backward-delete-char
-wrap_clipboard_widgets paste \
- vi-put-{before,after} \
- put-replace-selection
+ wrap_clipboard_widgets paste \
+ vi-put-{before,after} \
+ put-replace-selection
-unfunction wrap_clipboard_widgets
+ unfunction wrap_clipboard_widgets
+fi
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
if [[ -z "$MODE_INDICATOR" ]]; then