zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

zvm_bindkey viopp mode doesn't work

Open JuanZoran opened this issue 1 year ago • 0 comments

General information

Basic examination

  • [x] I have read through the README page
  • [x] I have the latest version of zsh-vi-mode
  • [x] I have tested with another terminal program

Problem description

I prefer use ijkl for cursor move, so I try to map all hjkl motion for that the normal mode and visual mode, it works well, but in viopp mode, it doesn't work

Reproduction steps

  1. use this configuration
# NOTE : Utility
local function set_keys() {
    local mode=$1
    for key value (${(kv)keys}); do
        zvm_bindkey $mode $key $value
    done
}

local function unset_key() {
    local mode=$1; shift 1
    local keys=("$@")
    for key ($keys); do
        bindkey -r -M $mode $key
    done
}

function zvm_config () {
    ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
    # ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK
    # ZVM_OPPEND_MODE_CURSOR=$ZVM_CURSOR_BLINKING_UNDERLINE

    ZVM_VI_INSERT_SURROUND_BINDKEY=s-prefix # zsh-vim-surround support
    ZVM_VI_INSERT_ESCAPE_BINDKEY='^S'
    ZVM_VI_SURROUND_BINDKEY='s-prefix'
    ZVM_READKEY_ENGINE=$ZVM_READKEY_ENGINE_NEX
    ZVM_VI_HIGHLIGHT_BACKGROUND=#89e051           # Hex value
    ZVM_VI_HIGHLIGHT_FOREGROUND=#1d202f           # Hex value
}

function load_ins_key () {
    keys=(
        '^p' up-line-or-search
        '^k' menu-select
        '^n' menu-select
        '^v' describe-key-briefly
        '^b' backward-word
        '^f' forward-word
    )
    set_keys viins
}
zvm_after_init_commands+=(load_ins_key)

function zvm_after_lazy_keybindings() {
    # Unbind key
    unset_key viopp \
        j k iW iw ia

    local -A keys

    keys=(
        h zvm_enter_insert_mode
        H zvm_insert_bol

        i up-line-or-history
        k down-line-or-history
        j vi-backward-char
        l vi-forward-char
        J vi-beginning-of-line
        L vi-end-of-line
    )
    set_keys vicmd


    keys=(
        j backward-char
        k down-line
    )
    set_keys visual

    keys=(
        W select-in-blank-word
        w select-in-word
        j vi-backward-char
        l vi-forward-char
        i up-line
        k down-line
        J vi-beginning-of-line
        L vi-end-of-line
    )
    set_keys viopp
    # zvm_bindkey visual "i" up-line
    # unset_key visual \
        #     "i^["\
        #     "i "\
        #     "i\""\
        #     "i'"\
        #     "i("\
        #     "i)"\
        #     "i<"\
        #     "i>"\
        #     "iW"\
        #     "i["\
        #     "i]"\
        #     "i\`"\
        #     "ia"\
        #     "iw"\
        #     "i{"\
        #     "i}"
    # visual "h" zvm_readkeys_handler
    # visual "h^[" zvm_select_surround
    # visual "h " zvm_select_surround
    # visual "h\"" zvm_select_surround
    # visual "h'" zvm_select_surround
    # visual "h(" zvm_select_surround
    # visual "h)" zvm_select_surround
    # visual "h<" zvm_select_surround
    # visual "h>" zvm_select_surround
    # visual "hW" select-in-blank-word
    # visual "h[" zvm_select_surround
    # visual "h]" zvm_select_surround
    # visual "h\`" zvm_select_surround
    # visual "ha" select-in-shell-word
    # visual "hw" select-in-word
    # visual "h{" zvm_select_surround
    # visual "h}" zvm_select_surround
}
  1. check the viopp mode keybindings: image

the zsh told me that it was defined correctly

Expected behavior

try to type dj, it should delete the cursor char and the char left cursor, but it does nothing...

JuanZoran avatar Apr 13 '23 06:04 JuanZoran