Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Adding zsh-vi-mode causes nav keys (Home, End, PgUp and PgDn ) to break #59

Closed
deafmute1 opened this issue Mar 16, 2021 · 14 comments
Closed
Assignees
Labels
bug Something isn't working good first issue Good for newcomers verified This issue was already verified

Comments

@deafmute1
Copy link

deafmute1 commented Mar 16, 2021

Hi, this issue occurred today after updating all my plugins. I narrowed it down to zsh-vi-mode by turning plugins on/off until reproducing.

Basically: Home, End, PgUp and PgDn emit the incorrect scan codes according to both terminfo and showkey --scancode after sourcing zsh-vi-mode . Also, multiple keys have the same code - Home and End are both [, while PgUp and PgDn are both [~ .

@jeffreytse jeffreytse self-assigned this Mar 16, 2021
@jeffreytse jeffreytse added bug Something isn't working verified This issue was already verified good first issue Good for newcomers labels Mar 16, 2021
@jeffreytse
Copy link
Owner

Hi @deafmute1

Thank you for reporting this issue. I will focus on this issue and fix it and welcome to star this project for further updates in the future.

Thanks and regards

jeffreytse added a commit that referenced this issue Mar 19, 2021
This commit fixed some issues about the escape sequences, such as
you can not trigger the widget bound on <PgUp> (i.e. `^[[5~`)
correctly, you just get an unexpected result.
@jeffreytse
Copy link
Owner

Hi @deafmute1

Thanks for the patience, this issue has been addressed and fixed, please upadte your plugin to the latest version. And welcome to star this project for further updates in the future. : )

Thanks and regards.

@jeffreytse
Copy link
Owner

jeffreytse commented Mar 22, 2021

Hi @deafmute1

Could we close this issue? If you still have other issues, please let me know. : )

Thanks and regards

@fdietze
Copy link

fdietze commented Jun 10, 2021

Hi, Home and End keys are not working for me. Neither in insert, nor in normal mode. Any ideas how to debug?

@jeffreytse
Copy link
Owner

Hi @fdietze

Could you give me some more instructions on your issue? Such as your .zshrc, what plugin was corrupted and so on.

Thanks and regards

@fdietze
Copy link

fdietze commented Jun 10, 2021

I just stripped my .zshrc down to:

source "${HOME}/.zgen/zgen.zsh"
if ! zgen saved; then
    echo "creating zgen save..."

    zgen load jeffreytse/zsh-vi-mode

    zgen save
fi

alacritty 0.8.0
zsh 5.8
nixos

@jeffreytse
Copy link
Owner

@fdietze For this, what plugin keybindings on the Home and End do not work? In other words, what hehavior do you expect?

@fdietze
Copy link

fdietze commented Jun 10, 2021

I expected Home to do the same as 0 in normal and insert mode and End the same as $. Do I have to map them manually?

Thank you

@Davincible
Copy link

Davincible commented Jun 15, 2021

@jeffreytse I'm having the same issue. By default, Manjaro registers the keys as below, which works fine except when I source this plugin. Do I need to set a separate keybinding for this plugin? if so which

## Keybindings section
bindkey -e
bindkey '^[[7~' beginning-of-line                               # Home key
bindkey '^[[H' beginning-of-line                                # Home key
if [[ "${terminfo[khome]}" != "" ]]; then
  bindkey "${terminfo[khome]}" beginning-of-line                # [Home] - Go to beginning of line
fi
bindkey '^[[8~' end-of-line                                     # End key
bindkey '^[[F' end-of-line                                     # End key
if [[ "${terminfo[kend]}" != "" ]]; then
  bindkey "${terminfo[kend]}" end-of-line                       # [End] - Go to end of line
fi

@jeffreytse
Copy link
Owner

Hi @Davincible @fdietze

Thanks for the information, I will try to dig up this issue and fix it as soon as possible.

Thanks and regards

@jeffreytse
Copy link
Owner

jeffreytse commented Jun 16, 2021

Hi @fdietze

For the default vi keybindings (i.e. bindkey -v) without this plugin, the behaviors of Home and End aren't going to the beginning/end of line. Are them bound by yourself or other plugins?

Thanks and regards

@fdietze
Copy link

fdietze commented Jun 16, 2021

@jeffreytse

That's correct, the default zsh vi mode does not map Home/End. But the bash vi mode and vim support it by default.

I thought that it would make sense to map these keys by default. Something like:

bindkey -M viins "^[[H" beginning-of-line
bindkey -M viins  "^[[F" end-of-line
bindkey -M vicmd "^[[H" beginning-of-line
bindkey -M vicmd "^[[F" end-of-line
bindkey -M visual "^[[H" beginning-of-line
bindkey -M visual "^[[F" end-of-line

What do you think?

@Davincible
Copy link

Davincible commented Jun 16, 2021

Can confirm, also managed to do it like that, my key codes were just different with. Might be nice to have those as default key bindings though

@jeffreytse
Copy link
Owner

jeffreytse commented Jun 21, 2021

Hi @fdietze @Davincible

So sorry for the late following up, I have been busy recently, thanks for your suggestions. I will take a consideration for adding them to default keybindings. Before that you can easily fulfill these keybindings by adding manually with zvm_after_init function, here is the related document for you guys. Have a good day! : )

Thanks and regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers verified This issue was already verified
Projects
None yet
Development

No branches or pull requests

4 participants