zsh-bindings: noremap on vi mode

181 Views Asked by At

I want to bind 'dd' in the zsh's vicmd into something like 'ddi', If i use:

bindkey -M vicmd -s dd 'ddi'

It will give me this output:

zsh: string inserting another one too many times
1

There are 1 best solutions below

0
On

I found the answer already

function delete_then_insert(){
  zle kill-whole-line
  zle vi-insert
}

zle -N  delete_then_insert
bindkey -M vicmd dd delete_then_insert