Browse Source

Add vi-pound-insert as # in vicmd mode

Fixes #1534
master
Kaleb Elwert 7 years ago
parent
commit
58863c7f18
  1. 10
      modules/editor/init.zsh

10
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 # Toggle the comment character at the start of the line. This is meant to work
# around a buggy implementation of pound-insert in zsh. # 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 { function pound-toggle {
if [[ "$BUFFER" = '#'* ]]; then if [[ "$BUFFER" = '#'* ]]; then
# Because of an oddity in how zsh handles the cursor when the buffer size # 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 history-incremental-pattern-search-forward
fi 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 bindkey -M emacs "$key_info[Escape];" pound-toggle
@ -317,6 +322,9 @@ else
bindkey -M vicmd "/" history-incremental-search-forward bindkey -M vicmd "/" history-incremental-search-forward
fi fi
# Toggle comment at the start of the line.
bindkey -M vicmd "#" vi-pound-insert
# #
# Emacs and Vi Key Bindings # Emacs and Vi Key Bindings
# #

Loading…
Cancel
Save