Question

Is there a way to customize Firebug's keyboard shortcuts? I love being able to step through JavaScript code using Firebug's Script panel, but it looks like I'm limited to either using the default keyboard shortcuts for stepping over/into/out of code or using the mouse to click the appropriate button.

Am I missing something?

Is there some secret about:config hack in Firefox/Firebug that would help me?

Was it helpful?

Solution

You can change them manually. Go to this directory:

In recent versions the extension comes in a single file with the extension XPI. Just rename it to ZIP, create a directory and extract its contents into it.

Linux:

.mozilla/firefox/*****.default/extensions/firebug@software.joehewitt.com/ 

Windows:

%APPDATA%\Mozilla\Firefox\Profiles\<profile>\extensions\firebug@software.joehewitt.com\

Then modify this file (these are my remapping settings):

content/firebug/debugger/script/scriptPanel.js (Firebug 2.0)

    this.keyListeners =
    [
        chrome.keyCodeListen("F5", Events.isShift, Obj.bind(this.rerun, this, context), true),
        chrome.keyCodeListen("F5", null, Obj.bind(this.resume, this, context), true),
        chrome.keyCodeListen("F6", null, Obj.bind(this.stepOver, this, context), true),
        chrome.keyCodeListen("F7", null, Obj.bind(this.stepInto, this, context)),
        chrome.keyCodeListen("F8", null, Obj.bind(this.stepOut, this, context))
    ];

content/firebug/js/scriptPanel.js (before Firebug 2.0)

    this.keyListeners =
    [
        chrome.keyCodeListen("F5", null, Obj.bind(this.resume, this, context), true),
        chrome.keyListen("/", Events.isControl, Obj.bind(this.resume, this, context)),
        chrome.keyCodeListen("F6", null, Obj.bind(this.stepOver, this, context), true),
        chrome.keyListen("'", Events.isControl, Obj.bind(this.stepOver, this, context)),
        chrome.keyCodeListen("F7", null, Obj.bind(this.stepInto, this, context)),
        chrome.keyListen(";", Events.isControl, Obj.bind(this.stepInto, this, context)),
        chrome.keyCodeListen("F8", null, Obj.bind(this.stepOut, this, context)),
        chrome.keyListen(",", Events.isControlShift, Obj.bind(this.stepOut, this, context))
    ];

In versions before 2.0 you should also change the localization file, so the tooltips should the correct keys:

locale/en-US/firebug.properties

firebug.Continue=Continue (F5)
firebug.StepOver=Step Over (F6)
firebug.StepInto=Step Into (F7)
firebug.StepOut=Step Out (F8)

And that is all. Unfortunately, you have to do it every time you update Firebug. Though there is already a request to allow their customization directly within Firebug.

OTHER TIPS

As stated in their discussion forum, you can try keyconfig... otherwise, it is a known bug/limitation.

As @VonC mentioned, there is an open ticket on this. In my experience, keyconfig doesn't work for this purpose. I did write a patch that allows for the debugger execution control keys to be customized in about:config. I have also posted an XPI with this fix if you don't want to wait for it to be accepted upstream, and/or you don't want to build it yourself.

Another option would be to configure the shortcuts manually in file

%APPDATA%\Mozilla\Firefox\Profiles\<profile>\extensions\firebug@software.joehewitt.com\content\firebug\browserOverlay.xul

For example, I removed the shortcut on F12 by commenting the corresponding section because it conflicts with the Undo Closed Tab shortcut of Tab Mix Plus.

Disadvantage: An update of Firebug will overwrite the modified configuration.

While it is possible to change the shortcuts within Firebug's source code, there is also a way to add different keys for those actions without touching the source.

To do so you have to install an extension, which allows you to define custom shortcuts like Dorando keyconfig.

Steps to do for that extension:

  1. Go to the Add-ons Manager.
  2. Click the Options button besides the extension to open the customization dialog.
  3. Click the Add a new key button to open the key editor.
  4. Give the shortcut a proper name
  5. Paste the code related to the action* into the code field.
  6. Click OK
  7. Click into the shortcut field
  8. Add a custom shortcut by pressing the keys on the keyboard
  9. Click the Apply button

Screenshots for clarification:

Dorando keyconfig key customization dialog Dorando keyconfig key editor

* That is the value of the oncommand attribute. So, if you want to add a shortcut for resuming the JavaScript execution, you need to copy Firebug.Debugger.resume(Firebug.currentContext) from the cmd_firebug_resumeExecution command.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top