TIL: Open URL in VIM


Move cursor on the URL and type gx to open the URL in browser.

The gx actually calls open or OS equivalent command for given resource (it can be URL, image, other type of file). Then open command decides what to do with the object, e.g. if it is URL - open it in a browser.

I often use VIM to format text, e.g. generate multiple URLs and wanted to open all of them in a browser. This can be done via macro e.g. qegxj will record macro e to run gx and go one line bellow. Then simply executing macro for each line opens all urls e.g.: 100@e.