Mastodon hachyterm.io

Today I learned two neat tricks for Vim:

Put your cursor on a link (in normal mode), and type gx.
This will open the URL in a browser window.

What if you want to open a file in a web browser?

On Linux, you can type :!xdg-open % to open the current file in the default browser.

(On a Mac, just type :!open %)

If you want to make sure that your file is saved, you can first update the file and then pipe it through xdg-open:

:up | !xdg-open %

Further Reading