feat(clipboard): add an in-memory clipboard history with search and paste #41

Closed
BlackAngelTV wants to merge 27 commits from feat/clipboard-history into main
pull from: feat/clipboard-history
2 changed files with 32 additions and 0 deletions
Showing only changes of commit e009b493c7 - Show all commits

No files matched your search

+5
View File
@@ -222,6 +222,11 @@ Detailed list of changes
0.50.1 [unreleased]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- kitty now keeps an in-memory history of the text copied to the clipboard,
which :ac:`paste_from_clipboard_history` and :ac:`search_clipboard_history`
can paste back. Nothing is written to disk and private clipboard writes are
never recorded. See :ref:`clipboard_history` for details.
- :kbd:`Ctrl+Shift+E` now opens the :doc:`file manager kitten
<kittens/file-manager>` in a left dock by default, instead of requiring a
manual mapping. This takes the key over from :ac:`open_url`; remap
+27
View File
@@ -264,3 +264,30 @@ to access the clipboard.
When the terminal sends an unsolicited paste event because the user triggered
a paste and the 5522 mode is enabled, there will be no associated id. In this
case, the multiplexer must forward the event to the currently active window.
.. _clipboard_history:
Clipboard history
---------------------
kitty keeps the last 50 pieces of plain text copied to the clipboard of each
instance, newest first, and lets you paste one of them back with
:ac:`paste_from_clipboard_history`. :ac:`search_clipboard_history` filters the
history with a fuzzy query before showing the list.
The history lives in memory only: it is never written to disk, so it disappears
when kitty exits and secrets copied during a session do not outlive it. Text
written by a program that marks its request as private (by passing a ``pw``
field in an *OSC 5522* write request) is never recorded, and neither is anything
copied to the primary selection. Images and other non-text data are ignored.
To bind both actions, add something like this to :file:`kitty.conf`:
.. code-block:: conf
map kitty_mod+shift+v paste_from_clipboard_history
map kitty_mod+shift+f search_clipboard_history
The size of the history is fixed at 50 entries, 64 KiB per entry and 1 MiB in
total, so that a few large copies cannot use an unbounded amount of memory.