From c510f8b9c8bea8595423a6ce7760bdc06cd73adb Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 8 Aug 2017 00:57:36 +0100 Subject: [PATCH] dot/zshrc: `delete-horizontal-space' (M-\) and `just-one-space' (M-SPC). Organization: Straylight/Edgeware From: Mark Wooding --- dot/zshrc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dot/zshrc b/dot/zshrc index 2e86a7d..e332557 100644 --- a/dot/zshrc +++ b/dot/zshrc @@ -64,6 +64,21 @@ bindkey "\e^l" up-case-word-shell bindkey "\ec" capitalize-word-bash bindkey "\e^c" capitalize-word-shell +__mdw_delete_horizontal_space () { + LBUFFER=${LBUFFER%%[[:space:]]##} + RBUFFER=${RBUFFER##[[:space:]]##} +} +zle -N delete-horizontal-space __mdw_delete_horizontal_space +bindkey "\e\\" delete-horizontal-space + +__mdw_just_one_space () { + LBUFFER="${LBUFFER%%[[:space:]]##} " + RBUFFER=${RBUFFER##[[:space:]]##} +} +zle -N just-one-space __mdw_just_one_space +bindkey "\e " just-one-space + + ###-------------------------------------------------------------------------- ### Completion. -- [mdw]