Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E121: Undefined variable: b:currentDiff when switching from a diff to next one. #40

Open
niva-xx opened this issue Dec 4, 2021 · 0 comments

Comments

@niva-xx
Copy link

niva-xx commented Dec 4, 2021

Hi,

Using Vim DirDiff plugin, I have made this vim9 func to set layout (and go to next diff) when entering &ft dirdiff buffer

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 77_DirDiff[117]..77_DirDiffNext[10]..77_DirDiffOpen:
line 96:
E121: Undefined variable: b:currentDiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant