Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

This seems like a new bug (feature ?) that’s creep into Ubuntu 13.10. When I execute vi on a directory it doesn't list the files which I can navigate to with the arrow keys; it just shows an empty screen with the message 'Illegal filename'.

Now it's an hassle because I have to ls the directory first if I don't know which file I want to edit and then I've got to type the entire file name after the directory in the command argument.

This happens when I go to vi the tmp, etc, and even in my home directory which I have write permission for.

share|improve this question

The behaviour you are describing is caused by a bug in netrw, which is the plugin handling the file browsing.

Updating to the latest version of the plugin fixes this behaviour.

To do so, just download the latest version of netrw, open it in vim and source it. Doing so will extract the plugin into your ~/.vim directory, where it will be loaded before the system's buggy version.

Download the file:


Open it in vim:

vim netrw.vba.gz

In vim, source it:

:so %

Afterwards, close vim. Then, enjoy browsing directories again.

Update: On one box, this gave me an error about not being able to close the last window. Had no effect on the plugin, which worked flawlessly afterwards.

2nd Update: This version of netrw expects a version of vim with the clipboard capability.

You can check if your version has it by running vim --version. The output will probably have -clipboard in there, which means the capability is not enabled.

To get a version compiled with clipboard support, install any version of vim with a GUI, which will also replace your normal vim with a version with clipboard support. I used vim-gtk as a test case.

share|improve this answer
drc, I'm getting numerous errors in red with the message Not an editor command – P Magunia Nov 26 '13 at 15:05
Sorry, linked the wrong file after testing it with the correct one. Fixed links in my answer. – drc Nov 26 '13 at 19:54
Yes, I got that error too about close last window but it works now. Thanks ! – P Magunia Nov 26 '13 at 20:23
Now I just got this error: Error detected while processing function <SNR>19_NetrwBrowseChgDir..<SNR>19_NetrwOptionRestore: Invalid register name '*' I can vi the directory but when I select the file and press enter I got the aforementioned error. – P Magunia Nov 26 '13 at 21:09
Seems like this version of netrw expects clipboard capability in vim. Added a paragraph about dealing with that. – drc Nov 27 '13 at 7:34

I tried following the steps given by drc, but got strange errors (perhaps due to lack of clipboard support).

The following worked for me in ubuntu 13.10 docker image, with just a standard version of Vim without clipboard support:

vim /etc   # blank screen

wget -O netrw.vba.gz

# install the vimball
# may throw error E444, but this can seemingly can be ignored
vim netrw.vba.gz +"so %" +q  

vim /etc  # works fine

Note that the only thing that I did differently than drc involved me using a slightly older release of the netrw plugin, namely the one uploaded to on 2014-02-04.

share|improve this answer
This method causes error messages to appear. – P Magunia Jul 25 '14 at 1:19
Hmmm. This fixed the strange errors, and executed without errors. However I'm still unable to get a directory listing. – hek2mgl Aug 2 '14 at 11:54
hek2mgl, just checked inside this Vagrant VM and my fix seems to work well. – Dergachev Aug 4 '14 at 19:57
OK on second thought, the version of netrw I linked to seemed to cause new errors in Vagrant. This version of netrw.vba.gz linked here seems to work fine: – Dergachev Aug 5 '14 at 20:27

To use vi on a file, type in vi <file name>, or vi -r <file name> to recover a file that you were editing in case of a system crash.

If the file exists, then the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.

share|improve this answer
Mitch, I'm already aware of vi syntax. The problem seems to be with netrw. – P Magunia Dec 3 '13 at 4:10

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.