;; -*- lexical-binding: t; -*- ;; 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)) (use-package sudo-edit :commands (sudo-edit sudo-edit-find-file)) ;; Optimized editing of very large files (use-package vlf :commands (vlf)) (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)