Select text via syntax highlighting
-
In Notepad++ can I select text via syntax that has been highlighted? Example: Say I’m editing an html file. I hover my mouse over the"y" in a tag such as
<a href=“https://mylink.htm”>click here</a>
and the whole URL, that is the whole text of “https/mylink.htm” gets automatically syntax highlighted by Notepad++. Can I now press a hot-key or right-click or something to select that entire URL? Or must I drag the mouse over the URL to select it?
I ask because very often I need to select an entire syntactical element, say to copy it to some other location. Notepad++ is already aware of the element I’m after, yet I find myself tediously dragging the mouse from one endpoint of the element to the other and then right-clicking and clicking “copy” to select the element I’m after. It seems it could be easier and faster than that.
-
@dfdeboer said in Select text via syntax highlighting:
Can I now press a hot-key or right-click or something to select that entire URL?
No.
Or must I drag the mouse over the URL to select it?
Yes.
Perhaps something could be done with scripting to ease this situation.
URLs are done with indicator #8.
Maybe a script with execution tied to a keycombo could be run when the URL is pointed at. -
Thanks Alan! I thought it might be as you describe, but OTH if I was missing something it should would have been nice to figure it out.
-
As long as URLs are quoted strings, there is already a Pythonscript available and a macro solution as well. Take a look at
Have fun!
-
@astrosofista said in Select text via syntax highlighting:
As long as URLs are quoted strings, there is already a Pythonscript available and a macro solution as well
Yea, makes sense.
For the current thread I was thinking more of a hover-based solution.
But clicking somewhere inside the text and then running the script/macro is pretty reasonable. -
Thanks astrosofista. I’ll probably try setting that up some day soon. (Must keep nose to grindstone and not get distracted by fun toys. . .)
-
Hi @dfdeboer
You’re welcome. Glad to be of help.
-
This post is deleted! -
I am using jN plugin for such task.
https://github.com/sieukrem/jn-npp-plugin
The “href” selection functionality is in the file:
https://github.com/trdm/jn-npp-scripts/blob/master/includes/IntellHtml.js -
@Дмитрий-Трошин said in Select text via syntax highlighting:
I am using jN plugin for such task.
https://github.com/sieukrem/jn-npp-plugin
The “href” selection functionality is in the file:
https://github.com/trdm/jn-npp-scripts/blob/master/includes/IntellHtml.jsfunction htmlMakeSelections(psAnaliser) { var rv = ''; if(0) { psAnaliser = new CHtmlTagAnalizer; } if(psAnaliser) { //debugger; var vPosStart = -1, vPosEnd = -1, vAnchor = 0, vPosOffset = -1; var vTag = null, vLP = psAnaliser.getLastPlasement(); if(vLP && htmlNeedSelections(vLP)) { var vTag = vLP.tag; var vNames = ['img'] if( vTag && vTag.name == 'img' && vLP.atribName == "src") { // select 'img' or "src var vAtrName = vTag.atribByPos(vLP.column); if (vAtrName != '') { vPosStart = vTag.atribPosStartVal(vAtrName)+1; vPosEnd = vTag.atribPosEnd(vAtrName); /* bytePos/Pos и column связаны, */ vPosOffset = view.pos - view.column; view.anchor = vPosStart + vPosOffset; view.pos = vPosEnd + vPosOffset; } } } } return rv; } -
@Дмитрий-Трошин said in Select text via syntax highlighting:
I am using jN plugin for such task.
https://github.com/sieukrem/jn-npp-plugin
The “href” selection functionality is in the file:
https://github.com/trdm/jn-npp-scripts/blob/master/includes/IntellHtml.jsHow it works.

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login