Check if Untitled buffer exists before trying to delete it

master
Bryan 2024-10-17 07:23:57 -06:00
parent bf18665ad4
commit 0436ae9135
1 changed files with 6 additions and 2 deletions

View File

@ -91,7 +91,9 @@ local function cd_project_in_tab(dir)
vim.fn.execute("tabe | tcd " .. vim.fn.fnameescape(dir))
if vim.fn.bufnr("Untitled") == -1 then
vim.api.nvim_command("bdelete! Untitled")
end
vim.api.nvim_command("%bdelete")
require("persistence").load()
local hooks = cd_hooks.get_hooks(vim.g.cd_project_config.hooks, dir, "AFTER_CD")
@ -110,7 +112,9 @@ local function cd_project(dir)
vim.fn.execute("cd " .. vim.fn.fnameescape(dir))
if vim.fn.bufnr("Untitled") == -1 then
vim.api.nvim_command("bdelete! Untitled")
end
vim.api.nvim_command("%bdelete")
require("persistence").load()