4

In emacs, there is this shortcut

M-\
Delete spaces and tabs around point (delete-horizontal-space).

https://www.gnu.org/software/emacs/manual/html_node/emacs/Deletion.html

it also works in bash. I wonder if there is an equivalent in zsh, or how to define one, please?

1 Answer 1

4

I don't think there is, but you can always write it yourself as:

delete-horizontal-space() {
  emulate -L zsh
  set -o extendedglob
  LBUFFER=${LBUFFER%%[[:blank:]]##}
  RBUFFER=${RBUFFER##[[:blank:]]##}
}

zle -N delete-horizontal-space
bindkey '\e\\' delete-horizontal-space
1
  • works like a charm 👍
    – zyxue
    Jun 26, 2020 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .