Open URL under cursor in Vim with browser

后端 未结 11 881
一整个雨季
一整个雨季 2021-01-29 20:05

I\'m using Twitvim for the first time. Seeing all the URLs in there made me wonder, is there any way to open the URL under the cursor in your favorite browser or a specified one

11条回答
  •  -上瘾入骨i
    2021-01-29 21:01

    Add following line to .vimrc file:

    nmap  yiW:!xdg-open " &
    

    So in normal mode it pressing \ it selects current word and open it as address in web browser.

    Leader by default is \ (but I've mapped it to , with let mapleader = ","). Similarly, using imap you can map some key sequence in insert mode (but then, if it is 2 key sequence, it probably will override some default behaviour).

提交回复
热议问题