aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2020-02-29 09:44:15 +0300
committerromkatv <roman.perepelitsa@gmail.com>2020-02-29 09:44:15 +0300
commit1c5358e0d5d082a50eb320a52b20fff4c17098c9 (patch)
tree265608c29c0fe23700af3682ddd239ef5e7b1a00 /internal/p10k.zsh
parent769e47a5cd0db7578f7c51e385d573c94199332a (diff)
fix visual mode indicator on zsh >= 5.3 and disable completely on < 5.3; fixes #536
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh28
1 files changed, 17 insertions, 11 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 5d02e338..c9361db9 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -6765,17 +6765,22 @@ _p9k_init_params() {
done
}
-function _p9k_on_widget_zle-keymap-select() { __p9k_reset_state=2; }
-function _p9k_on_widget_overwrite-mode() { __p9k_reset_state=2; }
-function _p9k_on_widget_vi-replace() { __p9k_reset_state=2; }
-
-function _p9k_check_visual_mode() {
- [[ ${KEYMAP:-} == vicmd ]] || return 0
- local region=${${REGION_ACTIVE:-0}/2/1}
- [[ $region != $_p9k__region_active ]] || return 0
- _p9k__region_active=$region
- __p9k_reset_state=2
-}
+function _p9k_on_widget_zle-keymap-select() { _p9k_check_visual_mode; __p9k_reset_state=2; }
+function _p9k_on_widget_overwrite-mode() { _p9k_check_visual_mode; __p9k_reset_state=2; }
+function _p9k_on_widget_vi-replace() { _p9k_check_visual_mode; __p9k_reset_state=2; }
+
+if is-at-least 5.3; then
+ function _p9k_check_visual_mode() {
+ [[ ${KEYMAP:-} == vicmd ]] || return 0
+ local region=${${REGION_ACTIVE:-0}/2/1}
+ [[ $region != $_p9k__region_active ]] || return 0
+ _p9k__region_active=$region
+ __p9k_reset_state=2
+ }
+else
+ function _p9k_check_visual_mode() {}
+fi
+
function _p9k_on_widget_visual-mode() { _p9k_check_visual_mode; }
function _p9k_on_widget_visual-line-mode() { _p9k_check_visual_mode; }
function _p9k_on_widget_deactivate-region() { _p9k_check_visual_mode; }
@@ -6847,6 +6852,7 @@ function _p9k_widget_hook() {
eval "$__p9k_intro"
(( _p9k__restore_prompt_fd )) && _p9k_restore_prompt $_p9k__restore_prompt_fd
__p9k_reset_state=1
+ _p9k_check_visual_mode
local pat idx var
for pat idx var in $_p9k_show_on_command; do
if (( $P9K_COMMANDS[(I)$pat] )); then