Skip to content

Instantly share code, notes, and snippets.

@vjo
Last active July 20, 2017 19:34
Show Gist options
  • Select an option

  • Save vjo/b7eda7c2130092b5d488 to your computer and use it in GitHub Desktop.

Select an option

Save vjo/b7eda7c2130092b5d488 to your computer and use it in GitHub Desktop.
Reload Firefox current page from Vim
While developing website / webapp it's great to force your browser to reload when modifiying code.
You have plenty of solutions like LiveReload.
I wanted to be able to reload Firefox from vim and this is a simple way to achieve that:
* Install MozRepl (https://github.com/bard/mozrepl/wiki)
* Firefox > Tools > MozRepl > Start
* Be sure you have netcat 'nc' installed
* Add these line in your .vimrc:
" Enable reloading of Firefox using MozRepl
map ,r :! echo 'BrowserReload(); repl.quit();' \| nc -w 1 localhost 4242 2>&1 > /dev/null<CR><CR>
Now when hitting ",r" in vim, Firefox will reload the current page.
Derivated from: http://vim.wikia.com/wiki/Refresh_Firefox_%28preserving_scroll%29_on_Vim_save,_using_MozRepl
@reedjosh
Copy link

reedjosh commented Jul 20, 2017

Does Firefox still have a 'Tools' menu?
I can't seem to follow this part:
Firefox > Tools > MozRepl > Start
I'm unable to get any of these methods working. Is MozRepl maybe deprecated?

Thanks for any further input. : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment