Skip to main content

[vi/vim] Save on Exit

I see a lot of people using 'wq' a lot but never a form 'x'.
In vi and vim, if you want to save and exit with a simple key stroke simply use:
:x


Bookmark and Share

Comments

Anonymous said…
Thanks for this. I'm definitely one of those people that uses :wq all the time. It doesn't even feel like an extra keystroke anymore!
AnjanBacchuDev said…
thank you.

I think that I forgot this command for about 15 years.

BR,
~A
Jimmy said…
Why use :x when ZZ is easier?
Scott said…
Thanks. I didn't even know how to save a file in vi. I always just use :q! to get out and use pico, but ESX has no pico :(

Thanks.
Unknown said…
You can also use ZZ, which is even shorter then :x
nprasanna said…
you can use :xa to save and close multiple files