2

I am trying to learn how to use Vim. Apparently I have failed at the first hurdle since Vim (certainly on my computers) cannot open files from within itself. I know this must somehow be a mistake on my part since how can Vim still be around with such a flaw??

Anyway I have searched for the last day or so with no solution.

I have tried:

:e .

And Vim helpfully tells me that: "." is a directory. I was under the impression that this command would open a file browser in current directory, but it doesn't.

Similarly I have attempted other commands:

:Ex
:Explore
:Sexplore
:Sex
:Vexplore
:Vex
:Hexplore
:Hex

I have tested these from How do you open a file from within Vim? but nothing suggested there works.

All of these produce: E492: Not an editor command: <insert any of the above commands here>.

I am left with the conclusion Vim can't open files unless Vim is called from the terminal and the file is passed as an argument or the files happen to be in the current directory (where ever that may be) and you know the file's name.

Can someone help? I would like to be able to open files in other directories and list them but for the life of me nothing is working despite every guide I have read saying it would.

Thanks.

7
  • 1
    Are you sure you're using vim? And not just plain old vi? What version? Commented Sep 17, 2019 at 9:36
  • Hello Robby. Pretty sure I'm using Vim this is the version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 21 2019 04:10:35) Commented Sep 17, 2019 at 9:41
  • Huh. On what OS? :e . works fine for me on Ubuntu 18.04 Commented Sep 17, 2019 at 9:44
  • MX Linux 18 all up to date. I should say this is happening on windows with gVim too. Commented Sep 17, 2019 at 9:46
  • Having taken what you said Robby about vi I checked the MX's package manager and found that vim-common was installed but weirdly not vim. Once I'd installed vim :e . now works and I can now navigate the filesystem. I have no idea the difference between vim-common and vim or the reason for the separate packages; I assumed they would be the same. Commented Sep 17, 2019 at 9:53

1 Answer 1

4

At the request from Zaffy this question has been solved.

At Robby Cornelissen's prompting I checked the MX's Linux's package manager and found that vim-common was installed but weirdly not vim. Once I'd installed vim :e . worked and I can now navigate the filesystem.

I have no idea the difference between vim-common and vim or the reason for the separate packages; Robby Cornelissen suggests that vim-common is probably a minimal or tiny version of vim.

Sign up to request clarification or add additional context in comments.

2 Comments

Besides edit, there is another useful command for opening files in vim — it’s find. Also, it’s convenient to set the current directory properly in order not to travel to your project files through the entire tree starting from the home point — the cd command is the user’s friend too. And don’t forget about wildmenu — it’s a command line completion tool.
vim-common package doesn't contain Vim itself, but it contains man pages, icons and default vimrc files. Actually, directory browsing feature is provided by Netrw plugin which is contained in vim-runtime package in Debian eco system.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.