I know one can use vim scp://host/path/to/file to edit locally remote files then update the remote machine when saving (:w). However I would like to know if it's possible to navigate through directories using ssh (or if there's a plugin to do that)

NERDTree doesn't support it, and when viming into a folder, although netrw allow me to navigate into directories, opening a file doesn't work.

3 Answers 3


Instead of pointing Vim/Netrw to a file:


point it to a directory:


This gives you the same listing and the same shortcuts as if you were browsing your machine.

  • have you tried this when remoting from your Unix machine to access folders on a Windows machine.. I just tried vim scp://[email protected]//C:/Users/user/Desktop/tmp/, and it just gave me a blank screen, with the error 'ls' is not recognized as an internal or external command when I try: vim scp://[email protected]//C:/Users/user/Desktop/tmp/filename.. it works fine.
    – alpha_989
    Commented Jul 18, 2018 at 18:41
  • From this it seems that vim is issuing a command ls, when it logs into the remote computer.. and because its a windows computer.. there is no ls.. and the command fails. Is it possible for vim to traverse windows directories over ssh using netrw plugin or something else ? I using VIM 8.1
    – alpha_989
    Commented Jul 18, 2018 at 18:46
  • 2
    Please note that the trailing slash after scp://host//path/ is necessary for this to work; otherwise, vim will try to open the path as a regular file, which will load blank.
    – koyae
    Commented Jul 4, 2019 at 18:45

Oops forgot I had this question opened !

So the problem was that, with the netrw version I had (packaged with vim-gnome on Debian Jessie), modifying a file from the explorer (through ssh) would not use the correct URI (from memory, the '@' in the 'user@host' was missing). It opened an empty file (because it didn't find anything) but it still saved the new file using the good URI (effectively overwriting the original file).

@user21497's answer also helped me though because I never found that 'new file' shortcut, which is quite handy because using ':e' creates the file locally.

Finally, this question helped me navigate better using netrw (getting back to the explorer after opening a file using :Ex)

Thanks for your help guys !


I'm not sure what you mean by "notify new file"; if you want to create a new file, when browsing via scp://hostname/directory, just press "%" like you would when in a local directory to create a new file. See :help netrw-%. You may create a directory using d (:help netrw-d). If you want to modify an already existing file, select it with your cursor atop the filename in the netrw display and press <cr> (there are other selection methods, too, including v, o, t, etc). See :help netrw-quickmap for an overview on this. I've just tried this and did not get an empty file (when pre-existing). A new file, of course, will be empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.