Skip to content

Commit

Permalink
Merge branch 'main' into config-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh committed Jan 23, 2024
2 parents 87d69ff + ba68807 commit 14c42ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lua/kitty-scrollback/kitty_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ M.get_text_term = function(kitty_data, get_text_opts, on_exit_cb)
-- set the shell used for termopen to sh to avoid imcompatabiliies with other shells (e.g., nushell, fish, etc)
vim.o.shell = 'sh'

vim.fn.termopen(full_cmd, {
local success, error = pcall(vim.fn.termopen, full_cmd, {
stdout_buffered = true,
stderr_buffered = true,
on_stdout = function(_, data)
Expand Down Expand Up @@ -210,6 +210,12 @@ M.get_text_term = function(kitty_data, get_text_opts, on_exit_cb)
end
end,
})
if not success then
display_error(full_cmd, {
entrypoint = 'termopen() :: pcall(vim.fn.termopen) error returned',
stderr = error or nil,
})
end

-- restore the original shell after processing termopen
vim.o.shell = p.orig_options.shell
Expand Down
10 changes: 9 additions & 1 deletion lua/kitty-scrollback/launch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,15 @@ end
M.launch = function()
local kitty_data = p.kitty_data
vim.schedule(function()
p.bufid = vim.api.nvim_get_current_buf()
local buf_lines = vim.api.nvim_buf_get_lines(0, 0, 1, false)
local no_buf_content = vim.api.nvim_buf_line_count(0) == 1 and buf_lines[1] == ''
if no_buf_content then
p.bufid = vim.api.nvim_get_current_buf()
else
-- buffer must be empty for termopen, dashboard plugins may write to the first buffer before kitty-scrollback.nvim loads
p.bufid = vim.api.nvim_create_buf(true, true)
vim.api.nvim_set_current_buf(p.bufid)
end

ksb_autocmds.load_autocmds()

Expand Down

0 comments on commit 14c42ef

Please sign in to comment.