Reputation: 411
When opening a file with vim instead of putting the whole path I accidentally just wrote the path to the directory. So instead of:
vi myDirectory/myFile.txt
I put
vi myDirectory
Now vim has taken this to mean that I want to edit all 3 files in this directory and is stuck in that mode. I can quit vim and return to the console, but when I try to open the file with the full path vi myDirectory/myFile.txt
I get a blank screen with "2 more files to edit" at the bottom. And then when I return to the console the line "3 files to edit" is printed.
How can I exit this situation so that I can continue to use vim normally and edit my file?
Upvotes: 0
Views: 277
Reputation: 172520
When you attempt to :edit
a directory (or pass one as a command-line argument), Vim usually shows a directory listing and lets you browse files, courtesy of the :help netrw
plugin. Vim does not automatically select all files from a passed directory.
Based on your report of having additional files also when the desired file's full path is passed, I rather suspect that you somehow have two additional "hidden" arguments to Vim, which Vim interprets as passed files.
This could be caused by a shell alias (in Bash, check type vi
). Within Vim, you can list the additional files with :args
; if they are indeed strange, non-filename strings, that might give you a clue (or at least some text to search for).
Upvotes: 4