VIM Crash Course
It is important to understand that in vim there are two modes:
This is mostly used for moving around in a text file, searching, selecting, copying etc. You are automatically in this mode when you open a file.
Editing Mode/Insert Mode
This is exactly how it sounds, it allows you to actually edit the file, insert text/cut/delete. To enter this mode you just press
and you will see the status of what mode you are in on the bottom right if your window. It will say:
– INSERT –
To get back out of this mode and back to visual mode just press
Saving and Exiting
Now, when you’re done working on a file you have several options:
– If you made no changes you can just type the following:
If you did make changes, it’ll say: “E37: No write since last change (add ! to override)”
With that said if you want to quit without saving even though you made changes just type:
– Now, let’s say you made changes to a file and want to exit and save changes, that is simply:
If you are editing a file and viewing it in your browser and you made a change and want to see the changes but keep working on the file just type:
to write the changes without closing the file. Then you can refresh your browser and see the changes take effect.