Add additional buffer, help, and file keybindings

This commit is contained in:
Jeremy Dormitzer 2021-03-19 12:40:01 -04:00
parent 050091fed2
commit c07beeb0ac
3 changed files with 28 additions and 1 deletions

View File

@ -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

View File

@ -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)

View File

@ -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