I'm not sure if it's what you're looking for, but the tabline is
triggered on the 'modified' setting.

Just for the helluvit, I added pre- and post-proc function hooks to
TabLineSet.vim.

You can also add a check inside a CursorMoved[I} autocommand, which
might have a little more overhead, but maybe not noticeable.

In either case, my idea would be to set up a status dict:


let s:modified_table = {}
function! Tst_postproc_modified( tabline )
        let updated = []
        for bufnr in range( 1, bufnr("$") )
                if !bufexists( bufnr ) | continue | endif
                let modded = getbufvar( bufnr, '&modified' )
                if !has_key( s:modified_table, bufnr )
                        let s:modified_table[ bufnr ] = modded
                endif
                if s:modified_table[ bufnr ] != modded
                        let s:modified_table[ bufnr ] = modded
                        call add( updated, [ bufnr, modded ] )
                endif
        endfor

        for elem in updated
                let bufnr = elem[0]
                let modded = elem[1]
                echomsg 'bufnr#' . bufnr . ', ' . bufname( bufnr ) . ' is now ' 
. (
modded ? '' : 'no' ) . 'modified'
        endfor

        " call somefunction( updated )

endfunction
                


On 5/3/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:
I want to trap changes in the value of 'modified'  (execute
my  commands when first change is done to the
buffer, and when undo reverts buffer to unmodified state).
How can I achieve this ?

Note that this is not necessarity connected to Insert mode.
Buffer can easily become modified without entering insert mode.

Yakov

Reply via email to