Skip to content. | Skip to navigation

Personal tools


You are here: Home / tech / GVim and Firefox together

GVim and Firefox together

| filed under: ,

"View Page Source" in Firefox/Iceweasel is really useful but sometimes seeing the code in your usual Editor is so much better.

I was curious about the structure of a web page and, did what I do dozens of times every week, right-clicked and selected View Page Source. However, in this case the web page was horribly complex and had all of the white space removed. I needed something more than the built-in Firefox/Iceweasel source viewer. After a little configuration I was able to bring GVim to the rescue. This is how I did it.

  1. In the browser address bar enter:
  2. about:config
  3. Search for:
  4. view_source.editor.external
    and change the value to true by double clicking
  5. Now search for:
  6. view_source.editor.path
    and enter the path to your editor e.g. /usr/bin/gvim
  7. So, now when I right-click on a web page and select View Page Source I get an instance of GVim showing the code. However, I usually have GVim already running and it would be nice to have the page included as an additional tab in the existing instance. Adding arguments to the editor command inside about:config doesn't seem to work. Instead create a script with the included arguments
  8. gvim
    and create the script
    /usr/bin/gvim --remote-tab-silent $1
  9. Lastly, go back to step three and this time enter the path to the script you just created. Now when selecting View Page Source it will be loaded in a new tab if GVim is already running.


I tested this process on Firefox/Iceweasel 9.x & 10.x, with GVim 7.3 running on Debian Wheezy.

/ fitheach

2012-02-28 18:55
Filed under: ,