From 282b478fd2eb6658c063d4f32b9856201e5b886c Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 26 Jan 2018 18:14:10 -0800 Subject: [PATCH] Add vi-pound-insert as # in vicmd mode Fixes #1534 --- modules/editor/init.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/editor/init.zsh b/modules/editor/init.zsh index 3c4c9df6..085947ef 100644 --- a/modules/editor/init.zsh +++ b/modules/editor/init.zsh @@ -243,6 +243,9 @@ zle -N glob-alias # Toggle the comment character at the start of the line. This is meant to work # around a buggy implementation of pound-insert in zsh. +# +# This is currently only used for the emacs keys because vi-pound-insert has +# been reported to work properly. function pound-toggle { if [[ "$BUFFER" = '#'* ]]; then # Because of an oddity in how zsh handles the cursor when the buffer size @@ -294,7 +297,9 @@ if (( $+widgets[history-incremental-pattern-search-backward] )); then history-incremental-pattern-search-forward fi -# Toggle comment at the start of the line. +# Toggle comment at the start of the line. Note that we use pound-toggle which +# is similar to pount insert, but meant to work around some issues that were +# being seen in iTerm. bindkey -M emacs "$key_info[Escape];" pound-toggle @@ -317,6 +322,9 @@ else bindkey -M vicmd "/" history-incremental-search-forward fi +# Toggle comment at the start of the line. +bindkey -M vicmd "#" vi-pound-insert + # # Emacs and Vi Key Bindings #