Bug: expand autocmd with <abuf> is wrong for BufUnload
Open
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 537
- Forks
- 57
- Avg merge
- 1h 6m
- Merged PRs (30d)
- 6
Description
@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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TypeScript @Autocmd entry point and trace how eval: 'expand("")' is evaluated for BufUnload; compare it with the Vimscript example and the case. Done when unload callbacks receive the removed buffer and file values rather than the current buffer, with regression coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100