Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a new directory and a file in Vim

Tags:

vim

When using Vim as a text editor, is there a way to create new directories and files, while in text editor mode? Instead of going back to the command line and creating a new directory and file.

like image 283
hjm Avatar asked May 16 '16 13:05

hjm


People also ask

How do you create a file in a directory in Linux?

You can either click the Terminal icon in the Apps menu, or press Ctrl + Alt + T at the same time to open the Terminal. Navigate to the directory you want to create a file in. To do so, type cd followed by the path to the directory you want to create a file in and press Enter..

How do I save a new file in Vim?

The command to save a file in Vim and quit the editor is :wq . To save the file and exit the editor simultaneously, press Esc to switch to normal mode, type :wq and hit Enter .


1 Answers

If you are in the file explorer mode, you can use:

d for creating a directory

% for creating a new file

In explorer mode you can get with issuing a command :Sexplore or :Vexplore

There is no need to call external commands with !

like image 69
Ondřej Kolín Avatar answered Sep 30 '22 14:09

Ondřej Kolín