6

I'm using Vim 7.4.

I have a buffer open and I type :vsplit. Vim splits the screen and I see my buffer in both windows. That's great. Just what I want.

And at this point ctrl+W W switches the focus from one window to the other, as documented.

However, if I open a Netrw browser in one of the windows like this...

:e.

Vim opens Netrw in the focussed window, then switches focus to the other window. (The one that's a file buffer, not a Netrw browser.)

And after that, ctrl+W W has zero effect. Vim won't let me move the focus to the Netrw directory listing window.

Other commands for switching the focus won't let me enter the Netrw window either, like ctrl+W J or ctrl+W ctrl+J.

I end up with this...

-----------------------------------
|  File buffer  |  Netrw listing  |
|   Has focus   |  Can't switch   |
|               |    to this      |
-----------------------------------

I tried restarting Vim like this...

vim -u NONE -U NONE -N

However, that causes Netrw to not be loaded at all so it's isn't very informative.

The only plugins I'm using are...

Vim Sensible  
Ctrl  
Airline

Any help or advice would be greatly appreciated.

  • 1
    I cannot repro this. Start with the usual debugging steps: How do I debug my vimrc file? – muru Mar 24 '16 at 20:41
  • @muru Thanks. I updated my question in reference to your advice. – Ethan Mar 24 '16 at 22:00
  • 2
    @Ethan I had a similar problem in the past, I solved it by upgrading netrw from the site of the author: drchip.org/astronaut/vim/index.html#NETRW – user9433424 Mar 25 '16 at 8:11
  • 2
    that was a bug with a specific version of netrw and has since then been solved. – Christian Brabandt Sep 21 '16 at 15:48
  • 1
    @ChristianBrabandt maybe post an answer mentioning in which version the bug was fixed? – muru Mar 20 '17 at 11:52
1

Starting vim using

vim -u NONE

won't work because you need a vimrc file with

set nocp
filetype plugin on

The two settings are needed because "netrw" is actually a plugin distributed with vim by default, but still a plugin. I would reccomend you to create an alternative vimrc to confirm that the issue is due to some settings in your vimrc. You can do something like:

echo "set nocp" > test_vimrc
echo "filetype plugin on" >> test_vimrc
vim -u test_vimrc

than try to reproduce the issue. If starting vim with the "test_vimrc" the issue disappears, than post your vimrc file so that we can try to narrow down which script is causing the issue.

0

I could not reproduce this - the focus worked fine for me - only difference I see is that I have enabled mouse focus, perhaps that could help you

I have enabled mouse focus like this

:set mouse=a

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.