diff --git a/lua/claude-code/file_refresh.lua b/lua/claude-code/file_refresh.lua index e3ae64e..41f2239 100644 --- a/lua/claude-code/file_refresh.lua +++ b/lua/claude-code/file_refresh.lua @@ -101,6 +101,7 @@ function M.setup(claude_code, config) group = augroup, pattern = '*', callback = function(args) + if not vim.api.nvim_buf_is_valid(args.buf) then return end local buf_name = vim.api.nvim_buf_get_name(args.buf) if buf_name:match('claude%-code') then vim.o.updatetime = claude_code.claude_code.saved_updatetime diff --git a/lua/claude-code/terminal.lua b/lua/claude-code/terminal.lua index 0be3df1..2acf21d 100644 --- a/lua/claude-code/terminal.lua +++ b/lua/claude-code/terminal.lua @@ -187,6 +187,14 @@ local function create_split(position, config, existing_bufnr) return create_float(config, existing_bufnr) end + -- Use the current window as-is, without splitting (like plain :terminal) + if position == 'current' then + if existing_bufnr then + vim.cmd('buffer ' .. existing_bufnr) + end + return + end + local is_vertical = position:match('vsplit') or position:match('vertical') -- Create the window with the user's specified command