diff --git a/lua/cd-project/api.lua b/lua/cd-project/api.lua index 1e9ff13..0fb0b71 100644 --- a/lua/cd-project/api.lua +++ b/lua/cd-project/api.lua @@ -89,12 +89,12 @@ local function cd_project_in_tab(dir) require("persistence").save() - 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") + + vim.fn.execute("tabe | tcd " .. vim.fn.fnameescape(dir)) require("persistence").load() local hooks = cd_hooks.get_hooks(vim.g.cd_project_config.hooks, dir, "AFTER_CD") @@ -110,12 +110,12 @@ local function cd_project(dir) require("persistence").save() - 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") + + vim.fn.execute("cd " .. vim.fn.fnameescape(dir)) require("persistence").load() local hooks = cd_hooks.get_hooks(vim.g.cd_project_config.hooks, dir, "AFTER_CD")