In some of my code I use a PHP library called React/Curry and to save typing it uses a unicode ellipsis (…) for a method name. Yes, that is right unicode method names can be legal in PHP!
<?php $firstChar = Curry\bind('substr', Curry\…(), 0, 1);
See I told you so!
Well that is great, but how do you type a unicode character into a Netbeans document?
To save having to constantly copy and paste the … character from a symbols list I have setup a very simple macro in Netbeans to print the character for me. This means that control + alt + . now dumps the … character into the document at the current cursor position.
You to can enjoy this revelation in four simple steps:
- Tools > Options > Editor > Macros
- Click New and give it a name ("ellipsis" perhaps)
- Enter the following (include the quotes!) into the Macro Code box: "…"
- Click Set Shortcut and choose the keystroke you want (I chose control + alt + .)
Now when you bash those keys in your documents you’ll get a nice … character or whatever other unicode character you have setup.
One little caveat is that if you are using jVi like I am then the Macro editor seems to play a little havoc with it after setting up a new macro. This is easily resolved by ticking jVi off and on again in the Options menu of Netbeans.
Slightly annoying, but perfectly liveable.
I picked this little tip up on the Netbeans forums and as it took me a long time to find I thought I would share it!