Live data from Hacker News

Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

github.com

31–39 of 39 posts

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#33

It looks to me like using a regex is more practical, something like :10,20s/poorly_named_var/nice_var/g

I wish vim had a visual regex multi-replace tool, like the visual search tool. So matches would select as you typed, and changes would update in real time too...

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#34
post #19

For everyone here writing that they don't see a need for this because vim has macros/regexp's: Please, please, try it out. I'm telling you, this is leaps and bounds above macros/regexp's for most use cases. It's the difference between a visual way to make changes, and a "disconnected" way in which you write commands and hope they work. Seriously, I consider Multiple Cursors one of the greatest advances in text editin…

I've been trying it, and do find it nice for small things, but a bit tedious for bigger things. Taking one of the examples in the animated GIF on the linked page, if you want to split a line on commas, with multiple cursors you have to select every single comma to 'initialize' the cursors. If the line has 3 fields, this is easier than using the regex, but if it has 10, then I find it a lot easier to just regex-split…

losvedir is right, in ST, "Find" will automatically create separate cursors and takes regex's.

I used to also have plugin for ST1, which allowed you to do common things like selecting a line, then splitting it by a separator. For example, you'd select a line, split it by ", ", and get a cursor on each paramater. It worked wonderfully for these kinds of things.

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#35
post #16
post #8

Earlier quoted context omitted.

I should probably put a reference to him on the project page, as watching his video recently was a big push towards making me implement this in Vim. His expand-region plugin also inspired me to create vim-expand-region. I wonder what I'll 'copy' next. :)

Thanks for mentioning (& developing) this, vim-expand-region is awesome.

Thanks! expand-region and multiple-cursors run in the same vein in that it takes some functionality Vim already offers, and makes them a little easier to use to the average user. I'm a pretty new and definitely average Vim user myself, and remembering just 2 keystrokes to select some region of text is definitely much easier on my brain muscle than having to remember the dozen of text objects offered by Vim as well as other plugins. Maybe one day all of them will be burnt into my muscle memory, but that simply isn't the case today and expand-region helps me remain productive while learning. :)

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#36
post #19

For everyone here writing that they don't see a need for this because vim has macros/regexp's: Please, please, try it out. I'm telling you, this is leaps and bounds above macros/regexp's for most use cases. It's the difference between a visual way to make changes, and a "disconnected" way in which you write commands and hope they work. Seriously, I consider Multiple Cursors one of the greatest advances in text editin…

Yep, the only reason why I wrote this was because of the missing live feedback functionality in existing Vim features, and it's the one feature that the plugin can't do without. I'm certainly not advocating that this be a replacement for regexp or macros, but for certain small tasks like quickly renaming a variable inside a function, it's much easier on my brain.

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#37
post #22

That's awesome tma. Thank you for hacking on this. I'll plan to include this into subvim (ST2 like Vim) :)

Thanks! I was planning on pinging you to check it out, but it looks like it found its way to you already. Also thanks for jumping in and finding problems already!

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#38
post #25

The rendering of multiple cursors is really buggy in tmux + vim, to the extent that it's hard to tell what has been selected. I have used this command for the purposes of changing a variable name. It could be better but gets the job done most of the time. > :.,$s/\ \>//gc Short demo: http://cl.ly/image/403j153F3u1h

I do this: *Ncw (then change the variable name) Then just n.n.n.n. until things are replaced.

Re: Show HN: vim-multiple-cursors - True Sublime Text style multiple selection

#39
I threw my own attempt at this on HN a ways back, but it didn't get any traction: https://news.ycombinator.com/item?id=4906343

Mine supports things like multi-key commands and has predictable (if not entirely desirable) undo behavior, but it has issues in its own right. I figure we may both learn a thing or two from each other's attempts.

Vim really does need this feature to get some mindshare back from ST2, and I'd love to see this well-implemented, even if its by someone else.

Post reply on HN