NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Can code templates be inserted like autocorrect?


Joined: 10 Feb 2007
Posts: 48
Reply with quote
Current you can set up auto correct so after a few characters are typed and then press the spacebar the rest of the code is automatically filled in. It is meant for a limited amount of code.

For blocks of code PHPed uses code templates. First you need to press CTRL-J, then select the code type, then locate the code you want to insert.

What I'd like to do is use the code template name like auto correct is used. So, by typing the name of the code template and pressing the space bar the code would automatically be inserted.

Is it currently possible to do that? If not would the developers please consider it.

Or is there another way to use code templates that I haven't yet found?
View user's profileFind all posts by StorymanSend private message


Joined: 10 Feb 2004
Posts: 93
Reply with quote
actually, you should be able to use the current code template system exactly as you desire.

The "name" section of the code templates can be though of as the shortcut. For example, there is a built-in code template named "datatovars" with a matching code block of

Code:
// assumes $row is returned value by *_fetch_array()
while(list($var, $val)=each($row)) {
  $$var=$val;
}

In the editor window, if you type in "dat" and then press Ctrl+J, you'll get a list of code templates that have a name that matches "dat". Since "datatovars" is the only match (at least by default) you can just press enter and it will dump in the code block. To make it work even more like what you described, just shorten the code template names. The "for" template is a good example. If you type in "for" and then press Ctrl+J, the IDE will automagically dump in the "for" code template without giving you the list of matches, and having to press enter.
View user's profileFind all posts by gilzowSend private messageAIM Address


Joined: 10 Feb 2007
Posts: 48
Reply with quote
Gilzow,

That works for me. A lot of my work involves WordPress and wanted a way to drop in the more common code blocks. Since all of the theme templates created have the prefix 'WP-' a simple 'wp CTRL+J' brings up the list of code blocks. Save times. Thanks.
View user's profileFind all posts by StorymanSend private message
Can code templates be inserted like autocorrect?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic