From e29a374e04439544d593ae5ed188dbb6e285b119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Galh=C3=B3s?= Date: Tue, 4 Nov 2025 09:54:50 -0300 Subject: [PATCH] Add action to copy the last command output --- kitty/window.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kitty/window.py b/kitty/window.py index 91e1ed1db..297ddd59c 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -2131,6 +2131,16 @@ def show_last_visited_command_output(self) -> None: def show_last_non_empty_command_output(self) -> None: self.show_cmd_output(CommandOutput.last_non_empty, 'Last non-empty command output') + @ac('cp', ''' + Copy the last non-empty output from a shell command to the clipboard + + Requires :ref:`shell_integration` to work + ''') + def copy_last_command_output(self) -> None: + text = self.cmd_output(CommandOutput.last_non_empty, as_ansi=False, add_wrap_markers=False) + if text: + set_clipboard_string(text) + @ac('cp', 'Paste the specified text into the current window. ANSI C escapes are decoded.') def paste(self, text: str) -> None: self.paste_with_actions(text)