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 <deuill@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2022-06-21 18:14:51 +02:00
parent ec2062f517
commit 7ca50e0ce8
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 7 additions and 0 deletions

View file

@ -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)

View file

@ -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."