summaryrefslogtreecommitdiff
path: root/plugins/vi-mode
diff options
context:
space:
mode:
authorÞórhallur Sverrisson <toti@toti.is>2023-11-20 11:27:54 +0000
committerGitHub <noreply@github.com>2023-11-20 11:27:54 +0000
commite0213342d12808e916dd02f8ac28509e71dc3283 (patch)
tree9d56bde3523b6c298d10fbee1d5cac56b99b7176 /plugins/vi-mode
parent6165c257ae56921bf44bfa7488fd5bf179ea0e61 (diff)
downloadzsh-e0213342d12808e916dd02f8ac28509e71dc3283.tar.gz
zsh-e0213342d12808e916dd02f8ac28509e71dc3283.tar.bz2
zsh-e0213342d12808e916dd02f8ac28509e71dc3283.zip
feat(vi-mode): add option to disable clipboard (#12037)
Diffstat (limited to 'plugins/vi-mode')
-rw-r--r--plugins/vi-mode/README.md2
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh20
2 files changed, 13 insertions, 9 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
+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