Dienstag, 5. April 2011

JEdit macro to easily comment/ uncomment code blocks

It seems I'm in the mood of writing macros for jedit today. So I just wrote a macro to easily comment/ uncomment a selected code block. You can download the macro here.

How to install
  1. Download the file.
  2. Copy it to your .jedit/macros folder. You can also create a subfolder "Ruby" and place it there.
  3. Open jedit and select Macros / Rescan Macros.
  4. You should see a macro called "Block Comment" now.
How to use
  1. Write your ruby code in jedit as you normally do.
  2. Select a code block and execute the macro.
  3. The code block is now commented out.
  4. Select the same code block again and execute the macro.
  5. The code block is now uncommented again.
I hope you find this macro as useful as I do and enjoy using it.

PS: For better usability I recommend to make a shortcut for the macro (ex. CTRL-k).

JEdit macro to beautify/ align text tables (ex. as used in cucumber scenarios)

For quite some time now I'm using cucumber for behavior driven ruby on rails development (BDD). And I use the nice text tables in my scenarios cucumber offers. Too bad I couldn't find a macro/ plugin which allows me to easily align the table cells so they look nice and well formated.

This this is how I write my tables:

  |Corin|Langosch|info@netskin.com|
  |Hans|Müller|test@email.com|

This is how they should look like:
  | Corin | Langosch | info@netskin.com |
  | Hans  | Müller   | test@email.com   |

After having a short look on how to write macros for jedit I turned out the be real easy, due to the use of beanshell. So here it is: my jedit macro to beautify text tables

How to install
  1. Download the file.
  2. Copy it to your .jedit/macros folder. You can also create a subfolder "Text" and place it there.
  3. Open jedit and select Macros / Rescan Macros.
  4. You should see a macro called "Beautify Table" now.
How to use
  1. Write your text table in jedit as you normally do.
  2. Select the whole table.
  3. Select Macros / Beautify Table.
  4. The table should now be pretty :)
I hope you find this macro as useful as I do and enjoy using it.

PS: For better usability I recommend to make a shortcut for the macro (ex. CTRL-TAB).