New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - multi selection #778
Comments
Awesome! |
Agreed. Seems to be a part of all modern editors now. |
I think this shouldn't be too hard to create. |
Is this also useful for code that's not ridiculously repetitive? This is cute, but it's not a priority for me. |
it is ridiculously productive to any kind of coding. the thing is, it takes a little time to understand the power of this. we are used to think in a single coding dimension... and the jump to multiple dimensions is to understand there are many many things you can do in different ways a great example will be if you use search and replace on something.. for example if you want to replace 21 out of 27 matches this will be 7 actions vs 28 actions another example is if you want to add (,) at the end of a block of code at every line you really have to try it to understand it more I have been working with it for about a year now with JS HTML C# and python and I still find new ways of using this that amazes me |
I think this feature has a lot of hype around it. It was brought by Sublime Text, and it is now implemented by ACE and people seem to love it. I don't use it yet, so I'm not sure about usefulness, but it is cute and I wouldn't mind this being in CodeMirror. Furthermore, I know a lot of people are making (irrational?) decisions about editors based on these kind of innovative features (multiple carrets and selection, block selection...), so if enough people are interested, maybe it's worth a crowd-funding effort? If there was a campaign for that I'd back it. |
I think this wouldn't even be that hard to do. But unless it gets funded somehow, or someone else submits a good, clean patch, I don't have time to spend on it. |
I think it is a great feature with tons of usefulness and, once you get used to it, very indispensable. It's like using for a while just a computer to write and then going back to use pen and paper, it's AWFUL. Also I think this feature will bring many more users and costumers to any service using CodeMirror, so I believe it a great feature to spend time, and work on. I even found this on the CodeMirror Forum at Google Grupos: "...All cursor and selection display is |
As @siefkenj hints in issue #1032, there can be no Anyone up for crowd-funding the effort to implement this? I use |
Do these two problems (rectangular selection in vim and sublime text style multi selection) really map to the same implementation? It sounds like rectangular selection is a single selection that happens to not be a single range, whereas sublime text selections are actually multiple selections (if you replace them, all are replaced individually). |
In Ace, block selections are composed of multiple single-range selections, with as many new cursors, and I guess Sublime's block selections work similarly. In Vim, block selections appear to be single selections with a single cursor but multiple ranges. However, if you block select, then hit EDIT: Maybe I'm not making much sense, but my point is: I think block selection can and should be implemented with multiple single-range selections. No need for single selections that span multiple ranges, since replacing a block selection will always replace each range individually. |
I would think any operations on selections would operate on all ranges in all selections, individually. What exactly is the benefit of multiple single range selections over a single multi-range selection? vim.js's internals are probably (I am too inept in C++ to verify) completely different from Vim's implementation. There wouldn't be much difference to vim.js whether we use multiple single range selections or one multi-range selection. |
The only difference between several single-range selections vs a single multi-range selection is that in the first case there are several cursors, implying that any operation is applied to all ranges. The multi-cursor aspect helps operating on all ranges (every selection's cursor inserts / deletes / replaces the same way), and this implementation has the nice effect of giving all at once multiple cloned cursors, multiple selections, and block selection (when those multiple selections happen to form a block). |
In Emacs' rectangle-manipulation functions, it is possible to paste one rectangle (represented as a set of equal-length lines on the clipboard-equivalent) into a rectangular selection. That wouldn't naturally play well with a Subline Text / ACE style multi-selection. Not sure how it is in vim. But, if the vim mode knows it is acting on a rectangle, and it can query the current multi-selection somehow, it would be easy for it to make some API calls that amount to the same effect -- replacing the individual ranges separately. So I guess that yes, having such multi-cursor selections would still be useful. |
Vim is also able to paste rectangles anywhere (before inserting the new text, it deletes currently selected text if any, but the pasted section does not care about the shape of the selection it replaces). The behavior I see is, paste the first line of the clipboard as if it was pasted normally, and then paste all the other lines of the clipboard relatively to the first pasted line. For multi-selections that happen to be rectangular, it happens as follows in Vim:
I don't see why having a "multi-cusor-sublime-ace model" would cause trouble implementing rectangular pasting. The Emacs behavior you described sounds to me like:
Does Emacs fit the pasted rectangular text into selected rectangle if their dimensions are different? Maybe that would be a little more tricky. |
-----Original Message----- Vim is also able to paste rectangles anywhere (before inserting the new text, it deletes currently selected text if any, but the pasted section does not care about the shape of the selection it replaces). The behavior I see is, paste the first line of the clipboard as if it was pasted normally, and then paste all the other lines of the clipboard relatively to the first pasted line. For multi-selections that happen to be rectangular, it happens as follows in Vim:
I don't see why having a "multi-cusor-sublime-ace model" would cause trouble implementing rectangular pasting. The Emacs behavior you described sounds to me like:
Does Emacs fit the pasted rectangular text into selected rectangle if their dimensions are different? Maybe that would be a little more tricky. Reply to this email directly or view it on GitHub: |
I just meant that you won't be able to simply use |
Please implement multiple cursors/selections. I find it extremely useful. |
+1 ... where can I go to throw money at this? |
+1 I would also highly recommend implementing Sublime Text's Cmd-D shortcut which adds the next occurrence of the selected string to the multi-selection. For example, if my file looks something like " foo bar foo " and I select the first "foo", " foo bar foo " now, hitting Cmd-D, I can easily select the next "foo" " foo bar foo " One of my favorite features in any text editor ever and it shouldn't be too tricky to implement once multi-select is working. |
+1 for "next occurrence selection" ... I use that all the time Also, sublime's |
And fix example code in demo. Issue #778
And fix example code in demo. Issue #778
(Oh, oops, it seems repeatedly rebasing a branch with issue-tagged commits isn't handled very gracefully by github. That's a lot of noise.) Anyway, this is stable, and certain to be part of 4.0 (most likely to be released next month). Closing. |
I'm not sure if anyone said 'thanks' to @marijnh for doing this all these years ago. From someone who is benefiting from it now, thanks Marijn. |
I know that this might be a big one to get your head around. but its totally worth it.
after i have moved to sublime text 2 for my development. its really hard going back to editors that don't have the multi select feature
it is a killer one and it saves tons of time
if you don't know what it is watch this movie first http://www.youtube.com/watch?v=i2SVJa2EGIw
it takes some time to get to use to the idea that your pointing power was multiplied many-folds. than you really start to invent new ways to work with this
WATCH OUT - if you'll get use to work with multi selection it will be very hard to go back
The text was updated successfully, but these errors were encountered: