chiark / gitweb /
dot/zshrc: `delete-horizontal-space' (M-\) and `just-one-space' (M-SPC).
authorMark Wooding <mdw@distorted.org.uk>
Mon, 7 Aug 2017 23:57:36 +0000 (00:57 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 8 Aug 2017 01:00:25 +0000 (02:00 +0100)
dot/zshrc

index 2e86a7dfebd44c5d2a9aa9e507878864543eadab..e33255741bb6f9a22a9627ab8ee961343c6d6ac6 100644 (file)
--- 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.