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

42 lines
1.3 KiB
EmacsLisp
Raw Normal View History

2021-02-21 02:59:11 +00:00
;; -*- lexical-binding: t; -*-
2021-02-20 16:52:15 +00:00
;; 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)))
2021-02-21 03:21:05 +00:00
(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
2021-02-21 03:21:05 +00:00
[remap dired-do-rename] #'dired-do-rename-current-dir)
:custom
(dired-dwim-target t))
2021-02-20 16:52:15 +00:00
2021-02-20 23:24:00 +00:00
;; 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))
2021-02-20 16:52:15 +00:00
(provide 'init-dired)