dotfiles/emacs/.emacs.d/config/init-files.el

35 lines
1.0 KiB
EmacsLisp
Raw Normal View History

2021-02-21 02:59:11 +00:00
;; -*- 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))
(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)