feat(nvim): add autocmd to remove no name buffers
This commit is contained in:
parent
e01700dab6
commit
071081f582
@ -28,6 +28,17 @@ M.setup = function()
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- NOTE: Removes No Name buffers, thanks
|
||||||
|
-- https://www.reddit.com/r/neovim/comments/16b0n3a/comment/jzcbhxo/?utm_source=share&utm_medium=web2x&context=3
|
||||||
|
vim.api.nvim_create_autocmd("BufHidden", {
|
||||||
|
group = augroup,
|
||||||
|
desc = "Delete [No Name] buffers",
|
||||||
|
callback = function(event)
|
||||||
|
if event.file == "" and vim.bo[event.buf].buftype == "" and not vim.bo[event.buf].modified then
|
||||||
|
vim.schedule(function() pcall(vim.api.nvim_buf_delete, event.buf, {}) end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
-- NOTE: Launches a different program for a given filetype instead of opening it in Neovim
|
-- NOTE: Launches a different program for a given filetype instead of opening it in Neovim
|
||||||
local intercept_file_open = true
|
local intercept_file_open = true
|
||||||
vim.api.nvim_create_user_command("InterceptToggle", function()
|
vim.api.nvim_create_user_command("InterceptToggle", function()
|
||||||
|
Loading…
Reference in New Issue
Block a user