diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 696ed071a..4793bbdae 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -83,6 +83,7 @@ Interactive improvements - Fish now disables the QUIT terminal sequence when it has the terminal. This frees up a key combination, often ctrl-backslash (``\x1c``) (:issue:`9234`). - Fish's vi mode no longer uses iTerm's proprietary escape sequences to signal cursor change, instead using the normal xterm-style sequences. This allows for a blinking cursor and makes it work in complicated scenarios with nested terminals. (:issue:`3741`, :issue:`9172`) - Generating descriptions for commands now uses ``manpath`` instead of ``man --path`` on macOS, as that has been removed in macOS Ventura. +- When running fish on a remote system (e.g. inside SSH or a container), :kbd:`Control-X` now copies to the local client system's clipboard if the terminal supports OSC 52. Fixed Bugs diff --git a/share/functions/fish_clipboard_copy.fish b/share/functions/fish_clipboard_copy.fish index 67dd53971..17cb74984 100644 --- a/share/functions/fish_clipboard_copy.fish +++ b/share/functions/fish_clipboard_copy.fish @@ -23,4 +23,15 @@ function fish_clipboard_copy else if type -q clip.exe printf '%s' $cmdline | clip.exe end + + # Copy with OSC 52; useful if we are running in an SSH session or in + # a container. + if type -q base64 + if not isatty stdout + echo "fish_clipboard_copy: stdout is not a terminal" >&2 + return 1 + end + set -l encoded (printf %s $cmdline | base64 | string join '') + printf '\e]52;c;%s\a' "$encoded" + end end