How to Use VIM Editor in CLI
VIM is most popular editor which Developer's generally require to use while Development, Let's see how we can use it:
Open a File:
~ vim fileName.ext
To save and exit the Vim editor, you can use the following commands:
- :wq This command saves the changes to the file and exits Vim. It is equivalent to “write and quit”.
- :w: This command saves the changes to the file, but remains in Vim. You can continue editing or use other commands to manipulate the file.
- :q!: This command exits Vim without saving changes. It is equivalent to “quit bang” and discards any unsaved modifications.
Additional Tips
- To enter command mode, press the Esc key.
- To switch between insert mode and command mode, use Esc to exit insert mode and return to command mode.
- Save and exit a file: :wq
- Save a file without exiting: :w
- Exit Vim without saving changes: :q!
- Rename a file and save changes: :w new_filename.txt
- Save and exit multiple files: :wqa
Remember to use these commands wisely, as they can have unintended consequences if not used carefully.
<> Happy Coding </>
Comments
Post a Comment