Check if Untitled buffer exists before trying to delete it
parent
bf18665ad4
commit
0436ae9135
|
|
@ -91,7 +91,9 @@ local function cd_project_in_tab(dir)
|
||||||
|
|
||||||
vim.fn.execute("tabe | tcd " .. vim.fn.fnameescape(dir))
|
vim.fn.execute("tabe | tcd " .. vim.fn.fnameescape(dir))
|
||||||
|
|
||||||
vim.api.nvim_command("bdelete! Untitled")
|
if vim.fn.bufnr("Untitled") == -1 then
|
||||||
|
vim.api.nvim_command("bdelete! Untitled")
|
||||||
|
end
|
||||||
vim.api.nvim_command("%bdelete")
|
vim.api.nvim_command("%bdelete")
|
||||||
require("persistence").load()
|
require("persistence").load()
|
||||||
local hooks = cd_hooks.get_hooks(vim.g.cd_project_config.hooks, dir, "AFTER_CD")
|
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))
|
vim.fn.execute("cd " .. vim.fn.fnameescape(dir))
|
||||||
|
|
||||||
vim.api.nvim_command("bdelete! Untitled")
|
if vim.fn.bufnr("Untitled") == -1 then
|
||||||
|
vim.api.nvim_command("bdelete! Untitled")
|
||||||
|
end
|
||||||
vim.api.nvim_command("%bdelete")
|
vim.api.nvim_command("%bdelete")
|
||||||
require("persistence").load()
|
require("persistence").load()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue