From: Eshel Yaron Date: Fri, 2 Aug 2024 17:20:45 +0000 (+0200) Subject: New command 'kubed-list-copy-as-kill' X-Git-Tag: v0.3.0~15 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eb966a2aed7a6df605907bd0dd8730f0333e5ee6;p=kubed.git New command 'kubed-list-copy-as-kill' * kubed.el (kubed-list-copy-as-kill): New command. (kubed-list-mode-map): Bind it to "w". --- diff --git a/kubed.el b/kubed.el index 0653353..7919c7b 100644 --- a/kubed.el +++ b/kubed.el @@ -368,12 +368,23 @@ to 1." (unless next (user-error "End of table"))) (goto-char next))) +(defun kubed-list-copy-as-kill (click) + "Copy name of Kubernetes resource at CLICK to into the kill ring." + (interactive (list last-nonmenu-event) kubed-list-mode) + (if-let ((ent (tabulated-list-get-entry (mouse-set-point click))) + (new (aref ent 0))) + (progn + (kill-new new) + (message "Copied resource name `%s'" new)) + (user-error "No Kubernetes resource at point"))) + (defvar-keymap kubed-list-mode-map :doc "Common keymap for Kubernetes resource list buffers." "/" #'kubed-list-set-filter "A" #'kubed-all-namespaces-mode "d" #'kubed-list-mark-for-deletion "u" #'kubed-list-unmark + "w" #'kubed-list-copy-as-kill "C-i" #'kubed-list-next-column "TAB" #'kubed-list-next-column "C-S-i" #'kubed-list-previous-column