4

When I press gx over a link in vim, it opens it in an external application, when it does this it also suspends Vim.

How do I prevent it from suspending Vim, so that I can use Vim while browsing whatever it opened externally.

  • 1
    Can you specify your OS, Vim version? It does not suspend here (OSX, MacVim 8.0) – nobe4 Jul 17 '17 at 16:13
  • Using GVim on Windows, I do not have this problem. However, at the bottom, vim says, "Press <cr> to continue," which is just Enter. Using terminal vim in MinGW (I know, all bets are off), it doesn't open a web page, but still doesn't freeze. – jpaugh Jul 17 '17 at 19:58
  • Debian Jessie 8.4.0, Vim 7.4. Hm... mine seems to be a bit iffy, if it opens it will suspend vim, if it doesn't it will not suspend. – Electronic Mail Jul 20 '17 at 2:48
  • Vim 8 with Fedora 25 here, works by default without suspending. – Neaţu Ovidiu Gabriel Oct 16 '17 at 9:26
1

Use vim-shell plugin instead with this config:

let g:netrw_nogx = 1 " disable netrw's gx mapping.
nnoremap gx :Open<CR>
  • 1
    Another alternative might be my xdg_open.vim plugin. – Martin Tournoij Aug 16 '17 at 21:54
  • This doesn't work for me, :Open is still blocking vim. I use NVIM v0.2.2 on lubuntu 17.10 – chrimuelle Jun 21 '18 at 20:31
1

What works for me with neovim v0.2.2 on lubuntu 17.10 is the open-browser.vim plugin (https://github.com/tyru/open-browser.vim) with the following settings in my init.vim.

let g:netrw_nogx = 1 " disable netrw's gx mapping.
    nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)

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.