42 lines
1.3 KiB
EmacsLisp
42 lines
1.3 KiB
EmacsLisp
;; -*- lexical-binding: t; -*-
|
|
|
|
;; Make Dired even better
|
|
(use-package dired
|
|
:straight (:type built-in)
|
|
:config
|
|
(defun dired-find-file-current-dir ()
|
|
(interactive)
|
|
(let ((default-directory (dired-current-directory)))
|
|
(call-interactively #'find-file)))
|
|
(defun dired-do-rename-current-dir ()
|
|
(interactive)
|
|
(let ((default-directory (dired-current-directory)))
|
|
(call-interactively #'dired-do-rename)))
|
|
(evil-collection-dired-setup)
|
|
:general
|
|
(dired-mode-map [remap find-file] #'dired-find-file-current-dir
|
|
[remap dired-do-rename] #'dired-do-rename-current-dir)
|
|
:custom
|
|
(dired-dwim-target t))
|
|
|
|
;; Add a toggleable dired sidebar
|
|
(use-package dired-sidebar
|
|
:config
|
|
(defun winum-assign-0-to-dired-sidebar ()
|
|
(when (equal major-mode 'dired-sidebar-mode) 0))
|
|
(add-to-list 'winum-assign-functions #'winum-assign-0-to-dired-sidebar)
|
|
(add-hook 'dired-sidebar-mode-hook
|
|
(lambda ()
|
|
(unless (file-remote-p default-directory)
|
|
(auto-revert-mode))))
|
|
(add-hook 'dired-sidebar-mode-hook #'hide-mode-line-mode)
|
|
:general
|
|
(leader-map "d" #'dired-sidebar-toggle-sidebar)
|
|
:custom
|
|
(dired-sidebar-theme 'nerd)
|
|
(dired-sidebar-should-follow-file t)
|
|
(dired-sidebar-pop-to-sidebar-on-toggle-open nil)
|
|
(dired-sidebar-no-delete-other-windows t))
|
|
|
|
(provide 'init-dired)
|