Hacker News new | past | comments | ask | show | jobs | submit login

But it’s still just search and replace right, like renaming a variable or function, or am I missing something?



What you are missing, is that you get cursors that you can manipulate. Overwriting what they selected is the obvious thing (and then it would be indeed the same as search and replace) — but there are some less obvious things that make this thing powerful in a different way E.g.:

  1. select the next 3 occurances of "foo"
  
  2. Press End on keyboard to jump to end of line (even if the part after "foo" was different each time)
  
  3. Start typing away

You can also use the arrow keys to move the cursors, hold shift to do selections, alt + arrow to jump to the next/previous word and so on. Of course all of this can be done with regexes as well, but it takes longer usually to come up with just the right one, even if you are good with them.


The difference is the interactivity and instantaneous feedback. I don't want to have to blindly write a regex substitution when I could instead be seeing what is happening at each step, right in front of me.


Neovim gives you a preview of the result of your regex replacement, and with the ability to reference capture groups it's a pretty powerful.


Yeah, I'm a neovim user, and I enjoy that feature. There are just times when multiple cursors would be ever so slightly more ergonomic.


Vim also has it with `:set hlsearch incsearch`.


That doesn't preview the result of the regex, just the text that would be replaced IIRC.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: