vinsworldcom / nppQuickText

Notepad++ plugin for text snippet substitution.
GNU General Public License v2.0
21 stars 4 forks source link

Usage Instructions Are Confusing #16

Closed rhclayto closed 4 years ago

rhclayto commented 4 years ago

I'm not sure how to use this. Let's use an example. Suppose I have an HTML file opened, & I want to select some text then add HTML comment tags around the selected text. What exactly am I supposed to do? The instructions are unclear.

I have also tried inserting a <br /> tag by doing the following. On an empty line, I type br, then press Ctrl+Enter. Nothing happens. Do I have it all wrong?

Windows 10, Notepad++ 7.8.5 32-bit, this plug-in installed using the plugins admin.

pryrt commented 4 years ago

The instructions aren't the best (@vinsworldcom mostly kept them as-is from the original author; he's just supporting QuickText insofar as he wanted to use it, but needed a 64-bit version; he has then done a few bug fixes, but hasn't had the time for a full cleanup). Please be patient.

The default keystroke of Ctrl+Enter competes with Edit > Autocompletion > Word Completion. You either need to use Settings > Shortcut Mapper > Main and change Word Completion's shortcut to not conflict with QuickText, or you need to change Settings > Shortcut Mapper > Plugin Commands's Replace Tag shortcut to something else. It actually works with TAB, which is @vinsworldcom's suggestion, though I personally use Ctrl+Shift+Enter. I will assume you changed it to TAB for the rest of my response.

As far as your first point: QuickText isn't for highlighting text, and wrapping something around; it's kindof a super-autocomplete: so you can type something short, followed by TAB, and get a bigger chunk of text entered. For example, typing h1[TAB] will expand to <h1>|</h1>, where the vertical bar is your cursor, not literal text. And typing div-id-class[TAB] will insert

<div id="|" class="|">
    |
</div>

and the cursor will be at the first vertical bar in the id attribute value; hitting [TAB] after typing the ID will move you to the class-|; hitting [TAB] again will take you to the indented position inside the DIV.

vinsworldcom commented 4 years ago

@pryrt Thank you! You're everywhere answering questions!

@rhclayto Thanks for the feedback. As @pryrt says above, this is not "my" plugin but one that seemed to be abandoned that I was using so I found the source code and updated for new Scintilla as well as made a 64-bit version. I never intended for it be installed via Plugin Admin since I don't know much how that works and there are some dependencies for this that I don't know if Plugin Admin can address. Like installing the QuickText "database" file.

I just install manually so you'll have to do some poking, but if you look in your Notepad++ plugin directory, there should be a QuickText folder and in that folder should be:

.\QuickText\ |-- QuickText.dll `-- QuickText.ini

The "QuickText.ini" is your "database" file and if it's not there, then this plugin won't work. You can grab the QuickText.default.ini from this repo and put it in that directory, renaming to "QuickText.ini" if it indeed is not there.

Then as @pryrt says above, you'll have an HTML document open in Notepad++. It cannot be a blank "new" document, it must be saved as HTML so the plugin can understand which language you are using and hence which QuickText completion tags to use.

In your HTML document. just type:

br

Then select Plugins => QuickText => Replace Tag

it should turn into:

<br />

This is why most "power users" make a shortcut to this menu item. By default, the shortcut key is "CTRL+Enter", but I switch it to "Tab"; @pryrt above said he uses "CTRL+Shift+Enter".

The "br" for HTML is one of the default included QuickText expansions in the QuickText.ini file. You can see the "available" tags for any language by Plugins => QuickText => Options.

You can add more there if you like.

If you're looking to insert "stuff" "around" text, have a look at Surround Selection.

If you're specifically looking for HTML expansions, have a look at Emmet.

Hope this helps ..

Cheers.