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.

-- 
Thanks,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to