[EMAIL PROTECTED] wrote:
Hi,
is there a way to disabling the saveing and writing of/to a file
and leaving of vim until a certain condition of the contents of
the file is not given (in this case certain characters are not
allowed as contents of the file)?
The whole thing should only be active for a C-/C++-Files.
Thanks a lot for any help in advance!
Keep editing!
mcc
---- ~/.vim/after/ftplugin/c.vim (Unix) ----
---- ~/vimfiles/after/ftplugin/c.vim (Windows) ----
function s:CheckCFile()
" do something ...
" setting a variable (let's say l:FileOK) to true (1)
" or false (0)
return FileOK
endfunction
augroup cfilecheck
au BufWritePre *.c,*.h,*.cpp
\ setlocal modified
\ | let &l:readonly = ! s:CheckCFile()
augroup END
This should give you the familiar error if you attempt to save a "bad" file or
exit Vim without an exclamation mark after the command name (see ":help abandon").
Best regards,
Tony.
--
Excellent day for drinking heavily. Spike office water cooler.