jeffreytse / zsh-vi-mode

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

Set default keybindings for Home and End keys #134

Open tdltdc opened 2 years ago

tdltdc commented 2 years ago

General information

Basic examination

Problem description

The Home and End keys do not bind to "jump to start of line" and "jump to end of line". This is a regression from the default ZSH behaviour. Vim and Bash vi mode both map Home and End keys by default (https://github.com/jeffreytse/zsh-vi-mode/issues/59#issuecomment-862729015).

@jeffreytse, given that you've already mentioned considering this change (https://github.com/jeffreytse/zsh-vi-mode/issues/59#issuecomment-864930748), I figured I'd create an issue for tracking convenience.

Reproduction steps

  1. git clone https://aur.archlinux.org/zsh-vi-mode-git
  2. makepkg -si
  3. add source /usr/share/zsh/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh to ~/.config/zsh/.zshrc.local
  4. Enter some text, then press Home or End

Expected behavior

Home and End keys map to "jump to start of line" and "jump to end of line" respectively.

jeffreytse commented 2 years ago

Hi @tdltdc

Thanks for your issue, I will work on this issue as soon as possible.

Thanks and Regards

jeffreytse commented 2 years ago

Related to #33

jeffreytse commented 2 years ago

Hi @tdltdc

Now this default keybindings has been implemented, thanks for your patience. : )

Thanks and Regards

scresante commented 2 years ago

Unfortunately, this is still an issue, using st and the latest git pull of zsh-vi-mode. When not in tmux, home works but end doesn't.

scresante commented 2 years ago

The easiest way to fix this, without modifying zmv, is to simply re-bindkey the functionality in your .zshrc after sourcing zmv.

But using the terminfo method is important from a cross-platform compatibility standpoint.

The underlying issue is that apparently, people get different escapes for their home/end keys.

In the original zmv source, it assumes the end key, for example, is ^[[F while on my system, after hitting Ctrl+v, End, I get ^[[4