Search code examples
vimeditor

Does vi support "confirm on quit"


When typing fast, I sometimes accidentally type :wq, when in fact I just wanted to :w. Obviously, this causes a major pain when I have a session with numerous files and I end up losing all my buffers and have to reopen those files one after another in a new session. Just wondering if vim supports a "confirm on quit" feature that can prevent me from shooting myself in the foot.


Solution

  • Easy solution: put set confirm in your vimrc. If you want more customization, consider writing function like in this plugin: https://github.com/vim-scripts/confirm-quit/tree/master/plugin