I don’t know if it’s too much for a newcomer to VIM programming, but for some reason this archaic thing hooked me. I went through the vimtutor and sort of understood something about how to use the program.

But I am unsuccessfully searching for the answer to the simplest question the second day, how to open a file for editing from VIM?

  • In general, of course, it is better to use NerdTree - a very convenient plugin, almost indispensable if you need to work with a multi-file project. - Andrej Levkovitch

3 answers 3

As usual, the command + argument:

vim filename.txt 

Or in the editor itself

 :e filename.txt 
  • I probably have not reached this yet) Is the absolute path to be indicated? - Alex Stelmakh
  • Either absolute or relative to the launch directory. - bipll
  • vim ../filename.txt . vim /home/user/filename.txt . - bipll

You can even open the entire folder when starting or running vim

 vim path_to_dir :e . 

Then select the desired file

You can open directly by specifying the file in an absolute or relative path.

 vim path/to/file vim ./filename 

There is a must-have plugin - NerdTree which is convenient for its simplicity. In the English version of CO Vim / Emacs, the most popular text editors in * nix OS.

Links

     :e <filename> # Открыть файл Вкладки :tabe <filename> # Добавить вкладку с файлом gt # Cледующия вкладка gT # Предыдущая вкладка Окна :sp <filename> # Открыть файл в горизонтальном сплит-окне. Ctrl-w + n :vsp <filename> # Открыть файл в вертикальном сплит-окне Ctrl-w и W # Переключение между окнами