I am opening a remote file with this command:

[n]vim scp://user@host/relative_file

Vim (8.2) opens the file correctly, but Neovim (v0.5.0-dev+1186-g8665a96b9) just shows a blank file and a blank NetrwMessage buffer. When I try to open it again with :e in Neovim, an error is printed:

Error detected while processing function netrw#Nread[4]..netrw#NetRead:
line  261:
E121: Undefined variable: b:netrw_method
E116: Invalid arguments for function s:NetrwGetFile
E15: Invalid expression: s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)

Seems the problem of b:netrw_method but I can't find useful information about it on the Internet. How to solve this error?

Extra Info

If I use :w to write, the remote file is successfully overwritten by an empty file.

I am on a Windows machine.

  • 1
    FWIW, that line of code should only execute if b:netrw_method is already defined and set to 4 (autoload/netrw.vim:2241).
    – D. Ben Knoble
    Jul 10 at 19:56
  • 1
    I would try updating netrw to the latest version: drchip.org/astronaut/vim/index.html Jul 12 at 9:24
  • Unfortunately, both upgrading Neovim (to v0.6.0-dev) and netrw are not helpful. And same result on WSL (nvim 0.5.0-dev) Jul 13 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.