Multi-cursor editing
-
Regex is something new for me that I have no experience with, I do not know where to write text with commands, where to start? My English is not so good it can also be a bit of a problem. I’ll try to look at the forum content for more information.
Thank you very much for your time and effort to explain this issue to me. I appreciate it really much
-
After all the back and forth above, I’ve sort of changed my mind. I think that the way the OP wants to go about this is very reasonable, without using search-and-replace. The scenario is rather rare, but for where text is very regular before or after the original search is conducted…I can see it.
-
If I understand this correctly, then one, non-plugin way would be,
to press and hold the CTRL button and click with the mouse on the
respective places. -
@Ekopalypse said in Multi-cursor editing:
If I understand this correctly, then one, non-plugin way would be,
to press and hold the CTRL button and click with the mouse on the
respective places.True, but I get the feeling we are talking about hundreds of such places, potentially, which makes that problematic.
-
@Alan-Kilborn
I assume so too.
I do have a little PS script for selecting all same wordsfrom Npp import editor first_line = editor.getFirstVisibleLine() editor.setTarget(0, editor.getTextLength()) editor.multipleSelectAddEach() editor.rotateSelection() editor.setFirstVisibleLine(first_line)
-
In case someone is trying this.
If no word is selected the first execution would select the current word
and the next execution all others. -
Yes, this (or a variant which included a search) would get all of the carets in the correct place, but from there the OP’s desire is to be able to move all of the carets in junction to a constants offset from that point, and which point insertion/deletion would commence. At least this is what I gather from watching the OP’s video. And if I try something like that after running your script, all but one of the carets is removed as soon as I do the first cursor movement operation. I expected this.
But I also respect the OP’s desire for something like this to be possible.
-
@Alan-Kilborn said in Multi-cursor editing:
Yes, this (or a variant which included a search) would get all of the carets in the correct place, but from there the OP’s desire is to be able to move all of the carets in junction to a constants offset from that point, and which point insertion/deletion would commence. At least this is what I gather from watching the OP’s video. And if I try something like that after running your script, all but one of the carets is removed as soon as I do the first cursor movement operation. I expected this.
Hi @Alan-Kilborn, @Ekopalypse, All:
As I understand, Ekopalypse’s script in conjunction with the BetterMultiSelection plugin provide an interesting approach if not an actual solution to OP’s request.
Take a look to how I can resolve the sample that Op posted before in this thread:
If needed, I can post the commands used to move the caret in the above embedded gif.
-
I watched the youtube video and it looks like you can do this
with my script.
You do get multiple selection and those will move when using the arrow keys.
What do I miss?? -
@Ekopalypse said in Multi-cursor editing:
You do get multiple selection and those will move when using the arrow keys.
What do I miss??You need to check the
Multi-Selection
option in Preferences and install theBetterMultiSelection
plugin. -
thx, but I can already do what your gif shows without having BetterMultiSelection installed just by using my script.
-
You do get multiple selection and those will move when using the arrow keys.
Well, I’ve never had much luck with doing that in a “real” way. A real way would be a real problem I’m working on.
BTW, I like futzing around with Notepad++ and its peculiarities, but it gets frustrating fast when you are trying to do something “real” and you run into Notepad++'s bugs. :-)
-
this is how it looks like on my PC
-
@Ekopalypse said in Multi-cursor editing:
thx, but I can already do what your gif shows without having BetterMultiSelection installed just by using my script.
You are right. I disabled the plugin and your script does all the work and OP should pay close attention to it.
Anyway I still believe that the conjuntion of both the plugin and your script creates a better tool. The plugin works nice with contiguous selections, which it can create by draging, and your script extend its capabilities to make distant selections. I thank you for it.
By the way, have you plans to make the plugin able to search for partial words? At first glance looks like a nice addition.
Disclaimer: I am not related in any way with the mentioned plugin, just a happy user.
-
@astrosofista said in Multi-cursor editing:
Anyway I still believe that the conjuntion of both the plugin and your script creates a better tool.
Can be the case absolutely, @dail does a great job with all of his plugins. :-)
By the way, have you plans to make the plugin able to search for partial words? At first glance looks like a nice addition.
Just select the part of the word you are interest in and it should respect it already. This is a scintilla feature not really my work.
-
@Ekopalypse I use BetterMultiSelection in conjunction with LuaScript to select multiple instances and then edit them simultaneously…works quite nicely.
-
I have no doubt that this works great. :-)
-
@Ekopalypse said in Multi-cursor editing:
Just select the part of the word you are interest in and it should respect it already. This is a scintilla feature not really my work.
Yes, it works fine… almost all the time. In one of my tests Notepad++ ceased to respond and have to quit it via the taskbar.
Better stop for today.
-
Hello, @czmaniak, @alan-kilobrn, @peterjones, @ekopalypse, @astrosofista,
In that discussion, I suppose that the
Multi-Editing
option is enabled, in>Settings > Preferences... > Editing
and that theBetterMultiSelection
andPythonScript
plugins are both installed, in your N++ configuration !
It may be worth to note that, by default, in Notepad++, the multiple cursors editing feature behave differently from the column mode editing and that it is identical only if you install and enable the
Better MultiSelection
plugin of @dail !For instance, assuming the five lines, below, the
BetterMultiSelection
not enabled and thePython script
not used :12 56498><717 5123 131 21 78483><000 0456 235 16 89410><575 5156 464 97 89411><056 6045 454 01 25822><644 8970 544
If you create a zero-length column selection, through these five lines, between the
>
and<
chars, you’re able to
type in some chars, even tabulations and/or spaces and you may delete few chars, with thebackspace
or theDelete
key.However, as soon as you want to use, for instance, the right arrow key or the
Ctrl + Left
shortcut, theHome
orEnd
key and even theEnter
key, these commands do not act for all the lines of the column selection
Now, click between the
>
and<
chars of the first line. Then, holding down aCtrl
key, click, at the same location, for line2
to5
. The screen seems similar to before but, this time, we get, I would say, something like a5
one-line column selection ( instead a1
five-line column selection ) !Therefore, the use of the arrow keys, shortcuts involving arrow keys, the the
Home
,End
key andEnter
key correctly act as expected ;-))The good news is that IF you enable the
BetterMultiselection
@Dail’s plugin, from within N++, you can, use this enhanced behaviour, too, when creating a classical column selection ;-))
Obviously, the @ekopalypse’s python script does not create a column selection but, indeed, places individual cursors on every line, containing a specific word. This explains why if we use the @ekopalypse’s python script, below, we do not need the
BetterMultiSeelection
, in conjunction !from Npp import editor first_line = editor.getFirstVisibleLine() editor.setTarget(0, editor.getTextLength()) editor.multipleSelectAddEach() editor.rotateSelection() editor.setFirstVisibleLine(first_line)
Of course, this script solution seems more flexible, because it places all the cursors at the end of a specific selected word, so, not necessarily at the same column, in each line !
Now, and a bit off-topic, I would like some information from Python guru’s people ;-))
In order to realize this post, I decided to install, manually, on my portable N++
v7.8.5
release, the lastV1.5.3
version of thePythonScript
plugin, from :https://github.com/bruderstein/PythonScript/releases
-
First, I did not know to choose between the
PythonScript_Full_1.5.3.0.zip
and thePythonScript_Full_1.5.3.0_PluginAdmin.zip
archives ! After downloading the two archives, I just realized that they were strictly identical and, also, verified, with WinMerge, that their contents were the same !? So what ? -
Then I created, as usual, a
PythonScript
sub-folder, in thePlugins
folder -
Opening the archive
PythonScript_Full_1.5.3.0.zip
, I noticed that the two dllPython27.dll
andPythonScript
were at the same level. So, I supposed that, from now on, thePython27.dll
file wasn’t anymore along with theNotepad++.exe
file -
Therefore, I just extracted all the contents of the archive in the
PythonScript
sub-folder, that I just created -
However, during N++ start-up, I got the message, in French :
“This application could not start because python27.dll cannot be found. …”
- Luckily, putting back the
Python27.dll
library, along withNotepad++.exe
, everything is back to normal ;-)) And the consultation of thev1.5.3
documentation works just fine, too, from its new location !
Best Regards,
guy038
-
-
@guy038 said in Multi-cursor editing:
PythonScript_Full_1.5.3.0.zip and the PythonScript_Full_1.5.3.0_PluginAdmin.zip … they were strictly identical
I also confirm this.
No idea as to the “why” of it.“This application could not start because python27.dll cannot be found. …”
This part I could NOT duplicate.
For me it worked just fine with python27.dll in the PythonScript subfolder under Plugins.