19 June, 2011

Connect gedit to Firebug

Did you ever jump back and forth between Firebug and gedit or other text editors, searching for the line you were just debugging/editing? 
Stop doing this manually! Firebug provides you with an "external editors" feature and allows you to jump to the right line in your code in the editor.

Here are some screenshots to show you how it looks like. First, I right click a line (e.g., line 7) in Firebug and select "gedit". Firebug/Firefox then calls "gedit myfile.js +7" making gedit get focus and jump to line 7.

Setting up gedit or other tools as external editors is really easy. I wonder why I did not try this earlier. Open Firebug and the Firebug option menu. Select "Open with Editor > Configure Editors".
Now click "Add", give the editor a name, select an executable and edit the command line arguments. Firebug can forward the current %url, the local path to the %file, and the %line number via the command line.
In my case, man gedit revealed that both file and line can be forwarded to gedit with the simple pattern gedit filename +linenumber, and therefore, gedit's arguments string in Firebug would be %file +%line.

That's it, I hope you could learn something new.


Schalk Neethling said...

This is the string for Notepad++ : -n%line %file - Thanks for the tip

Anonymous said...

For Netbeans:

netbeans %file:%line