node-client icon indicating copy to clipboard operation
node-client copied to clipboard

Bug: expand autocmd with <abuf> is wrong for BufUnload

Open chemzqm opened this issue 6 years ago • 1 comments

  @Autocmd('BufUnload', {
    sync: true,
    pattern: '*',
    eval: 'expand("<abuf>")'
  })
  public async onBufUnload(bufnr: string):Promise<void> {
    logger.debug(`file: ${bufnr} remove`)
  }

The bufnr here is always the buffer number of current buffer number, but it should be the buffer number of removed buffer.

autocmd BufUnload * call s:OnUnload()
function! s:OnUnload()
  echo +expand('<abuf>')
endfunction

vim script doesn't have this problem.

BTW: <afile> is neither correct.

chemzqm avatar May 04 '18 01:05 chemzqm

I've changed to use latest master branch. Issue still exists, but it only occurs when delete hidden buffer, the buffer number would always be current buffer number.

chemzqm avatar May 09 '18 07:05 chemzqm