I am doing some langauge translations of an old HTML website so I am just pasting the new translations from a Word document into the old files.

So I have to select everything between the tags (h2, p, li, etc.) and then paste the new text in – from a Word file. For selecting everything in between p tags I have to select one side of the inside tag, then hold Shift, then select the next side to highlight everything... my fingers are getting really tired, and I got 40 files (pages) total with 3 languages to do.

Is there a shortcut in Notepad++ to select everything between two tags (excluding the tags; like when you double click a word it selects the whole word).

<p>This is some English that needs to be translated here. 
I want to just click in this area to select all of this 
text between these two paragraph tags.</p>
<p>This would be another block of translation to do</p>
    <li>I want to click here and select everything between the li tags</li>

Direct answer:: No.

Can it be made? Yes.
Simply? Yes.
Into a single shortcut? Yes

What's needed? N++ PythonScript and HTML Tag plugins.

Why? We are going to use the HTML Tag's Select Tag and Contents from a python script that will adjust the selection made by HTML Tag by moving the start to just after the first '>' and the end to just before the last '<'.

After installing the N++ PythonScript plugin create a new script with this code::

# Reduce selection to omit the outer most tags selected by the 'HTML Tag' plugin.

from Npp import *

def omit_tag( args ):
    SelText = editor.getSelText()

    if SelText:
        orig_Start = editor.getSelectionStart()
        new_Start = orig_Start + SelText.find(">")

        orig_End = editor.getSelectionEnd()
        new_End = orig_Start + SelText.rfind("<")

        if new_Start > orig_Start and new_End < orig_End:
            editor.setSel( new_Start + 1, new_End )

def main():
    editor.callback( omit_tag, [SCINTILLANOTIFICATION.UPDATEUI] )
    notepad.runMenuCommand("HTML Tag", "Select Tag and Contents")


After creating the script, use the PythonScript configuration dialog to add the script to the 'Menu Items' list (which will allow us to assign the shortcut). Restart, then use the Settings->Shortcut Mapper::Plugins dialog, add a Shift+Alt+T shoftcut to the new entry for the script you just created. Restart again to write out the new shortcut entry the N++ config.

So now (using your sample text), from the line where you wanted to click::

CTRL+T to jump to the other tag.
CTRL+Shift+T to select the whole tag block.
Shift+Alt+T to select the inner text.

If you attempt to select the 'content' portion of the block you'll notice the line endings are captured too. This could be seen as either a plus or minus depending on your viewpoint...

One recommendation, make use of SCI_SWAPMAINANCHORCARET to allow you to adjust either end of your selection using the normal movement and selection modifiers. You can set it from the shortcut mapper on the Scintilla panel (near the bottom). I've set mine to CTRL+Shift. which works great, since when already modifying a selection Shift is usually already pressed.

Hopefully that helps. Have fun!

| improve this answer | |

if plugin install do not bother you, I highly recommend to install HTML Tag, especialy if you are an html eater.

Once setup, just ctrl+shift+t with cursor on the opening or closing tag

| improve this answer | |

I would use the "Fold All" (Alt-0) feature so every paragraph is displayed as a seperate line. In Word I would add <p> at the beginning of every line and </p> at the end of every line and then overwrite complete lines using Shift-Down to select a line and Ctrl-V to paste the translated line from Word. Unfold All (Alt-Shift-0) unfolds everything once you are done.

| improve this answer | |

This task of selecting text between tags can be accomplished without scripts, but not in Notepad++.

If you install SynWrite editor, just call command Search -- Select current token and text between tags is selected.

| improve this answer | |

I know this post is 4 years old, but since I was in the very same situation, I thought it could be still useful.

You can also use a Macro, that will automaticaly underline text found between the symbol > and <.

To create the macro:

-Click before the tag < p >, so the flashing bar is on the left side the of the tag.

-In the menu, click on Macro - Start Recording

-Press CRTL+F. Find the symbol >, then close the window. This last part of the tag will be underlined.

-Press the right Arrow on your keyboard (one time).

-Hold Shift, then on the keyboard, press the End button twice (twice if the function Word wrap is activated; otherwise, press the button one time only).

-While holding Shift, press the left Arrow so the last tag is not underlined. Now, only the text between the tags will be underlined.

-Click Stop Recording, and click Save Current Recorded Macro.

I was using CTRL+SHIFT+NUMBPAD+ to activate the macro. It becomes pretty easy to go from one section to the other, and simply paste your new text.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.