How To Save & Quit In VIM Or VI | OSXDaily
Có thể bạn quan tâm
If you’re new to VI or VIM, the command line text editors, you may be wondering some of the basics, like how to save files, or how to both save and quit in vim in one fell swoop.
How to Save & Quit a File in VIM or VI
The simplest way to both save and quit out of VI or VIM is with a keyboard shortcut ZZ. Note the capitalization, which means the save and quit command is executed by pressing Escape, then holding the Shift key then pressing Z twice, thus:
- Press the ESC key, then hold the Shift key then press Z twice
You’ll immediately save the current file and exit out of vi/VIM with ZZ.
Similarly you can use ZQ to quit vim/vi in general, but without saving the file.
How to Save File Without Quitting in VI or VIM
You can also save a file in VI or VIM without quitting:
- Press the ESC key to enter command mode (getting out of Insert mode)
- Type :w and hit return
Save File and Quit in vi/vim
You can also use command mode to save and quit in one command:
- Press the ESC key to enter command mode (getting out of Insert mode)
- Type :wq and hit return
Note the colon and not semi-colon, as : puts you into command mode and then wq (write and quit) is the command used to save and exit out of vim/vi.
VIM/VI can be a bit of a confounding mystery if you’re new to using it, but like anything else once you learn a few basics you’ll be more comfortable with it. If you’re new to VIM and want to learn more, there’s a well-done online VIM interactive tutorial at openvim.com. The ‘vimtutor’ command can also help you along. Or you can always just launch your Terminal, type vim, hit return, and perform your own crash course.
VIM is a powerful text editor, but you can use it for other stuff too, like creating a password protected text file to function as a journal, diary, or credential file or whatever else you’d find a locked text file for.
Now you know how to save, and save and quit out of vim. There are other ways too, but these are the most commonly used and easiest to use.
- More
- Tumblr
- Telegram
Related
Từ khóa » Vi In Linux Save
-
An Introduction To The Vi Editor | Enable Sysadmin - Red Hat
-
How To: Vi / Vim Save And Quit The Editor Command - NixCraft
-
How To Save A File In Vi / Vim Text Editor - NixCraft
-
How To Save A File In Vi / Vim Editor & Quit - PhoenixNAP
-
How To Save A File In Vim / Vi And Quit The Editor - Linuxize
-
Using Vi? Here's How To Open A File Then Save And Quit - MakeUseOf
-
How To Save A File In Vi / Vim Editor In Linux - Tecmint
-
Saving Changes And Quitting Vi
-
Saving Files And Quitting Vi
-
How To Save A File In Vim/Vi? - LinuxTect
-
VI Editor With Commands In Linux/Unix Tutorial - Guru99
-
How To Save A File In Vi / Vim And Quit Editor - TecAdmin
-
How To Exit (quit) Linux Vi Editor With Or Without Saving Changes Step ...
-
How To Save A File In Linux After Using The Vi Command