mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 16:58:09 +02:00
hints kitten: Allow copying matches to named buffers
This commit is contained in:
@@ -545,6 +545,9 @@ for the operating system. Various special values are supported:
|
||||
:code:`*`
|
||||
copy the match to the primary selection (on systems that support primary selections)
|
||||
|
||||
:code:`#NAME`
|
||||
copy the match to the specified buffer, e.g. :code:`#a`
|
||||
|
||||
:code:`default`
|
||||
run the default open program.
|
||||
|
||||
@@ -746,7 +749,7 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
|
||||
|
||||
if action == 'self':
|
||||
if w is not None:
|
||||
is_copy_action = cmd[0] in ('-', '@', '*')
|
||||
is_copy_action = cmd[0] in ('-', '@', '*') or cmd[0].startswith('#')
|
||||
if is_copy_action:
|
||||
text = ' '.join(cmd[1:])
|
||||
if cmd[0] == '-':
|
||||
@@ -755,6 +758,8 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
|
||||
set_clipboard_string(text)
|
||||
elif cmd[0] == '*':
|
||||
set_primary_selection(text)
|
||||
elif cmd[0].startswith('#'):
|
||||
boss.set_clipboard_buffer(cmd[0].lstrip('#'), text)
|
||||
else:
|
||||
import shlex
|
||||
text = ' '.join(shlex.quote(arg) for arg in cmd)
|
||||
@@ -815,6 +820,8 @@ def handle_result(args: List[str], data: Dict[str, Any], target_window_id: int,
|
||||
set_clipboard_string(joined_text())
|
||||
elif program == '*':
|
||||
set_primary_selection(joined_text())
|
||||
elif program.startswith('#'):
|
||||
boss.set_clipboard_buffer(program.lstrip('#'), joined_text())
|
||||
else:
|
||||
from kitty.conf.utils import to_cmdline
|
||||
cwd = data['cwd']
|
||||
|
||||
Reference in New Issue
Block a user