2021-02-21 02:59:11 +00:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
2021-02-20 11:40:03 +00:00
|
|
|
;; File-related configuration
|
|
|
|
|
2021-03-19 16:40:01 +00:00
|
|
|
(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))
|
|
|
|
|
2021-10-14 15:57:44 +00:00
|
|
|
(use-package sudo-edit
|
|
|
|
:commands (sudo-edit
|
|
|
|
sudo-edit-find-file))
|
|
|
|
|
|
|
|
;; Optimized editing of very large files
|
|
|
|
(use-package vlf
|
|
|
|
:commands (vlf))
|
|
|
|
|
2021-02-20 11:40:03 +00:00
|
|
|
(leader-def-key
|
|
|
|
"f" '(nil :which-key "file")
|
|
|
|
"ff" #'find-file
|
2021-03-19 16:40:01 +00:00
|
|
|
"fs" #'save-buffer
|
|
|
|
"fD" '(jdormit-delete-file :which-key "delete")
|
|
|
|
"fr" '(rename-this-file :which-key "rename")
|
2021-02-20 11:40:03 +00:00
|
|
|
"fd" #'dired)
|
|
|
|
|
|
|
|
(provide 'init-files)
|