Bug 200027 - Multiline / Multiselection / Multicursor Editing such as in Notepad++, Sublime, and IntelliJ. (Multiple Line / Cursor / Selection Editing)
Multiline / Multiselection / Multicursor Editing such as in Notepad++, Sublim...
Status: REOPENED
Product: editor
Classification: Unclassified
Component: Painting & Printing
8.1
All All
: P1 with 55 votes (vote)
: 8.2
Assigned To: Miloslav Metelka
issues@editor
:
: 243413 243857 256447 (view as bug list)
Depends on: 257888 257893 257889
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-11 07:04 UTC by PrakharMathur
Modified: 2016-09-05 07:08 UTC (History)
21 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description PrakharMathur 2011-07-11 07:04:47 UTC
Product Version = NetBeans IDE 7.0 (Build 201104080000)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_26
Runtime = Java HotSpot(TM) Client VM 20.1-b02

I was expecting the editor to support editing multiple lines a same time which is a very regular feature with other editors like Notepad++. It leads to easy and faster editing.
Comment 1 Miloslav Metelka 2011-08-01 14:35:37 UTC
IIUC you mean the following:
1. In an existing document select a rectangular region which you want to replace by typing.
2. Typed characters get replicated on each and every line of the selected region.
Right?
Comment 2 PrakharMathur 2011-08-01 15:19:17 UTC
Yes something like that. But let me take this opportunity to give you little more highlight of actually I meant by multiline editing.

Disclaimer:
I am trying to give solution in the way I do multiline editing in Notepad++. It doesn't mean in any way that shortcut keys being used in Notepad++ needs to be used exactly the same way in Netbeans. In no way I am trying to prove Notepad++ a superior editing tool. All I am trying to do is to use it as a reference just  for the sake of explanation. 


Case 1:
Suppose I want to write a word "Custom" at Line 30, Column 50 and Line 47, Column 103. Then how would I do that?

Solution:
Press Ctrl and while pressing click at Line 30, Column 50 and Line 47, Column 103. Now we could see blinking cursor at 2 locations and as we type something it get typed at 2 locations.

Case 2:
What was just written in the last comment.
Comment 3 PrakharMathur 2011-09-12 13:24:43 UTC
What is the latest update on this feature? Has there been any development on this yet?
Comment 4 Miloslav Metelka 2011-09-14 05:29:20 UTC
This should be covered by issue #13857.

*** This bug has been marked as a duplicate of bug 13857 ***
Comment 5 jerrac 2013-02-19 18:38:29 UTC
This has nothing to do with rectangular selection. Multi-line editing is completely different. So I'm not sure why it was marked as a duplicate. See the animation on http://www.sublimetext.com/blog/articles/sublime-text-2-0-released

I did some googling, but it doesn't look like there's even a plugin out there for it. This is a prime feature that's save me a LOT of time. Netbeans really should have it.
Comment 6 timharris777 2014-04-28 15:14:57 UTC
Can Someone please take a look at this? This is not the same as block mode that is currently offered by netbeans. This is a feature that other editors have implemented long ago. See links below:

