Skip to main content Skip to navigation

2b.3 Creating and editing files

If there is a file in the current folder that is called file.txt, then the way to edit it with vim is by typing in the shell:

vim file.txt

If you would like to create a new file that does not yet exist, you can use the same syntax:

vim new_file.txt

This will open vim with an empty document. It has not actually created the file with name new_file.txt yet. It will only do so if you 'write' to it by the key stroke <ESC>:w. Note: if you are already in NORMAL (COMMAND) mode, then :w is sufficient to write the file.