Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

romainl's answer works however when trying to modify the file it is displayed as empty. It does not notify new file, and the vim command displayed in the status bar seems correct:


Browsing directory works perfectly well otherwise.

share|improve this answer

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 (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.

share|improve this answer
up vote 0 down vote accepted

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 !

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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