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:

VIM Editor - Education Funda
VIM Editor - Education Funda


Open a File:

~ vim fileName.ext 

To save and exit the Vim editor, you can use the following commands:

  1. :wq This command saves the changes to the file and exits Vim. It is equivalent to “write and quit”.
  2. :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.
  3. :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

Popular posts from this blog

JavaScript Logical Output Based Interview Questions

Deploy Angular Build With Express JS Project

Create and Deploy AWS SAM Application