wyc
wyc

Reputation: 55343

Is there any way of easily refreshing a website coded in G(Vim)?

I realized that I waste 10% of my time changing windows between Vim and Firefox.

Alt + Tab + F5 (and sometimes a get the wrong window).

Is there a way of making this task easier?

I thought of the following:

Any suggestions?

Upvotes: 1

Views: 198

Answers (3)

Jeromy Anglim
Jeromy Anglim

Reputation: 34957

If you are on Windows, AutoHotKey is a good free option.

You could assign a key combination to activate the Firefox browser, send the F5 key to Firefox, and then return focus to Vim.

Benefits of AutoHotKey:

  • You could have logic that checks whether the Firefox is open, and if it is not open, open it.
  • You could use the AutoHotKey Window Spy tool to actually activate Firefox. Alt+Tab will fail if you've activated another window in between Vim and Firefox.

See for example:

Upvotes: 0

michaelmichael
michaelmichael

Reputation: 14135

Here's a Vim shortcut to open the current file in Firefox. It should work on Ubuntu, though I'm not in front of my Linux machine to test. You can add it to your ~/.vimrc

map <Leader>p :!firefox %<CR><CR> " Preview the current html file in Firefox

If you're looking for varations on that same theme, there are quite a few similar tips on the Vim wiki. Check the duplicate links tip at the top and the "See Also" links at the bottom.

Upvotes: 2

Arnis Lapsa
Arnis Lapsa

Reputation: 47677

Technically, I guess this ain't proper answer, but You might benefit from these tools.

For Chrome - try LiveReload.
For Firefox - try XRefresh.

Upvotes: 6

Related Questions