How to create abbreviations for java code
-
I have just started learning java and I was wondering if there was some way to create abbreviations for words like in MS Word.
For example, if I type psvm and press space bar, I want this to expand to public static void main
If I type sop and press space bar, I want this to expand to System.out.println
Is there some way by which we can do this in Notepad++??
Can I create a Python Plugin for this??
Thanks for reading. -
Reportedly, the “FingerText” plugin can do such a thing. There are probably other plugins with that functionality as well.
-
@Alan-Kilborn How do you install a plugin? I downloaded finger text and copied the files to the plugin folder but I am not sure what to do next.
-
@Anurag-Saksena said in How to create abbreviations for java code:
How do you install a plugin?
There are two ways. But first, it should be noted that FingerText is only available for 32-bit Notepad++ (from the official source). If you have 64-bit Notepad++, the files you downloaded won’t work; if you must stay with 64-bit Notepad++, you will have to find alternate solution (or convince someone to rebuild FingerText as 64-bit – or find someone who already has)
Method 1: Use the Plugins > Plugins Admin to check the box next to “FingerText”, then click Install
Method 2: Download the zipfile (as you did). Exit all instances of Notepad++. In your Notepad++ installation (often
c:\Program Files (x86)\Notepad++
), go into thePlugins
subfolder, create a directory that matches the name of the DLL without the extension (it looks like it’s calledFingerText.dll
, so the folder in a standard install would beC:\Program Files (x86)\Notepad++\Plugins\FingerText
), and unzip the DLL file into that folder. Reload Notepad++.At this point, Plugins > FingerText menu entry should exist.
-
@PeterJones said in How to create abbreviations for java code:
you will have to find alternate solution
I’ve been using QuickText on 32-bit and then compiled and slightly improved it for 64 and 32-bit since it seemed to be unsupported. You can find it here:
https://github.com/vinsworldcom/nppQuickText
Cheers.
-
QuickText appears to be available via Plugins Admin (not sure why you didn’t mention that?):
-
Interesting. I never did the pull request to nppPluginList to add it. Wonder how it got there? Also, that’s not the latest version; 0.1.1.1 is available on the GitHub releases page.
Cheers.
-
Not being a plugin author myself, I’m not sure of the process for (a) getting your plugin in the list [so I’m not sure how yours would have gotten there] or (b) getting your plugin version-bumped in the list.
But I suspect Mr. Jones will have some sort of pointer coming up… :)
-
The other thing is that it’s not “my” plugin. Someone else is the original author, it just seemed to be abandoned. And since I was using it on 32-bit and wanted to move to 64-bit, I got it to work for that and added some extra enhancements that I wanted. So it really isn’t my plugin nor I think mine to list.
Happy to make it available on GitHub, but feel pretty weird about it being published in some list with me as the goto / author.
Cheers.
-
Interesting. I never did the pull request to nppPluginList to add it. Wonder how it got there? Also, that’s not the latest version; 0.1.1.1 is available on the GitHub releases page.
It appears @chcg added it with a commit last summer. And in December, updated it to 0.1.1.1.
For adding to the list (though I’ve never done it), the nppPluginList page implies you just do a Pull Request to add it into the JSON files. You can search for closed PR to see what the PR look like that get plugins updated (I couldn’t find any PR attached to @chcg’s commits, though I admit navigating these things isn’t second nature to me yet, so there might be an associated PR with his commits).
-
@PeterJones said in How to create abbreviations for java code:
And in December, updated it to 0.1.1.1.
I wonder why it still shows as 0.1.0.1 in PA then?
but feel pretty weird about it being published in some list with me as the goto / author.
Yea, not to fault @chcg in any way, but it does seem awkward for you, given the project’s history.
-
@Alan-Kilborn said in How to create abbreviations for java code:
I wonder why it still shows as 0.1.0.1 in PA then?
In what version of Notepad++ / nppPluginList?
v7.8.4 shows 0.1.1.1 for me:
(both have the DLL’s RClick > Properties > Details showing 1.1.7.0)
-
Ah, I’m forgetting that PA isn’t quite “live”, like PM used to be. A shallow replacement, sadly. And all that work put into it, too…
Yea, I’m running a slightly older N++, so it makes sense.
Sorry to confuse because I forgot how things work. -
@Michael-Vincent said in How to create abbreviations for java code:
Happy to make it available on GitHub, but feel pretty weird about it being published in some list with me as the goto / author.
Especially if annoying people like me start asking you to make fixes, rather than the original author. Then you might have to start supporting it, or ignoring those people. :-)
I say this for no particular reason, because I wouldn’t ask you to look into why, when I installed 0.1.1.1 via Plugins Admin, it defaulted to an empty QuickText.conf.ini, rather than using the values for the defaults – because if I were to ask you about that, it would be like trying to assign you ownership, and I wouldn’t do that. ;-)
When that happens, then the Options… dialog is unintelligible; if that happens to someone else, they should Plugins > QuickText > Open Config File…, and paste in the contents of https://raw.githubusercontent.com/vinsworldcom/nppQuickText/master/Config/QuickText.conf.default.ini and save, then Plugins > QuickText > Refresh Configuration… – though it would be nice to not have to go through those hoops.
Oh, you meant because of copyright/license/ownership? That makes sense, too. It was released under GPL2, so as long as you attribute the original authors, maintain license, and make it clear that you have made changes from the original, there’s nothing wrong. (I’m never sure whether GPL requires you to change the name of the project if you make a fork or not, though it doesn’t seem to be that way: IANAL.
In other open-source communities – like Perl’s CPAN, it is possible to take ownership of abandoned open-source projects, and those don’t require renames, so I would assume it’s the same here.) -
@PeterJones said in How to create abbreviations for java code:
like Perl’s CPAN, it is possible to take ownership of abandoned open-source projects
Yes, I’ve done that. And I know Perl better than C++ so feel more comfortable actually supporting my Perl modules.
I don’t know why it doesn’t use the default one supplied with the ZIP file / install. Thanks for the work-around. I guess I never noticed already having it installed and working - probably had to jump through those hoops the first time I set it up from the original author and then my subsequent “upgrades” were just overwriting the DLL - the config and INI file where already in place.
Not sure if this helps now that you’ve figured it out:
QuickText.conf.default.ini = is an example of the the Plugin’s config file
QuickText.default.ini = is an example for the code snippetsWhen installed, it should end up like this:
$(NPP_INSTALL_DIR)\plugins\ |_ QuickText | |_ QuickText.dll | |_ QuickText.ini |_ Config |_ QuickText.conf.ini
Cheers.
-
I wouldn’t do that. ;-)
But in all seriousness, if you’d like bug reports or feature requests to be tracked on your github, I can add them. If it’s good enough for you, and you aren’t planning on any support or future fixes, then I don’t want to clutter your repo with issues that will just be ignored for years (or forever).
(If you don’t reply, I’ll assume “no issues, please”.)
-
I don’t mind you or anyone adding issues to track as long as you don’t mind they may never be fixed :-P
Seriously though, I found QuickText the most “useful” snippet plugin for how I worked and 2 things happened, I moved to 64-bit and Notepad++ updated Scintilla - both of which “broke” my usage of QuickText. I hacked at it with my sub-par C++ skills and was able to get 64-bit compiled with the new N++ plugin architecture and Scintilla updates so was pleased to just keep using it.
I haven’t given much thought to how I’d re-architect QuickText to address some of my minor gripes, but as it is now, it just “works” so I leave it alone.
I’m “more actively” updating “my” other plugins - again, none of these are “mine”, they are clones of other people’s work that either seemed abandoned, not updated in years or my request for features were turned down, so I implemented them myself. For the same reason as QuickText, I’m hesitant on listing them officially.
But for “power users” like yourself, that can stand a bit of “buginess” and hopefully no seg-fault crashes, feel free to try them out. Again, feedback welcomed (but possibly ignored :-) (coding N++ plugins isn’t my day job).
Cheers.
-
@PeterJones said in How to create abbreviations for java code:
I can add them.
5 issues!?!?! WOW, I should have said “no issues please!” LOL.
Joking aside, thanks for taking a look and taking the time to do the write-ups. I think 11 is an easy fix, 12 I’ve notice myself and just lived with it by editing the QuickText.ini file directly to add multiple new snippets. 13 I didn’t realize, although GLOBAL tags didn’t work at all in previous original versions. 14 and 15 - dealing with Unicode scare me :-(
I’ll probably approach in what I think is easiest: 11, 13, 12 and back burner 14 and 15 for now.
Cheers.
-
@Michael-Vincent said in How to create abbreviations for java code:
I should have said “no issues please!” LOL.
I tried to warn you. ;-)
None are showstoppers for me. Until I train myself to actually use the quick text snippets, they won’t be efficiency stoppers.
And I have a pythonscript implementation of #15, so for now I have a workaround on that one:
gist forpyscReplaceBackslashSequence.py (the mention of nppQuickText actually interrupted my development, while I explored to see if it would be enough for me; I ended up finalizing my script anyway) -
@PeterJones said in How to create abbreviations for java code:
actually interrupted my development, while I explored to see if it would be enough for me
I hear that. Frequently I’ll wish there was a quicker way to do something or something I’ll see a peer doing in VS Code and I’ll think “there must be a Notepad++ way to do this”. I’ll get sidetracking trying to find something.
I’ll look for a plugin or look for a way to script it in NppExec (my goto scripting engine). In fact I have a bunch of NppExec scripts (compile, style, help manual / docs, run, debug, open include files) that do a bit of formatting then send arguments to a monster Windows batch file that actually executes the task.
Sometime a find a plugin that’s promising, but it doesn’t do everything or it’s just 32-bit and then I’ll find myself cloning and hacking at it (JAPH, or in this case JAN++PH [Just Another Notepad++ Plugin Hacker]) to get what I want. That’s how all of “my” plugins came to be.
Cheers.