diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 6f205cd..69fc905 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -77,6 +77,13 @@ vim.keymap.set({ "n", "i" }, "tt", function() -- Insert at cursor position local row, col = unpack(vim.api.nvim_win_get_cursor(0)) - vim.api.nvim_buf_set_lines(0, row, row, false, lines) + if #lines == 1 then + -- Insert inline if the result is a single line + local current_line = vim.api.nvim_get_current_line() + local new_line = current_line:sub(1, col) .. lines[1] .. current_line:sub(col + 1) + vim.api.nvim_set_current_line(new_line) + else + vim.api.nvim_buf_set_lines(0, row, row, false, lines) + end end) end, { desc = "Insert Shell Output at Cursor" })