The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

My CFEclipse Snippets

posted under category: CFEclipse on February 23, 2006 at 1:00 am by MrNate

The coolest thing that I demo'd for CFEclipse last night was probably the snippets. These things can be killer if you know how to use them. They are a serious WOW feature. So, without further ado:

Nathan's CFEclipse Snippets

Download them, unzip them, and put them in your snippets folder. The default location is in your workspace plugins CFEclipse folder. As an example, here's where mine is:

C:\Documents and Settings\Nathan\workspace\.metadata\.plugins\com.rohanclan.cfml\snippets\

Watch out for that keyCombos.properties file, it keeps the key shortcuts. If you already have one, just merge mine into yours when you copy the folders, it's just a simple text file.

Most of my snippets have a shortcut key. Follow them by [ctrl]+[shift]+[period] (on windows, sorry, don't know the mac combo) to insert the snippet. Here's some of my favorites:

fun = cffunction tags
arg = cfargument
q = cfquery
r = cfreturn
d = cfdump
a = cfabort
p = cfparam
getset = getter and setter functions
todo = a todo comment

Provide feedback in the comments!

Too old to comment!
On Feb 23, 2006 at 1:00 AM Mark Drew (mark.drew who really likes gmail.com) said:
DAMN you! I was going to rock the world with that revelation, especially since I did some of the work on it (well.. spike did most of it.. I bugged him to make some nice dialogs with variables that you can choose)
e.g. $${fieldname:value1|value2|value3}


On Feb 23, 2006 at 1:00 AM Michael Brennan-White (mbrennanwhite who can't believe it's not gmail.com) said:
Nate,

I was one of the virtual attendees last night and missed how to use the shortcut key combination to insert a snippet and where to set the location of that shortcut key.

In the zip file (thanks by the way) I don't see any place where q is placed as a shortcut key.

Also when you make your new recording I would appreciate any information you have about File Synchronization (the only thing I miss from DW).

On Feb 23, 2006 at 1:00 AM Nathan Strutz (http://www.dopefly.com/) said:
Michael,
The shortcut keys are tracked in the keyCombos.properties file. You should see it in my zip file. It's a plain text file, you can open it and mess with it all you like. You can copy and paste lines from one to the other to combine your shortcuts.

To do it from the GUI (which I'm assuming you missed?), the option to assign shortcut keys is in the Snip Tree view, right-click to edit a snippet and you will see the "Trigger text".

Then to invoke it, again, it's CTRL+SHIFT+PERIOD directly after you type the trigger text onto the page.

Remember, it only works when you are in a CFEclipse editor, as in, when you're editing a .cfm or .cfc file, or if you have CFEclipse handle your HTML files, etc.

Oh, and I sent you an email about FTP synchronizing. Short answer: FTP and WebDAV Support plugin from the Eclipse download page.

On Mar 20, 2006 at 1:00 AM John (www.johnwilker.com) said:
I copied the files into snippets and don't see them. I miss a step?

On Apr 9, 2006 at 1:00 AM webber (none who can't believe it's not here.com) said:
I copied the files into "snippets" and don't see them either.

How do I get the snippets to appear in the snip tree view ?

On Apr 13, 2006 at 1:00 AM Aaron West (http://www.trajiklyhip.com/blog/) said:
Nathan, good stuff. Thanks for sharing these snippets - I'm definitely going to incorporate some of the things you do to automate various text in a given snippet.

On Nov 12, 2006 at 1:00 AM netposer (www.eastcoastsurf.com) said:
To see the snippets you have to make sure you copied them to the same workspace you specified when eclipse prompted you at startup.

I had an earlier version of eclipse/cfeclipse and kept the default path inside my "Documents and Settings/username" path so, of course my new install of cfeclipse wasn't looking there anymore, it was looking in the workspace path I defined with this new eclipse install.

So just make sure you copied them to the correct workspace directory.

On Dec 5, 2006 at 1:00 AM Phillip Senn (psenn, who breathes alexlee.com) said:
I found mine in
C:\Documents and Settings\psenn\workspace\.metadata\.plugins\org.cfeclipse.cfml\snippets

What's this talk about Control Shift Period? Is there a way to insert a snippet using a keyboard shortcut?

On Dec 5, 2006 at 1:00 AM Nathan Strutz (http://www.dopefly.com/) said:
Looks like the default keyboard shortcut now is ctrl + J.

On Dec 27, 2006 at 1:00 AM Eric (sorry whose email lies with charlie.com) said:
Ctrl + J? Not sure where you're getting that.

Anyway, so it looks like there's no way to have snippets work with pre-existing code. For example, I'd like to create a custom comment tag and wrap it around some code. Of course, as soon as I type the trigger text, it wipes out whatever was highlighted.

They should flip-flop the order so that ctrl+shift+dot is the first thing you type, and then you type the trigger text. Hmm...

On May 22, 2007 at 1:00 AM tim yager (http://www.timyager.com) said:
ctrl+j works for me.

On Aug 27, 2012 at 1:00 AM Armando (armando.musto who loves gmail.com) said:
I understand the confusion, I am interested in the same.

I would like to be able to highlight code and then using a shortcut key, wrap a tag around it.
I don't want anything to do with Trigger text, just need a quick Shortcut key.

Think of the example where you highlite a word then hit CTL + # to place pound signs around it.
Too old to comment!