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:
- Embending vim to firefox (I think it is impossible).
- Making a Vim shortcut which sends me to Firefox's window.
Any suggestions?
Technically, I guess this ain't proper answer, but You might benefit from these tools.
For Chrome - try LiveReload.
For Firefox - try XRefresh.
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.
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:
- http://www.autohotkey.com/docs/commands/WinActivate.htm
- http://www.autohotkey.com/docs/Tutorial.htm
精彩评论