From 7ca50e0ce8165a6f65efa1f2870303d2555e7b9f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 21 Jun 2022 18:14:51 +0200 Subject: [PATCH] feat(default): bind 'SPC b y' to yank whole buffer Evil may not always be available in all buffers, and in line with the filepath yank commands on SPC f y/Y, I thought this command could be useful. However, I omitted a "replace buffer with paste" command because in any editing context, evil should be available, in which case it'd be redundant with `vigp` (or yig for yanking the buffer). Close: #5281 Co-authored-by: Alex Palaistras --- modules/config/default/+evil-bindings.el | 1 + modules/config/default/autoload/text.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 460290a55..72b124095 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -372,6 +372,7 @@ :desc "Save buffer as root" "u" #'doom/sudo-save-buffer :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer :desc "Switch to scratch buffer" "X" #'doom/switch-to-scratch-buffer + :desc "Yank buffer" "y" #'+default/yank-buffer-contents :desc "Bury buffer" "z" #'bury-buffer :desc "Kill buried buffers" "Z" #'doom/kill-buried-buffers) diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index 9d3eb12b3..9b1510e67 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -32,6 +32,12 @@ ((fboundp 'helm-show-kill-ring) #'helm-show-kill-ring) ((error "No kill-ring search backend available. Enable ivy, helm or vertico!"))))) +;;;###autoload +(defun +default/yank-buffer-contents () + "Copy entire buffer into kill ring." + (interactive) + (clipboard-kill-ring-save (point-min) (point-max))) + ;;;###autoload (defun +default/yank-buffer-path (&optional root) "Copy the current buffer's path to the kill ring."