hi by mistake I create files and now every time open terminal it showing

please how I delete it this 2 files coz am trying many steps but it still showing

MacBook Air 13″, macOS 14.2

Posted on Apr 22, 2024 7:46 AM

Reply
1 reply

Apr 22, 2024 11:31 AM in response to New_111

https://builtin.com/articles/how-to-exit-vim#:~:text=Save%20and%20exit%3A%20If%20you,command.


Image: Shutterstock / Built In

Vim is a popular text editor that is known for its power and efficiency. However, for those who are new to Vim, one of the biggest challenges can be simply figuring out how to exit the editor when unintentionally entering it. Vim has a reputation as the black hole of editors. 


3 Commands to Exit Vim

  1. Save and exit: :wq
  2. Exit without saving: :q!
  3. Save and exit multiple files: :wqa 

This might occur especially since Vim is the default text editor for git, and a command as simple as the following, might trap you inside the unexitable editor:

git commit

In this article, we’ll go over the various ways you can exit Vim and some tips for making the process easier.

 

3 Ways to Exit Vim

There are several ways to exit Vim, depending on your current situation. Here are the most common methods:

  1. Save and exit: If you want to save your changes and exit Vim, you can use the :wq command. This writes (saves) your changes to the file and then quits Vim.
  2. Exit without saving: If you don’t want to save your changes and just want to exit Vim, you can use the :q! command. This will exit Vim without saving your changes, discarding any changes you made since the last time you saved.
  3. Save and exit multiple files: If you have multiple files open in Vim and want to save and exit all of them at once, you can use the :wqa command. This will write and quit all open files. This is very unlikely to happen if you ended up in Vim unintentionally.

If you want to type in the commands mentioned above, like :q! or :wq, you must be in the “normal” mode. Upon opening Vim, you’re in normal mode, and entering these commands on your keyboard will cause them to appear with the press of a button. 

If you are in insert mode, which means you’re actively editing text in the file, you can exit insert mode by pressing the Esc key. This will return you to normal mode, where you can enter commands like :wq or :q!.


[Edited by Moderator]

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

hi by mistake I create files and now every time open terminal it showing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.