I have an alias bed="vim ~/.bashrc && . ~/.bashrc"
in my .bashrc
. Now every now and then I'd like to run bed
but return the vim
with an exit status 1
so the source command doesn't execute.
TL;DR – How to Exit Vim If you made some changes and would like to keep them, type :wq and press Enter / return. If you made some changes and would rather discard them, type :q! and press Enter / return.
You can press the Esc key. Type SHIFT Z Z to save and exit. Type SHIFT Z Q to exit without saving.
Quit Vim / Vi without Saving the File To exit the editor, without saving the changes, switch to normal mode by pressing Esc , type :q! and hit Enter . Type :q!
Found the answer here : How to exit the Vim editor?
You can do :cq
to exit with a non-zero exit code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With