jeffreytse / zsh-vi-mode

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

Add ys normal mode mapping for surround #52

Open gotgenes opened 3 years ago

gotgenes commented 3 years ago

This is a feature request to support ys<motion/text object><surround character> in normal mode to surround <text object> with <character>. It is similar to ys from visual selection mode. The description from surround.vim:

ys takes a valid Vim motion or text object as the first object, and wraps                                                                                                                       
it using the second argument as with cs.  (It's a stretch, but a good                                                                                                                           
mnemonic for "ys" is "you surround".)                                                                                                                                                           

Old text                  Command     New text                                                                                                                                                
Hello w*orld!             ysiw)       Hello (world)!

[In the example above, the * denotes the position of the cursor.]

Right now the workaround from normal mode is to enter v<text object>ys<character>. This feature would cut down on a few keypresses. It would also help those users who have gotten used to this normal mode mapping from surround.vim.

Thanks for considering this request!

pjg commented 3 years ago

Yes, this would be a great addition!

musjj commented 4 months ago

Would love to see this implemented too!