Hello PhpED team,
Here's something that I would not just like to see in PhpED, I would love it to death!...and I been waiting for this a lot, every new version I check to see if it has been done so I can finally ditch ZendStudio and possibly jEdit...but unfurtunately every new version I'm disappointed to find out it hasn't been done. and back to ZS
Ok I installed PhpED, it has code templates but they are pretty much useless right now... at least for me. Let me explain how I would like them to be...
If you ever used jEdit you'll definetely miss their great SuperAbbrevs plugin. and If you have seen how TextMate works then you definetely knows this feature really rocks. This is exactly what all editors are missing and I can't understand why developers simple don't see how much this enhances productivity by ALOT. As you may already know code templates are great but just able to define the cursor position don't do as much as able to define user variables in them and interact with them. So what is exaclty do I want ?...
Smart Code Templates... Textmate snippets.
What is this exactly?...
Able to define code templates with variables, such variables define tab stops of templates. What do I mean?...examples.
Note: This examples are based of SuperAbbrev plugin of jEdit, which has some limitations I explain below.
let's do a simple one...
Name: tag
code: <${1:TAG}>$end</$1> |
when I type tag and press tab, I get this...
<TAG(this is highlight)></TAG(this is same $1 tag so it just references the value of what I type in other...)> |
when I start typing I get this...let's say I type div...
If I press tab then it goes to next variable in this case there's only one var defined so it goes to $end variable which defines the position of cursor... pretty much "|" in PhpED right now.
Ok I type "Hello world", but now I don't want a div tag I might do just a P tag so I press shift+tab it goes to previous variable, type p and now I got this...
NOTE: ok this is great but the plugin and even zend editor lacks some "smart" actions in it. What I mean?, well If I type p id="blah" guess what happens to closing tab ?... the same, not cool... Textmate on the other is more smart and exactly what I want in PhpED.
Ok that's great, but let's do a more advanced one...let's do javascript...
Name:fn
code: function(){ $end }
Name:st
code: setTimeout($end,${1:time}); |
I type... st get
setTimeout(,time[highlighted ready to type]); |
ok I set time... 3000...press tab It goes to next variable in this case $2... In there I type fn press tab... now I have this...
setTimeout(function(){ [cursor here] },3000); |
and done in like 3seconds I did what it could take u 10...
let's do a PHP example this time a lil more advanced template...with selections....
name: fnc
code:
function ${1:name}($2){
$str = <#=selection#>$end;
echo $str;
} |
let's say I got this text highlighted... [Hello World] (without brackets)
I invoke templates command... this time is not tab u can have it assigned to shorcut I have it at ctrl+tab
and type fnc, press enter... I get...
function name(highlighted ready to type)($2){
$str = Hello World;
echo $str;
} |
[/code]
type my function name, press tab I goto $2 var... there I type any $str...press tab again and I go to $end variable... Result?
function helloWorld($str){
$str = Hello World;[cursor here]
echo $str;
} |
and done... in like 10secs I what it can take u more than 15...
see how much time is saved, and how fast you complete your projects?... I don't get why developers can't see that... I do. imagine having it for all your most used functions, methods, properties...defenitely a must-have feature for me. I would love to see this in PhpED.
jEdit and Zend both have it but they are Java based and both have limitations, jEdit no great support for PHP, Zend no great support for CSS,XHTML,JS,XML...
Also, superabbrev has one limitation right now. It doesnt let you use code tempaltes within code templates... so that pretty much limits you... please make sure you can use code templates within code templates, thanks!
Another thing, have it like textmate, able to trigger the template by tag or shortcut, this is a nice thing, both jEdit and Zend only offers tab triggers.
Another feature, I don't know if PhpED does this already, column select and multi-select?...
Column selection, you do a zero width column selection and type something and it types that in all columns...
Multi-select is just that allows you to have more than one selection...without this you select, paste,select paste, etc...
With these features PhpED would be closest thing to Textmate for windows! I'm sure it will draw more customers too...I know people who will even pay hundreds to have something like textmate in windows... I know I would. People just love these features... they know it enhances their productivity and they are VERY useful. There's a reason, why Textmate is widely popular. Also why us windows users envy mac users for textmate no kidding lol..., these features are the part of that I think (at least for me). Simple because no editor in windows have it exept for those Java based which not many people like to use I think we all know why...I have a good fast computer and still dont like Java editors... but they are the only ones with the best features. At least for now.
PhpED has great features but I miss this great feature, alot... I multi task many projects at once and speed is a key factor, smart code templates give me that speed boost, saving me from typing tons of repeated keystrokes.
Really, if anyone knows a great editor in windows with PHP supports like PhpED and Zend offers but also has great support for other 4 main web development languages, HTML, JS, CSS and XML and with code templates like I explained above and column select + multi select, syntax highlighting... inform me please! It's my dream editor and I'm still waiting for that "Perfect" editor
I'm sure one day I will have that "Perfect" editor, I been dreaming about, might be PhpED in future
, maybe jEdit if one day their php plugin is much better and superabbrev is fixed... or Zend if they put more support for other 4 languages I mentioned above and enhance their templates... or maybe another one who's being developed right now and it looks promising...
Thank you very much for your time in reading this, appreciated
, even if the feature doesn't make it to PhpED never.
P.S.: Some demos about these features.
(superabbrev plugin)
(code templates, they call it snippets)
(code templates, they call it snippets)
(code templates, they call it snippets)
(column selection I'm talking about)
[Edit] After thinking a little bit about this feature I think it should be called "Interactive Snippets" or "Dynamic Snippets" that way it will draw more attention for possible customers... Of course if you guys do add this feature it would be silly not to make a new page to highlight this great feature and a demo too, one people see this they will want to try it, once they do it they will get addicted to product .