Opening, Saving and Deleting Files in Vim

03/13/20191 Min Read — In DevTools, Vim

If you want to open a new file in the same directory as the current file:

:e %:p:h/name-of-new-file.md

:e for edit (opens a file)
%:p:h for the current directory and the head of the file name

If you want to save the current file under a new filename ("Save as") in the same directory:

:sav %:p:h/name-of-new-file.md

If you want to delete a file, you can use !rm. But that means that you have to know the exact path and file name.

Perhaps it's easier to use a netrw or NerdTree.

Open netrw with :Explore or one of the other commands like :Texplore (opens up in a new tab)):
Navigate to the file you would like to delete and type D.
Type % to create a new file.