Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name snippets and insert snippet with tag + shortcut #33

Open
malix0 opened this issue Sep 29, 2020 · 7 comments
Open

Name snippets and insert snippet with tag + shortcut #33

malix0 opened this issue Sep 29, 2020 · 7 comments

Comments

@malix0
Copy link

malix0 commented Sep 29, 2020

I really liked SnippetPlus which allowed you to insert the snippet by typing the name and then pressing Ctrl + Return. Adding this to NppSnippets would be really cool.

I add the link to the SnippetPlus homepage where there are some explanatory screenshots
https://sourceforge.net/projects/snippetplus/

@ffes
Copy link
Owner

ffes commented Sep 30, 2020

I think this is a dup of #32

It is a pity SnippetPlus is not open source otherwise I could have looked at their code for inspiration.

@ffes ffes added the duplicate label Oct 13, 2020
@ffes ffes closed this as completed Oct 13, 2020
@malix0
Copy link
Author

malix0 commented Dec 1, 2020

The Quick Text plugin has the same behavior of SnippetPlus. I can define a tag and then insert snippet just pressing a key shortcut after the tag. May be you can look there for the method they use

https://github.com/vinsworldcom/nppQuickText

@ffes
Copy link
Owner

ffes commented Dec 2, 2020

@malix0 I will take a look at QuickText. I like the idea you describe how Quick Text handles the shortcut.

Did you know that there is a build from the latest master branch that included a search bar above the snippets? When you assign a hotkey to the menu item to go the search box you get close to the functionality you want, if I understand correctly.

You can download the dll from:
https://github.com/ffes/nppsnippets/actions/runs/307122959

@malix0
Copy link
Author

malix0 commented Dec 3, 2020

I try the version above, it comes close to the mode used by QuickText, but I prefer the latter approach.
The search field, once filled, keeps the same value and in this way, if I want to insert another snippet, I have to delete the old value and type the name of the other snippet. Instead in the mode adopted by QuickText, I just type the tag (snippet name), press the shortcut assigned to "Replace tag" command and directly obtain the replacement of the tag with the desired snippet.

@malix0
Copy link
Author

malix0 commented Dec 3, 2020

Another useful feature of QuickText is this one (excerpt from Usage)
Once a Tag is inserted, you can use the Tag insertion hotkey again and again to navigate through the hotspots in the inserted Tag snippet. The hotspot is $ character, for example then snippet below can be inserted typing "link" and pressing the shortcut assigned to "Replace tag", then pressing the shortcut again, move cursor where is the $ character
link=<a href="$">$</a>

@ffes
Copy link
Owner

ffes commented Dec 7, 2020

he search field, once filled, keeps the same value and in this way, if I want to insert another snippet, I have to delete the old value and type the name of the other snippet

That should not be too difficult to fix.

@ffes
Copy link
Owner

ffes commented Dec 7, 2020

I am flattered you want to see that functionality added to my plugin. Apparently you care about my plugin, otherwise you would just use Quick Text and not bother to open this issue and keep it alive. I really appreciate that!

Recently #34 was opened, which I closed as a a dup of this one. It's strange to see these requests coming up in such a short period. This plugin is almost 11 years old and no-one asked it before.

I will reopen this issue so people can read it.

What I can offer at the moment is the filter implemented for #32. I cannot offer a real autocompletion feature, like Quick Text has. And duplicating the entire Quick Text plugin in this plugin is not something I see myself doing any time soon (if ever). Note that the Quick Text source file that does all the hard work is over 1000 lines, so it is not an easy copy-paste.

I use N++ every day for all those small edits a dev/sysadm does every day and it will be for the foreseeable future. But when I need to do real development I use Visual Studio of vscode. I find N++ to limited for that. They messed up with markdown as a UDL instead of using the Scintilla builtin parsers. There is no syntax highlighting for Dockerfile, SCSS or TypeScript to name a few. So my personal need to re-implement such a complicated feature from Quick Text is rather limited.

And it will have a huge impact on NppSnippets. What should I do with the schema of the database? My snippets have a name, theirs have tags. Not the same thing. The tags need to be unique within the library. How strange it might seem, that is not a requirement in my database format at this moment (although it probably should have been). I should add a column to store that tag, create a field in the dialog and handle that properly, make sure the exports and import still works, etc, etc. Why would I even keep the two parts in a snippet I use right now? The two parts could be combined and a $ should be between those parts. Handling hopping to the next the hot-spots in the snippets needs copied. Getting the auto-completion in there, adjusting the docs, the sample database, other things I can't think of right now but will arise. All these things need lots of work.

I will gladly review PR's that copy the feature. If the devs of Quick Text would like to implement my list with snippets to make their plugin more visible and mouse friendly, go ahead. The original idea of my plugin wasn't mine anyway. It is heavily inspired by the Clip Library of TextPad. If they want to combine the two snippets plugin still in active devlopment, come and talk.

@ffes ffes reopened this Dec 7, 2020
@ffes ffes removed the duplicate label Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants