Question about auto-complete function

Ask how to do things or if a certain feature is available in the program.
Post Reply
User avatar
DerellLicht1
Posts: 73
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

Question about auto-complete function

Post 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??

User avatar
DerellLicht1
Posts: 73
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

Re: Question about auto-complete function

Post 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.
Last edited by DerellLicht1 on 02 Nov 2022 21:04, edited 2 times in total.

User avatar
pjj
Posts: 2013
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: Question about auto-complete function

Post 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.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

User avatar
DerellLicht1
Posts: 73
Joined: 23 Jul 2021 17:38
Location: Fremont, CA, USA

Re: Question about auto-complete function

Post 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!!

User avatar
pjj
Posts: 2013
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: Question about auto-complete function

Post 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.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Post Reply