Saturday, December 4, 2021

vim dirdiff autocmd bufenter disturb existence of b:currentDiff

Hi,

Using Vim DirDiff plugin


I have made this vim9 func to set layout and go to next diff.
def g:ManageDirDiff()

  if ( &ft == 'dirdiff' )

  echomsg 'Manage dirdiff'

if &columns < 200
  set columns=999 
  set lines=999
endif

resize 4
windo if &diff | setl nofoldenable | endif

    exec ':1,2 windo vertical resize ' .. (&columns / 2)
    exec ':1,2 windo setl nofoldenable'
    exec ':1,2 windo norm ]c'

  endif
enddef


When I call this def function from mapping it is ok.
When I automate it with this autocmd it disturb dirdiff plugin b:currentDiff variable to be set.

if has("autocmd")

  augroup VimReload
autocmd!
autocmd BufEnter      *.tmp     call g:ManageDirDiff() 
  augroup END

endif

This cause this error message
Manage dirdiff
Error detected while processing function <SNR>77_DirDiff[117]..<SNR>77_DirDiffNext[10]..<SNR>77_DirDiffOpen:
line   96:
E121: Undefined variable: b:currentDiff



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d1d1b37a-c6c7-41c6-8680-c8405362e14en%40googlegroups.com.

No comments:

Post a Comment