jeffreytse / zsh-vi-mode

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

Color retention of character block when deleting characters in visual mode #160

Open sashkachan opened 2 years ago

sashkachan commented 2 years ago

General information

Please report the following information as possible as you can:

Basic examination

Problem description

Single visual selection character block retains visual selection colour. After the issue appears, the coloured block stays in the line regardless of any further movements / edits

Reproduction steps

  1. write a string: "string string string"
  2. esc - switch to normal mode
  3. v - visual mode
  4. b - move one word back
  5. x - delete selection
  6. i - switch to insert mode

Expected behavior

Visual mode selection colour should disappear.

Please see the image attached.

Screenshot 2022-01-22 at 13 33 41
anderslundstedt commented 1 year ago

Putting the following in my .zshrc solved the above problem and similar problems I had when pressing ā€˜xā€™ to delete in visual mode.

function zvm_after_lazy_keybindings() {
  bindkey -M visual 'x' zvm_vi_delete
}

Being not very experienced with ZSH or this plugin, I do not know if this is a proper solution, but before I made the above change I noticed that ā€˜dā€™ and ā€˜xā€™ had different key bindings in visual mode:

% bindkey -M visual d
"d" zvm_vi_delete
% bindkey -M visual x
"x" vi-delete

I do not know whether this was due to a mistake in my configuration or whether this should be considered a bug in zsh-vi-mode.

jeffreytse commented 1 year ago

Hi @sasha-glv

Thanks for your issue, and sorry for the late reply. Could you try again with the HEAD version, and let's see if this issue has been fixed or not?

Thanks & Regards