jeffreytse / zsh-vi-mode

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

Feature request: Add a way to replace every instance of a substring on the current line #231

Open Hubro opened 12 months ago

Hubro commented 12 months ago

(This is not a bug report, so I'm not following the standard template)

First of all, let me say that zsh-vi-mode is amazing, I'm certain it's the best Vi-mode plugin for any shell that exists.

However I have encountered one pretty common scenario that I would easily be able to resolve inside Vim, but is more challenging in zsh-vi-mode.

If I have a line like:

ln -sf ../syncthing/dotfiles/darkman .config/darkman

If I wanted to replace "darkman" with "direnv", in Vim I would just place my cursor on the word "darkman", press <C-n><C-n> to select both instances of "darkman", then press c to replace the word and enter insert mode, then type "direnv". Super quick and easy. (Though, to be clear, this is using the vim-visual-multi plugin, this is not built-in Vim functionality.)

Without multiple selections, this becomes a lot more tedious, especially when I have to repeat it a bunch of times for several different symlinks.


To summarize the feature request:

Problem: Replacing many instances of the same text on a line is tedious

Solution in Vim/Neovim: A multi-select plugin

Solution in zsh-vi-mode: ?

Possible solutions:

jeffreytse commented 12 months ago

Hi @Hubro,

Thank you very much for your good idea and scenarios, I'd love to explore this feature in the next days.

Thanks & Regards