Hari Krishna Dara wrote: > When using |completion-function|, Vim is marking the buffer as modified, > as soon as the popup is triggered. When a plugin offers matches using > 'completefunc' the user should be able to cancel by pressing <C-E> > and this shouldn't leave the buffer as modified. > > Here is a sample function to show what I mean: > > function! TComplete(findstart, base) > if a:findstart > return 0 > else > return [a:base]+['test1', 'test2'] > endif > endfunction > setl completefunc=TComplete > > Thinking about it, it might be that Vim automatically chooses the first > item in the completion, but this provides no option to leave buffer as > not modified when completion is cancelled without selecting an item. I > even tried explicitly setting nomodified (though it is ugly), something > like: > > inoremap <C-X><C-U> <C-X><C-U><C-R>=ResetModified() > function! ResetModified() > setl nomodified > return '' > endfunction > > But Vim seems to ignore this, as the buffer is still modified at the > end.
The completion itself is seen as a change. If you cancel completion it's like changing the text back to what it was. It's very difficult to do this otherwise. -- hundred-and-one symptoms of being an internet addict: 88. Every single time you press the 'Get mail' button...it does get new mail. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
