Last Updated: February 25, 2016
·
317
· squioc

How to open an uri in vim

Perhaps, like me, you save uris in text file, to open them later, and, like me, copy and paste the uri from the text file to the browser bores you. As a lazy developper, here is a vim command to open, in the browser, this uris:

:exec "!xdg-open ".getline('.')<CR>

To avoid to input the command, you can map it:

For Windows:

map <leader>o <Esc>:exec "!start explorer ".getline('.')<CR><CR>

For Mac Os X:

map <leader>o <Esc>:exec "!open ".getline('.')<CR><CR>

For Linux:

map <leader>o <Esc>:exec "!xdg-open ".getline('.')<CR><CR>