Saturday, March 24, 2012

Vim Plugin: Browser Reload Linux


Part of our usual development as web developers is to change constantly some code and then jump to the browser to refresh it and see our changes. This simple process can be tremendously time consuming.
One of my coworkers mentioned a sublime plugin that automatically reloads your browser from withing sublime with a simple keyboard shortcut. Fascinating, but it's mac-only compatible.
I was captured by the beauty of this tool, so i searched for any plugin with this functionality for vim and Linux. Unfortunately i didn't find any :(
Good thing is i found a vim plugin for mac. https://github.com/tell-k/vim-browsereload-mac
Luckily too, i found this neat tool xdotoolXdotool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.
Combine these two findings, and you get a Linux-compatible vim plugin. So simply, i ported the mac plugin, and used xdotool to do so. :)
Below the link to the github repo of the plugin, with installation and usage instructions.
Hope this plugin saves your time, and waiting for your feedback :)