Community
    • Login

    Select text via syntax highlighting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 4 Posters 1.6k Views
    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.
    • dfdeboerD Offline
      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 KilbornA TroshinDVT 2 Replies Last reply Reply Quote 0
      • Alan KilbornA Offline
        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.

        astrosofistaA 1 Reply Last reply Reply Quote 0
        • dfdeboerD Offline
          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
          • astrosofistaA Offline
            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 KilbornA 1 Reply Last reply Reply Quote 3
            • Alan KilbornA Offline
              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
              • dfdeboerD Offline
                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. . .)

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

                  Hi @dfdeboer

                  You’re welcome. Glad to be of help.

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

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • TroshinDVT Offline
                      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

                      TroshinDVT 2 Replies Last reply Reply Quote 0
                      • TroshinDVT Offline
                        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
                        • TroshinDVT Offline
                          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

                          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
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors