Page 1 of 1

Question about auto-complete function

Posted: 02 Nov 2022 15:25
by DerellLicht1
Is there a way to expand auto-complete, to generate a full code template??
As an example, back when I used MultiEdit, I could type "if<space>" and it would expand to:

Code: Select all

if (<cursor>) {

}
Typing braces already does this, but I don't know how to do it for various keywords... is that present somewhere??

Re: Question about auto-complete function

Posted: 02 Nov 2022 18:10
by DerellLicht1
Okay, I figured out how to create/use text clips... that does what I was looking for...

One thing that would be nice, though not vital, is if I could somehow attach abbreviations to their related clips;
So, for example, I could type 'if<some_trigger_key>' and have it execute the 'if' text clip... that would save me from having to keep the Text Clips panel open all the time... however, it's not that important, having the clips option was the major desire.

Re: Question about auto-complete function

Posted: 02 Nov 2022 20:50
by pjj
Please have a look at abbreviations (same panel as Text clips):
Add new Abbreviation

Make sure you are adding the abbreviation to the correct highlighter by selecting it under the "Abbreviations" node. If not available, add a new highlighter folder.

Type an abbreviation e.g. "tc" for try ... catch block. Add variables for tab stops. You can click on the [...] buttons to insert variables and variable commands. And type the code that should be expanded when you type the abbreviation and hit e.g. TAB.
E.g. open up JavaScript file, type in "func" and press tab key. Hey, presto, you get basic structure for new function definition.

Re: Question about auto-complete function

Posted: 02 Nov 2022 21:14
by DerellLicht1
Add new Abbreviation
[...]

Type an abbreviation e.g. "tc" for try ... catch block. Add variables for tab stops. You can click on the [...] buttons to insert variables and variable commands.

And type the code that should be expanded when you type the abbreviation and hit e.g. TAB.
I don't quite understand that last line... I think it is referring to the 'Press new shortcut key' option in 'Edit item', but that's not really what I want; I certainly don't want to have to memorize control-keys for every macro that I want to create, that would be a mess...
I would much prefer to be able to link the clip to the typed text that it is related to, then hit some specified 'execute text clip' key...
That's how both MultiEdit and PsPad worked...

However, if that's not already available, I am satisfied with the Text Clips window... that provides 90% of what I was looking for in this function!!

Re: Question about auto-complete function

Posted: 02 Nov 2022 21:50
by pjj
No, it refers to the bottom part of abbreviation edit window:
Image
Shortcut keys for abbreviations don't work for me; only shortcut keys for text clips do. Trigger key for abbreviation is tab.