mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 08:01:13 +01:00
Remove: Wiping deleted buffers from memory is not needed anymore as all buffers are getting wiped from memory after close\d.
This commit is contained in:
@@ -50,24 +50,4 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost' }, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Automatically wipe "file removed" buffers when they are closed
|
|
||||||
vim.api.nvim_create_autocmd('BufWinLeave', {
|
|
||||||
callback = function(args)
|
|
||||||
local buf = args.buf
|
|
||||||
if should_skip(buf) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local bufname = vim.api.nvim_buf_get_name(buf)
|
|
||||||
-- If the buffer was marked for wipe or name indicates it's deleted
|
|
||||||
local marked = pcall(vim.api.nvim_buf_get_var, buf, 'marked_for_wipe') and vim.api.nvim_buf_get_var(buf, 'marked_for_wipe')
|
|
||||||
if marked or (bufname ~= '' and bufname:match 'file removed') then
|
|
||||||
vim.schedule(function()
|
|
||||||
if vim.api.nvim_buf_is_valid(buf) then
|
|
||||||
vim.cmd('bwipeout! ' .. buf)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user