jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
3.31k stars 113 forks source link

Overriding key does not seem to work #291

Closed iangregsondev closed 2 months ago

iangregsondev commented 2 months ago

General information

Basic examination

Problem description

Trying to assign a key to an already assigned key.

For example, I am trying to assign ^a, ^t

^t gets assigned but ^a does not, I assume its because it already exists.

I was also a little confused about the use of bindkey vs zvm_bindkey

I placed all my config in the zvm_config which is placed above the loading of the zsh-vi-mode via zinit

Reproduction steps

1.

add this to .zshrc

function zvm_config() {
  echo "I am running zvm_config"

  # Retrieve default cursor styles
  local ncur=$(zvm_cursor_style $ZVM_NORMAL_MODE_CURSOR)
  local icur=$(zvm_cursor_style $ZVM_INSERT_MODE_CURSOR)

  # Append your custom color for your cursor
  ZVM_INSERT_MODE_CURSOR=$icur'\e\e]12;red\a'
  ZVM_NORMAL_MODE_CURSOR=$ncur'\e\e]12;#008800\a'

  bindkey -M viins '^a' test_me_1
  bindkey -M viins '^t' test_me_2

  bindkey -M vicmd 'n' test_me

  zvm_bindkey -M viins '^a' test_me_1 
}

2.

Open new zsh shell and do a

bindkey -M viins | grep "test"

which reports

"^T" test_me_2

the ^A is still

bindkey -M viins | grep "\^A" "^A" beginning-of-line

Expected behavior

I was hoping to override the ^A key