How can I deltect if there is a file modification in VIM upon exiting (:q
)?
If there is a file modification Vim echos
E37: No write since last change (add ! to override)
I want to override this message with a custom message and an action similar to
File modified: Do you wish to save the file? (y)Yes (n)No (c)Cancel
I have modified Vim's behavior to save file on Ctrl-s
and quit on Ctrl-w
Now I am looking for a solution if the file is already modified and user is quitting it with Ctrl-w I want Vim to prompt to save.
Here is the content of my .vimrc file:
map <C-S> :w<CR>
imap <C-S> <Esc>:w<CR>i
map <C-w> :q<CR>
imap <C-w> <Esc>:q<CR>
:confirm quit
? – daniel kullmann Aug 2 '12 at 7:46