2

You can use the gx command to open a URL in vim. Is this possible when using vim within Ubuntu in WSL?

jtpereyda
  • 2,447
  • 3
  • 23
  • 29
  • @Biswapriyo Yes, no action was visible. Does it work for you on the same setup? – jtpereyda Apr 17 '18 at 06:29
  • It seems to temporarily go back to the console before returning to vim. – jtpereyda Apr 17 '18 at 06:30
  • There is a uservoice page for this feature. See this [link](https://wpdev.uservoice.com/forums/266908-command-prompt-console-windows-subsystem-for-l/suggestions/6511299-make-links-clickable). Microsoft is currently working on it. – Biswapriyo Apr 27 '18 at 20:50

1 Answers1

6

In vim, run:

let g:netrw_browsex_viewer="cmd.exe /C start" 

Based on this answer, this answer, and this quetion.

You can also put this in your .vimrc file. Since I share my vimrc file between computers, I used the following to make .vimrc_local file for this OS-specific setting:

" From: https://devel.tech/snippets/n/vIIMz8vZ/load-vim-source-files-only-if-they-exist/
function! SourceIfExists(file)
  if filereadable(expand(a:file))
    exe 'source' a:file
  endif
endfunction

call SourceIfExists("~/.vimrc_local")
jtpereyda
  • 2,447
  • 3
  • 23
  • 29
  • Oooh, guys, thx so much!! You cannot imagine how long I'm looking for a solution for this problem. I'll open a beer tonight, yaaaay! – rlegendi Feb 10 '23 at 17:28