diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/emacs/init.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el index 2f338b9a..117b2bda 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -632,6 +632,16 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve (setq delete-by-moving-to-trash t) +(defun my/delete-file-and-buffer () + "Kill the current buffer and deletes the file it is visiting." + (interactive) + (let ((filename (buffer-file-name))) + (when filename + (when (y-or-n-p (format "Are you sure you want to delete %s? " filename)) + (delete-file filename delete-by-moving-to-trash) + (message "Deleted file %s" filename) + (kill-buffer))))) + (use-package goto-chg :defer 1) @@ -1143,7 +1153,7 @@ _C-k_: prev _u_pper _=_: upper/lower _s_mart resolve "fs" #'save-buffer "ff" #'find-file "fw" #'write-file - "fd" #'crux-delete-file-and-buffer + "fd" #'my/delete-file-and-buffer "fr" #'crux-rename-file-and-buffer "gs" #'magit-status "gm" #'vc-msg-show |