diff --git a/emacs/.emacs.d/config/init-buffers.el b/emacs/.emacs.d/config/init-buffers.el index dadec47..5195190 100644 --- a/emacs/.emacs.d/config/init-buffers.el +++ b/emacs/.emacs.d/config/init-buffers.el @@ -19,7 +19,8 @@ Repeated invocations toggle between the two most recently open buffers." "bb" #'switch-to-buffer "bd" #'kill-buffer "bm" #'kill-other-buffers - "br" #'rename-buffer) + "br" #'rename-buffer + "bg" #'revert-buffer) ;; A library that provides a hook called on switching buffers (use-package switch-buffer-functions diff --git a/emacs/.emacs.d/config/init-files.el b/emacs/.emacs.d/config/init-files.el index 5b8fa45..3d25321 100644 --- a/emacs/.emacs.d/config/init-files.el +++ b/emacs/.emacs.d/config/init-files.el @@ -2,9 +2,33 @@ ;; File-related configuration +(defun jdormit-delete-file (file) + (interactive (list (read-file-name "Delete file: " + nil + nil + t + (buffer-file-name)))) + (delete-file file) + (when (string-equal (buffer-file-name) file) + (bury-buffer))) + +(defun rename-this-file (new-name) + (interactive (list (read-file-name "Rename file: " + nil + nil + nil + (buffer-file-name)))) + (rename-file (buffer-file-name) new-name 1) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil)) + (leader-def-key "f" '(nil :which-key "file") "ff" #'find-file + "fs" #'save-buffer + "fD" '(jdormit-delete-file :which-key "delete") + "fr" '(rename-this-file :which-key "rename") "fd" #'dired) (provide 'init-files) diff --git a/emacs/.emacs.d/config/init-help.el b/emacs/.emacs.d/config/init-help.el index b2fabf7..840a218 100644 --- a/emacs/.emacs.d/config/init-help.el +++ b/emacs/.emacs.d/config/init-help.el @@ -2,6 +2,8 @@ ;; Emacs has fanstastic built-in help features, but they could be more convenient +(leader-def-key "h" '(:keymap help-map :which-key "help")) + (use-package info :straight (:type built-in) :config