So……Here is a new snippet plugin FingerText.
Just unzip the zip file and copy the plugin folder into the notepad++ plugin folder.
And the source code is at
For details you can read the readme file or refer to the description on the source code page. The plugin is now in alpha stage so do expect bugs and do expect non-backward compatible changes in future releases.
Again, this is in alpha stage so I don't have a lot of "special features" to talk about, but it do support
1. tab triggered text substitution (Ok…….this is a snippet plugin, therefore it support text substitution)
2. Hotspots Navigation, which means you can use tab to navigate to several spots in your snippets and enter text into it.
3. Hotspot hint and default value. The hotspots contain some text which can act as a default value (The value that will be put into the hotspot if you just hit tab)
4. Snippet comment (You can type comments into your snippet files and those characters will not be substituted into your document when the snippet is triggered.
5. Chinese characters supported (I mean your snippet can contain Chinese character. The snippets should be encoded in ANSI, but they are triggered correctly in either ANSI or UTF-8 encoding documents). Chinese character snippet name are not supported though.
6. I try my best to make the tab key working correctly. That means if the plugin is not triggered, it will still send a TAB keystroke to the document so that you can indent your lines correctly. Please tell me if this is not working as it should be.
The primary goal of this project is to make a working snippet plugin. But in future development I think I will add some commands that can be triggered by typing some keyword into the document and hit tab. Also, I may add scripting support to snippet which you can use a script output as the snippet text. The scripting language will be almost surely Ruby. Sorry that I know the notepad++ community like python a lot. But I like Ruby more. (Anyway…this is future development and I should not talk about that until a really get there =_=)
Nice job! At first I thought "oh, another snippet plugin", but the multiple hotspot support really makes this plugin unique. Couple of improvements I would suggest:
1. Remove the binary from the git repository - github has a "downloads" section you should add the binary file to, binaries shouldn't be in the source repo.
2. Line 285 and 292 of PluginDefintion.cpp - grab the size of the selection first, then allocate your array.
::SendMessage(curScintilla, SCI_GETSELTEXT, 0, (LPARAM)&hotSpot);
int selectionLength = ::SendMessage(curScintilla, SCI_GETSELTEXT, 0, NULL);
char *hotspot = new char[selectionLength + 1];
::SendMessage(curScintilla, SCI_GETSELTEXT, 0, reinterpret_cast<LPARAM>(hotspot));
// do stuff with hotspot text
delete  hotspot;
Otherwise if the user has changed the selection to greater than 100 characters in the middle, you'll get a crash/explosion/format c: etc. :)
And lastly a question: how do I have a default value that is used if I just press tab - I can't see an example of it, or find it in the documentation.
Thanks again for a great plugin - multiple hotspots (especially multiple simultaneous hotspots!) are cool.
Thanks. Thanks for you suggestions! Especially for the debugging!!!!! (aaaarrrrrr….there are a lot these of array overwrite things………C++ is difficult =( )
The hotspot are indicated by $[!!] if you just press tab and go to next hotspot, the position will become "Name". So you can fill in the default value to the place "Name".
Say the mit snippet start by
Copyright (C) $[![[year]]!] by $[![[Owner]]!]
if you change it to
Copyright (C) $[!!] by $[![Dave]!]
The text will become
Copyright (C) 2011 by Dave
When you trigger the snippet and keep hitting tab.
Hi erinata, thanks for this great plugin, it could be very very useful for the NPP community.
Anyay, I've already a sort of.. question/request.. Could you consider joining all snippets (at least on a per language basis) in single configuration files? I think that having a distinct file for each snippet can be quite confused and inconvenient to edit/handle.
So what i propose is to keep different folders for different languages, but with just one file in each folder, with all the snippets inside. What do you think?
Best regards and thanks again,
Just another note:
If you want to maintain also the one file per snippet configuration, you could also add the support for a sort of snippets.cfg file in the language folders. Then the plugin would first search for such config file, parsing and using it, if found, or scan the entire directories parsing all snippets files, if not found.
I adapted the changes suggested by Dave and changed the download link to
Also, if you guys like to download it from sourceforge, here is the new project in sourceforge.
Francesco: Thanks for your suggestion. But I am afraid that I need to keep this file structure because I rely on this structure so that I do not need to load anything upfront when the plugin starts, and I do not need to load anything else except for the snippet that I trigger, and I do not need sqlite3 (yea I say it in a very elegant way, but the ugly truth is I don't know how to write the program using sqlite) …………………
But I definitely need some way to parse the snippet folders because I need that if I want to implement some kind of snippet tag auto complete…… Thanks for being interested in the plugin anyway.^_^
thanks for the explanation, now I see where the problem lies. You are not maintaining a structure in memory of the available snippets and tags, so each time tab is pressed, you are searching for the requested tag/snippet straight on disk ( int findFolderTag(TCHAR tagPath, char tag, std::ifstream &file,TCHAR path) )
Well, then this is not going to be a quick addition, I see :) But as you also said, if you want to enable auto-completion, you need to have the complete list of tags available, and I think that at that point, it would be nicer to have it in some structure in memory, avoding to parse each time an entire folder.
And maybe :) at that time, it could be even simpler to parse a single file than an entire folder…. ^^
I'm not into C++ programming at present, (once I was, but lately I have been drifting to some different lands: ie PHP, JS, ActionScript, you know.. the web :) ) but I think some guys here could give you some quick and easy suggestions on how to implement such structure. Parsing a single file should be very very easy and putting the data in an array of structures with all the needed info should be easy as well..
let's see ^^
Can I second the request for a single file for the snippets (or maybe per language?)
At the moment, plugin manager won't be able to deliver the snippets - there's a bug copying *.*, and there's also no recursion support. Until the new version of that comes out (eventually… not sure when that'll be yet), I'll only be able to copy a few sample snippets as part of a plugin manager installation.
If I get 10 minutes later I'll fork your repo and add a demo of SQLite usage - it's really, really, really easy! That might be a nice way to go for autocomplete too, as you'll need to be able to select all tags starting with "ab" for example. And you wouldn't have to load/parse anything at startup.
Another thing I thought about - it'd be nice if it took the selected language first, then the extension - e.g. if I'm programming a .tt file, I still want my C# snippets. Not quite sure how to combine the two though, as I can see the advantage of using the extension too. Maybe have a snippets for "language" C#, and snippets for "extension" .cs, then you'd have the best of both worlds.
I worked out why the "default" text wasn't working for me - it doesn't work on the last hotspot, which makes perfect sense as there is no more hotspots, so you send SCI_TAB (which is absolutely correct, btw), which clears the selection and replaces it with tab, which is the default scintilla behaviour with just a word selected. There's no easy solution to that that I can see, except setting some flag when you replace a hotspot and set the highlight, and clearing the flag if you get CHARADDED or SELECTIONCHANGED notification from scintilla. Then if you get a tab press, if the flag is set and no more hotspots are found, then you should just set the cursor to the end of the selection. Tricky though…
Nice work, erinata, thank you!
Dave: how about this workaround (with an empty last hotspot):
Copyright (C) $[!!] by $[![Dave]!]
cocinerox's workaround is also something that I think of…..(well can I say that it's not a "workaround" but a "solution" if I officially put that into documentation? )
Ok I will reconsider the one file for the snippets thing. If you start thinking about why I opt to use this file structure, it's like the most intuitive way for me to search for a snippet. Anyway, I should put this on to the consideration list (but no promise though =P)
I have thought about the extension thing too. I know the there are advantages for language specific or extension specific snippet. I don't know how to combine the two and I opt for the later one. Partly because all other snippet plugins I have seen are using the language specific snippet method (I may be wrong though), and partly because I want to have specific extension for language that is not supported in notepad++, instead of just a "user-defined" for all of them.
For now if you are programming a .tt file and you like c# snippet, you need to copy the whole (snippet).cs folder and rename it to (snippet).tt ………this is not a "solution", but a "workaround" ….or may be an "ugly workaround"
A question for davegb3…………I guess I need to follow some structure if I want the snippet to work well in plugin manager? Say at least I need to indicate my version number in some particular place in my code?
kkrs: I think I am more an actionscript person too…………… I keep googling for simple syntax like copy string, initializing variables and loops in C++ when I am writing this snippet……..(so no suprise I made super stupid mistake in my code =P)
I've just sent you a pull request with a SQLite version of your plugin. I hope you'll consider merging it in, and creating the full snippet library from the existing file based ones.
As for plugin manager, yes, ideally you need to add a version resource to put the version number in - Plugin Manager uses the File Version attribute, so that should be "0,3,2,0". If you're working on VS express and therefore haven't got a resource editor, let me know and I'll add one for you - editing the text for it is easy, creating the text without the editor is painful!
However, it will cope without it - it just means i have to explicitly add the MD5 hash of the .DLL file with the version number, rather than just let it read the version number you provide. I'm working on the next batch of plugins as we speak, so it'd be great if you could get the version number in there before I'm done!
Dave, I've sent you an email to talk about the sqlite thing but I don't know if you received that or not. Also, I think I figured out how to may that rc file. I have included that in the project and will be available in next release.
Here is a new version of FingerText. (0.4.0)
Here is the github page:
And direct download:
Or you can go to the sourceforge page:
This is the first stable version which use sqlite3 instead of a bunch of files to store snippet. Thanks kkrs and davegb3 for your suggestion.
It also features a snippet dock which show all the available snippets and you can manage your snippets using the dock.
…….~_~ how come the picture is so big……how can I change the size……………………………..
Thank you very much for taking the suggestions and thanks also to Dave for his support and code.
I'll create my snippets and start using the plugin right now, and I'll let you know my impressions, if I find any bugs, and so on..
here I am :) The plugin itsels seems to be fine, and it's great.. there is only one major thing that users will definitiley report: on newest Windows, the default plugin folder, under program files, is not writable by default without running NP++ as an administrator.
So, saving and editing snippets won't work. The database file should then be moved to another folder (likely appData/Roaming/Notepad++/etc…) but I think there should already be some guidelines to be consistent among all plugins..
Thanks kkrs, I should put that into documentation. I am not putting my notepad++ in the program file folder so I didn't notice that.
However I really do not want to move the database to the appData folder as this breaks the portability…..any idea on how to solve it? I mean….the config folder is also under notepad++, so how other plugins read and write config files?
Can I save my database into the config folder? Or it is something bad that I should avoid?
There is - see NPPM_GETPLUGINSCONFIGDIR to get the right directory to store the config file in.
I see…….but does that solve the administrator problem? If someone install notepad++ in program files, the config folder is still under program files folder and I cannot write in without administrative rights?
Yes. The config folder is not normally under Program files - it's under %AppData%\Notepad++\plugins\config. But you don't need to worry about where it is, just call NPPM_GETPLUGINSCONFIGDIR and use that path to keep your plugin config.
Some users have the config inside the Notepad++ directory to keep it portable, so you can stick it on a USB drive or whatever. This can be chosen at install time. Again, if this is chosen, NPPM_GETPLUGINSCONFIGDIR will always return the right path, so just use that and forget about it!
It's shame that it's based on file extension but not on document set language.
You can use NPPM_GETBUFFERLANGTYPE and NPPN_LANGCHANGED to get current language and detect the change of language.
Otherwise, the font size is too big under my Windows 7 :
Could they be fixed?
Otherwise, It's a very promising plugin.