1.- Notepad++ (http://www.screenr.com/m1C8)
2.- Sublime (https://www.youtube.com/watch?v=0ZnVBVaQpWs)
3.- IntelliJ (http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-rc-introduces-sublime-text-style-multiple-selections/)

I am willing to work on a plugin if someone points me in the right direction. I'm not sure where to start with adding multiple cursors to the editor.

Thanks,

Tim
Comment 7 timharris777 2014-04-28 15:16:33 UTC
Also, there are currently two other tickets that I found created for this same feature request:

Bug 243857 (https://netbeans.org/bugzilla/show_bug.cgi?id=243857)
Bug 243413 (https://netbeans.org/bugzilla/show_bug.cgi?id=243413)
Comment 8 timharris777 2014-04-28 15:21:29 UTC
*** Bug 243857 has been marked as a duplicate of this bug. ***
Comment 9 timharris777 2014-04-28 15:22:18 UTC
*** Bug 243413 has been marked as a duplicate of this bug. ***
Comment 10 timharris777 2014-04-28 15:23:50 UTC
If you are a netbeans user and want this feature please add a vote at the top of this ticket in the priority section. This will help speed things up.
Comment 11 Miloslav Metelka 2014-04-29 09:45:31 UTC
We will implement it - TM set to Next.
Comment 12 adam_felix_fps 2014-07-14 08:12:14 UTC
Please keep us posted as to progress on this e.g. when we might see it an a nightly etc. as this is one of the most useful features that other editors have that NetBeans doesn't.
Comment 13 kalysss 2014-08-08 09:21:04 UTC
Hi, i'm waiting to for this upgrade, it'll be more than usefull for netbeans's user
Comment 14 volodia 2014-10-10 07:46:02 UTC
It would be as plugin or native in IDE?

I could try to help, but I never code anything for NB.

Best regards.
Comment 15 jkasavage 2014-10-15 19:06:36 UTC
This feature would really save time for most. I love Netbeans but missing this feature is making me look else where. I hope it gets implemented!
Comment 16 kalysss 2014-10-15 19:14:10 UTC
plugin or native in IDE the more simpliest to integrate. but we need it !
Comment 17 gerardbm 2014-12-07 23:07:01 UTC
What about this feature? I'm using NetBeans 8.0.2. It'd be so useful!
Comment 18 alub 2014-12-27 01:31:38 UTC
Please add this important feature ...
Comment 19 tahoma 2015-02-19 12:18:48 UTC
Add it please
Comment 20 Geertjan Wielenga 2015-02-26 14:24:39 UTC
In line with discussion with MartinB from engineering team, increasing priority of this enhancement request to P2.
Comment 21 bronius 2015-04-21 18:24:11 UTC
Looking forward to multiple cursors in Netbeans like Sublime (cmd/ctrl-click in arbitrary places in a file and all edit actions behave relative to each cursor), with or without cmd-D to select your way into multiple locations (like Sublime). I'd even propose that be a separate issue/request?

Note: By "all edit commands" I mean that it's important to note that if you, for instance, press cmd-shift-rightarrow, each cursor will select to its respective nearest word boundary.

I'm subscribing here bc I am more than happy to help test -- good luck :D
Comment 22 lindsten 2015-05-18 10:07:30 UTC
+1

This is one of the first features I look for when trying out a new editor/IDE. Combined with search and "select all matches"/"add next match to selection" it's an extremely useful editing feature!
Comment 23 melanke 2015-06-18 11:55:39 UTC
In Sublime you can select multiple lines:


Lorem Ipsum Bla Blo Das Ketch
Lorem Ipsum DOR Blo Das Ketch
Lorem Ipsum Bla FOO Das Ketch
Lorem Ipsum Bla Blo Das Ketch
Lorem Ipsum BAR Blo Das Ketch
Lorem Ipsum Bla Blo HUE Ketch

press command+shift+L

and edit them like you were editing only one of them, you can press ALT + -> and go to the next word, in netbeans rectangular selection you can't do this

You also can copy and paste some text of the line to another location of the same line.

Is like you are doing the same process in all lines
Comment 24 felipechp 2015-08-01 15:09:30 UTC
Add it please!
Comment 25 miviks 2015-08-03 05:40:31 UTC
+1
Comment 26 JulienVerhaeghe 2015-08-14 09:29:51 UTC
+1!
Comment 27 JoelMac 2015-09-30 14:31:22 UTC
I really like the sublime implementation as well.  Can't wait to see it in Netbeans!
Comment 28 Jiri Prox 2015-11-09 10:41:55 UTC
*** Bug 256447 has been marked as a duplicate of this bug. ***
Comment 30 sandreas 2015-12-21 23:23:49 UTC
Hey,

thank you, this is really great... i would suggest an extension of this feature called "mark next occurrence" with a shortcut. That enabled, you are not limited to mark either one or all occurrences, but you could also mark "some" without using the mouse. 

I use this very often to reformat entries from text files for arrays.

Here's a video of the according feature in PHPStorm:

https://www.youtube.com/watch?v=aqGNM4rvyOE

You could use Alt + J to mark next occurrence and Alt + Shift + J to unmark last marked occurrence or mark backwards. This makes code navigation very easy.
Comment 31 bolsover 2015-12-22 16:54:09 UTC
Brilliant!

The implementaion is way better than I had expected.

How soon can it be built into a regular release?

db
Comment 32 melanke 2016-01-03 20:58:58 UTC
Really great, this will help a lot, but if I have a lot of lines I will need to click in one of each individually? Can't I use the keyboard at least? Something like alt+shift+downarrow
Comment 33 melanke 2016-01-03 21:08:13 UTC
Would be great if it was similar to sublime text:
https://youtu.be/WXuBgSpLpK4?t=327
Comment 34 Miloslav Metelka 2016-02-25 14:06:28 UTC
Adding a new caret to previous/next line is now on Alt+Shift+'[' and Alt+Shift+']' (OpenBracket/CloseBracket).
Originially we thought to reuse Alt+Shift+Up/Down and override their default functionality of moving line/selection up/down in multi-caret mode. But there's a usecase of e.g. moving a "<td>col-data</td>" line up/down to reorder columns in html table so we need the original actions' meaning in multi-caret too. So we will use these modified shortcuts for carets adding.

http://hg.netbeans.org/jet-main/rev/82e4ff249eec
Comment 35 Geertjan Wielenga 2016-03-12 12:31:28 UTC
Nightly builds now include multicaret support:

http://bits.netbeans.org/download/trunk/nightly/latest/

Please give it a try. 

Alst-Shift-Click as well as keyboard shortcuts available:

http://wiki.netbeans.org/NewAndNoteworthyNB82#Editor_Multicarets
Comment 36 adam_felix_fps 2016-03-14 15:49:11 UTC
This is really close now to the functionality in Sublime however to make it perfect it needs to allow you to select the next word after removing a caret e.g. in sublime I have 3 instances of the word dog and I want to select 1 and 3. I press Ctrl-D to select the first, I press Ctrl-D again this selects the second, I press Ctrl-K and the second is no longer selected and I press Ctrl-D again to select the 3rd.

In NB currently I get this.  I press Ctrl-D and select the 1st, I press Ctrl-D again to select the second, I press Ctrl-Shift-L to unselect the 2nd, I press Ctrl-D again and the 2nd gets reselected.  Would be great if after I deselected the 2nd the following Ctrl-D would jump to the third.
Comment 37 adam_felix_fps 2016-03-14 15:55:46 UTC
Also just noticed something else that is a little odd.  When you use Alt-Shift-Click to add multiple carets they don't all blink at the same time.  Ends up looking a little trippy!  Any chance the blinks could be synchronized?  It's not a big thing but would make the whole implementation look a little more professional!
Comment 38 adam_felix_fps 2016-03-14 15:58:39 UTC
(In reply to adam_felix_fps from comment #37)
> Also just noticed something else that is a little odd.  When you use
> Alt-Shift-Click to add multiple carets they don't all blink at the same
> time.  Ends up looking a little trippy!  Any chance the blinks could be
> synchronized?  It's not a big thing but would make the whole implementation
> look a little more professional!

Ignore me I think my eyes were playing tricks!
Comment 39 everflux 2016-04-22 12:05:10 UTC
Can we make the shortcuts a little more consistent?
F.e. ALT-F3 for  Add caret for the next occurence and enter multi-caret mode  and ALT-SHIFT-F3 for  Add caret for all occurences and enter multi-caret mode 
Instead of mixing CTRL / ALT and regular and function keys?
Comment 40 markiewb 2016-04-23 13:55:10 UTC
(In reply to everflux from comment #39)
> Can we make the shortcuts a little more consistent?
> F.e. ALT-F3 for  Add caret for the next occurence and enter multi-caret mode
> and ALT-SHIFT-F3 for  Add caret for all occurences and enter multi-caret
> mode 
> Instead of mixing CTRL / ALT and regular and function keys?

@everflux: At https://netbeans.org/bugzilla/show_bug.cgi?id=258744 I proposed to use the shortcuts provided by Intellj Idea. They have non-conflicting shortcuts for all major IDE keymaps. And users can switch easily from or to Idea. Please vote there!
Comment 41 everflux 2016-04-23 13:57:30 UTC
That is great, I voted.
This is additionally useful for people using CTRL-D mapped to git push (and CTRL-T to git pull, ALT-K to git commit... you get the idea.)
Comment 42 kevin.trompat 2016-08-31 13:57:03 UTC
CTRL + D from Sublime Text would be very very useful !
Comment 43 juanlopez4691 2016-09-05 07:08:15 UTC
Is there a shortcut to easily skip (unselect) current ocurrence and continue with next one? In Sublime Text that is achieved with the shortcut sequence CTRL+K, CTRL+D.

That would be a nice trick to have!


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo