Updating the version of the netrw plugin indeed fixes the problem, as stated in this answer.
On my Vim v8.0 (installed with Homebrew), I had netrw v156 (find out with :echo g:loaded_netrwPlugin
), and the mentioned problem existed. You can find the newest version of netrw on Dr. Chip's website (currently v165b, updated on 13 March 2019). Installing this version fixed the problem for me (confirming what is stated in the other answer that the problem should have been fixed in v162j).
Here is how to install the newest version of the netrw plugin:
- Go to http://www.drchip.org/astronaut/vim/index.html#NETRW
- Click on the title, this should download a file named
netrw.vba.gz
- The
netrw.vba
file contained in the downloaded archive is a vimball file. A vimball file is something like a self-installing plugin. Note that you don't have to unzip the .gz
file, as this is done automatically in the next step.
- Install the plugin (as explained here or here or by
:help vimball
):
- Open the vimball file with Vim:
vim netrw.vba.gz
- In Vim, run:
:source %
The above command installs the components of the plugin to their proper locations in one of your Vim directories (most probably ~/.vim
).
After the installation, you can restart Vim and test if the new version of the plugin has been correctly installed:
:echo g:loaded_netrwPlugin
This should output v165b
now (or whatever version you have installed).