To save your changes to a file type
:w and hit
enter. The w stands for write.
To quit out of a file, type
If you’ve made changes without saving then Vim will give you the error: “No write since last change.”
If you want to ignore your changes and not write the file type
:q! to get
out of the file.
If you want to save your changes and quit, type
:q. This can be
:e <file> will open the file in your current window.
:sp <file>, will open the file in a horizontal split.
:vs <file>, will open the file in a vertical split.
You can open as many splits as you want.
To switch from one split to another type
Ctrl-w <direction>. Direction
To move the arrangement of a split, type
Tabs are visible across the top of the screen.
:tabe <file> will open a file in a new tab.
gt will take you to the next tab.
gT will take you to the previous tab.
:e <path/to/directory> will open a directory
:e . will open the current directory
While in the directory view use
k to move up and down file names, and
enter to open the file or directory under the cursor.
Vim has trouble doing this by itself. It has a
:saveas command, but this
won’t remove the previously named file.
Tim Pope wrote plugin called Eunuch which will handle renaming with the
:Rename command. I will cover plugins in a later chapter.