Skip to content

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

Open
@chemzqm

Description

@chemzqm
  @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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions