From c67e52e3f8efa0d7b4979f973b6f0a507c283709 Mon Sep 17 00:00:00 2001 From: Mike Smith <10135646+mikesmithgh@users.noreply.github.com> Date: Wed, 22 Nov 2023 07:27:04 -0500 Subject: [PATCH] fix: set `shell` to `sh` before executing termopen --- lua/kitty-scrollback/kitty_commands.lua | 7 +++++++ lua/kitty-scrollback/launch.lua | 1 + 2 files changed, 8 insertions(+) diff --git a/lua/kitty-scrollback/kitty_commands.lua b/lua/kitty-scrollback/kitty_commands.lua index f9245b39..46f870ff 100644 --- a/lua/kitty-scrollback/kitty_commands.lua +++ b/lua/kitty-scrollback/kitty_commands.lua @@ -146,6 +146,10 @@ M.get_text_term = function(kitty_data, get_text_opts, on_exit_cb) local stdout local stderr local tail_max = 10 + + -- 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, { stdout_buffered = true, stderr_buffered = true, @@ -210,6 +214,9 @@ M.get_text_term = function(kitty_data, get_text_opts, on_exit_cb) end end, }) + + -- restore the original shell after processing termopen + vim.o.shell = p.orig_options.shell end M.send_paste_buffer_text_to_kitty_and_quit = function(bracketed_paste_mode) diff --git a/lua/kitty-scrollback/launch.lua b/lua/kitty-scrollback/launch.lua index a9eb29b8..ffc27c60 100644 --- a/lua/kitty-scrollback/launch.lua +++ b/lua/kitty-scrollback/launch.lua @@ -161,6 +161,7 @@ local function set_options() modifiable = vim.o.modifiable, wrap = vim.o.wrap, report = vim.o.report, + shell = vim.o.shell, } -- required opts