Re:Show HN: I built an online interactive course that helps ...
by mellavora on Wednesday January 20, 2021 @03:56PM
(#25851875)
ysiwb yank-surround-in-word-brackets also does it. If you have https://github.com/tpope/vim-surround/ installed.
Re:Show HN: I built an online interactive course that helps ...
by spectramax on Wednesday January 20, 2021 @08:16PM
(#25854145)
Could you please explain why we use Yank here? From what I understand yank puts the surround-in-word in a register.
But there is nothing surrounding the word! I thought yank was for copying and pasting stuff. I can't understand why ysiwb works :(
Re:Show HN: I built an online interactive course that helps ...
by gnubison on Thursday January 21, 2021 @11:59AM
(#25861097)
I believe that this is just an arbitrary choice that doesn't collide with other keys and is fairly consistent with the other keybindings — cs for changing delimiters, ds for deleting delimiters, and ys for creating delimiters.
Re:Show HN: I built an online interactive course that helps ...
by spectramax on Friday January 22, 2021 @01:34AM
(#25869033)
Thanks! That's really thorny. It goes against the grain of composability and logically destructuring the command into verbs and actions and modifiers.
They should not overload y for yank. Choose anything else that's not used.
Re:Show HN: I built an online interactive course that helps ...
by Fellshard on Wednesday January 20, 2021 @04:28PM
(#25852241)
Thanks for the translation! I'll keep that around for future reference.
Re:Show HN: I built an online interactive course that helps ...
by Fellshard on Wednesday January 20, 2021 @01:25PM
(#25849975)
I believe Vim-proper needs a plugin for that behaviour, so keep that in mind.
Re:Show HN: I built an online interactive course that helps ...
by fao_ on Wednesday January 20, 2021 @01:30PM
(#25850054)
Do you know what plugin it is? I will try to search for an evil version (Or I could just write my own, but my task list is large and my energy very low these days)
Re:Show HN: I built an online interactive course that helps ...
by benjaminogles on Wednesday January 20, 2021 @01:46PM
(#25850251)
Re:Show HN: I built an online interactive course that helps ...
by wraithy on Thursday January 21, 2021 @10:33AM
(#25859902)
This is vim-surround by tpope[1]. It does way more than just basic brackets!
Re:Show HN: I built an online interactive course that helps ...
by artificialLimbs on Wednesday January 20, 2021 @10:10PM
(#25854875)
bcw()<Esc>P will do it without plugins.
Holy shit, thank you. I've been looking for something like this for half a decade and never found it (I don't even know how I missed it!)