LinkedIn Facebook Twitter


Custom Snippets in Aptana 3

December 1st, 2010 | Cool Stuff , General , IDE

Aptana Snippets

There are some very useful snippets in Aptana like auto building Html tags (Type "div" and hit "Tab" then Aptana will generate "<div id="name"></div>" for you) but most amazing thing is its very easy to create your own snippets.

If you are using "console.log()" function a lot like me then writing a snippet for this function will save a lot of time for you.

To add a "console.log()" shortcut key

  1. Create a new project and go to project folder (where your ".project" is found)
  2. Download bundles.zip
  3. Extract the zip content to the root of your project folder. The folder hierarchy :
  4. And restart Aptana 3.
  5. Now open an Html file, select a text and hit "Shift+Command+."
require 'ruble'

with_defaults :scope => 'text.html,source.js,source.php source.php.embedded.block.html', :input => :none, :output => :insert_as_snippet do |bundle|
	command 'console.log()' do |cmd|
		cmd.key_binding = 'M1+M2+.'
		cmd.input = :selection
		cmd.invoke do |context|
		  selection = ENV['TM_SELECTED_TEXT'] || ''
		  if selection.length > 0

Visit https://aptanastudio.tenderapp.com/faqs/your-aptana-studio-installation/adding-a-new-snippet and https://aptanastudio.tenderapp.com/faqs/scripting-aptana-studio/ruble-programming-guide for more

Additional Note:

You can also create your own .rb files and save them to "/Applications/Aptana Studio 3/configuration/org.eclipse.osgi/bundles/67/1/.cp/bundles/html.ruble/snippets".

Like goksel.rb

Responses to "Custom Snippets in Aptana 3"

  1. Wesam Alalem says:

    Thank you. I migrating from Komodo IDE to Aptana and was missing this 😉

Leave a Reply