macvim icon indicating copy to clipboard operation
macvim copied to clipboard

Macvim opens curl?

Open 9mm opened this issue 6 years ago • 10 comments

Describe the bug gx opens curl result in browser rather than opening link in browser

To Reproduce Detailed steps to reproduce the behavior:

  1. Run macvim
  2. Push gx

Expected behavior It should open browser

Environment (please complete the following information): Latest OSX

mvim --version VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 21 2019 22:54:00) macOS version Included patches: 1-1722 Compiled by Homebrew

9mm avatar Jul 26 '19 17:07 9mm

Reproduced on latest build. Need to take a look.

ychin avatar Jul 27 '19 08:07 ychin

I believe 85850f3a5ef9f5a9d22e908ef263de8faa265a95 broke this by introducing a new netrw build. This is really a Vim / netrw build and should be filed there. I can leave this issue open until it's fixed upstream and merged in.

ychin avatar Jul 27 '19 08:07 ychin

I have filed this bug at https://github.com/vim/vim/issues/4738.

ychin avatar Jul 27 '19 08:07 ychin

I have tested the most recent update https://github.com/vim/vim/commit/589edb340454e7f1b19358f129287a636d53d0e1 to $VIMRUNTIME files which contains a fix for this and it resolved it for me.

Unfortunately, this fix is not contained in the newest version distributed on http://drchip.org/astronaut/vim/index.html#NETRW as of today (26.9.2019).

I do not modify files in $VIMRUNTIME and therefore installed, nevertheless, a new netrw version from drchip.org. I applied the diff to plugin/netrw.vim myself. Since $VIMRUNTIME/plugin/ is loaded before .vim/pack/drchip/start/netrw/plugin, I had to add to my vimrc

source ~/.vim/pack/drchip/start/netrw/plugin/netrwPlugin.vim

Since this is not very convenient, I would appreciate an update to macvim.


If someone else encounters this later on, check if your vim patch level is 8.1.2060 or higher with :version. Updates to runtime files do not increase the patch level. However, the patch 8.1.2060 contains the previous commit with the updates to the runtime files.

kiryph avatar Sep 26 '19 07:09 kiryph

@kiryph thank you for your issue.

There's an open issue in upstream. Please, follow up there. Commits you mentioned are not really fixing the issue, and some people are against this fix.

eirnym avatar Sep 26 '19 18:09 eirnym

@eirnym thanks for your reply.

I have read the response from Charles Campbell (author of netrw) and it seems that there is an intended change of behviour of netrw: pressing gx no longer opens a web browser for urls but downloads the html file into vim. So much to that this is actually a regression which needs a fix.

However, I am interested in the previous behavior as the OP and many other who opened issues on the various trackers and consider this actually as an regression. Also the proposed 'fix' has been merged into upstream of vim (and also neovim). From my point of view macvim just tracks upstream and therefore could simply pull in the recent commits of vim.

In a future netrw version, Charles Campbell plans to provide a setting to allow to use a browser for http(s):// instead of downloading the html with curl.

What is your plan? Waiting until a new netrw release and keep the curl behavior or pulling in the current updates in vim upstream into macvim which would restore the old behavior.

kiryph avatar Sep 27 '19 06:09 kiryph

@kiryph thank for your reply.

Please, follow and reply to that thread if you're interested to keep previous behavior. MacVim is only a GUI implementation for ViM.

eirnym avatar Sep 27 '19 13:09 eirnym

This was fixed for a few months and now it's broken again recently, except now its viewing the source code of the request in the browser....

How do I make it where gx just opens the URL under the cursor in the browser?

9mm avatar Mar 26 '20 20:03 9mm

Probably it was broken in upstream again. Netrw plugin is responsible for opening files, directories and urls

eirnym avatar Mar 27 '20 07:03 eirnym

Yeah it was broken again since November when netrw was updated. Because I didn't release a new version of MacVim for a while it's only surfacing now. I poked on that issue again, although I'm not sure how far it would go.

ychin avatar Apr 11 '20 07:04 ychin

This should be fixed in upstream.

ychin avatar Sep 15 '22 13:09 ychin