How to create a new file with vim

www.la‮uttu‬ri.com
How to create a new file with vim

To create a new file with Vim, you can start the editor by specifying the name of the new file as an argument. For example:

vim newfile.txt

This will open Vim and create a new, empty file named newfile.txt. You can then start typing and editing the file as you like.

Alternatively, you can also create a new file within Vim by using the :new command:

:new newfile.txt

This will open a new, empty file in a new window within Vim.

Once you have finished editing the file, you can save it by using the :w command. For example:

:w

This will save the file to the current location. If you want to save the file to a different location, you can use the :saveas command, followed by the desired file name and path. For example:

:saveas /path/to/newfile.txt

You can find more information about creating and saving files in Vim in the Vim documentation by typing :help creating within Vim.

Created Time:2017-10-28 21:39:01  Author:lautturi