My issue happens with the key combination gx in normal mode.

The problems happens in Vim, (I have also tried in NeoVim and it correctly opens the link in firefox directly).

I have a test file /tmp/go-to-stackoverflow.markdown which contains the url http://www.stackoverflow.com

When I hit gx while the cursor is on the link:

  • it opens a new buffer window at the bottom which contains only one line with the link written in it
  • it displays during a few milliseconds (I had to redo it several times to get each words) the message netrw --No Line In Buffer--

Any idea what might be wrong in my configuration, how to fix the issue?

I use vim 8.1 on NixOs 19.09.


As pointed in the comments, it is a current bug that is still open. There is a workaround:

Add in the vimrc configuration file:

nnoremap gx :!xdg-open <cWORD> &<CR><CR>

(The original github discussion was referencing to this one below, but comments made it possible an improved version.)

nmap gx yiW:!xdg-open <cWORD><CR> <C-r>" & <CR><CR>
  • 1
    Im shocked if this mapping works: I would it expect it to yank the WORD, then run xdg-open <cWORD>, then in normal mode type ` <C-r>" & <CR><CR>, and with nmap, those spaces could trigger leader mappings for me. The last half of it makes absolutely no sense. I would have written nnoremap gx :!xdg-open <cWORD> &<CR><CR>`
    – D. Ben Knoble
    Jan 11 '20 at 15:13
  • I'm currently using it successfuly though and my leader key is space too. I'm gonna test your solution. I'll update the answer accordinly. Jan 11 '20 at 15:44
  • Any explanation why you removed the <C-r>" and the yiW ? Jan 11 '20 at 15:50
  • it doesnt seem to be doing anything that I can see
    – D. Ben Knoble
    Jan 11 '20 at 16:13
  • @D.BenKnoble I have edited the answer with your solution. Jan 11 '20 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.