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.

sylph
  • 125
  • 2
  • 9
  • 1
    Are you sure you're using vim? And not just plain old vi? What version? – Robby Cornelissen Sep 17 '19 at 09: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)` – sylph Sep 17 '19 at 09:41
  • Huh. On what OS? `:e .` works fine for me on Ubuntu 18.04 – Robby Cornelissen Sep 17 '19 at 09:44
  • MX Linux 18 all up to date. I should say this is happening on windows with gVim too. – sylph Sep 17 '19 at 09: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. – sylph Sep 17 '19 at 09:53
  • I think there probably is a minimal vim or a tiny vim that got installed. One that doesn't include the `netrw` plugin required for file browsing. – Robby Cornelissen Sep 17 '19 at 09:55
  • @sylph Since you've found your solution, you could as well write it as an answer to your question :) – Zaffy Sep 17 '19 at 10:13

1 Answers1

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.

sylph
  • 125
  • 2
  • 9
  • 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. – oneastok Sep 17 '19 at 15:29
  • `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. – Tacahiroy Sep 18 '19 at 15:21