Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Select text via syntax highlighting

    Help wanted · · · – – – · · ·
    4
    11
    201
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dfdeboer
      dfdeboer last edited by

      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.

      Alan Kilborn TroshinDV 2 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @dfdeboer last edited by

        @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.

        astrosofista 1 Reply Last reply Reply Quote 0
        • dfdeboer
          dfdeboer last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • astrosofista
            astrosofista @Alan Kilborn last edited by astrosofista

            Hi @Alan-Kilborn, @dfdeboer

            As long as URLs are quoted strings, there is already a Pythonscript available and a macro solution as well. Take a look at

            Copying quoted strings

            Have fun!

            Alan Kilborn 1 Reply Last reply Reply Quote 3
            • Alan Kilborn
              Alan Kilborn @astrosofista last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • dfdeboer
                dfdeboer last edited by

                Thanks astrosofista. I’ll probably try setting that up some day soon. (Must keep nose to grindstone and not get distracted by fun toys. . .)

                astrosofista 1 Reply Last reply Reply Quote 0
                • astrosofista
                  astrosofista @dfdeboer last edited by

                  Hi @dfdeboer

                  You’re welcome. Glad to be of help.

                  1 Reply Last reply Reply Quote 0
                  • TroshinDV
                    TroshinDV @dfdeboer last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • TroshinDV
                      TroshinDV last edited by

                      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

                      TroshinDV 2 Replies Last reply Reply Quote 0
                      • TroshinDV
                        TroshinDV @TroshinDV last edited by

                        @Дмитрий-Трошин 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.js

                        function 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;
                        }
                        
                        
                        1 Reply Last reply Reply Quote 1
                        • TroshinDV
                          TroshinDV @TroshinDV last edited by TroshinDV

                          @Дмитрий-Трошин 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.js

                          How it works.
                          ![alt text](image url)

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright © 2014 NodeBB Forums | Contributors