1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 13:58:00 +00:00

Add vi-pound-insert as # in vicmd mode

Fixes #1534
This commit is contained in:
Kaleb Elwert 2018-01-26 18:14:10 -08:00
parent 904eef5fa5
commit 282b478fd2

View File

@ -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
# #