dev: merge branch 'master'
This commit is contained in:
commit
0e36272203
2 changed files with 53 additions and 22 deletions
|
@ -81,40 +81,51 @@ Fixes #3939: unsortable dired entries on Windows."
|
|||
;; buffers. Starting from scratch isn't even that expensive, anyway.
|
||||
(setq dirvish-reuse-session nil)
|
||||
|
||||
;; A more reserved mode-line height that should match doom-modeline's (or the
|
||||
;; vanilla mode-line's) height.
|
||||
(add-hook! 'after-setting-font-hook
|
||||
(defun +dired-update-mode-line-heigth-h ()
|
||||
;; REVIEW: Too hardcoded.
|
||||
(setq dirvish-mode-line-height (+ (frame-char-height) 4)
|
||||
dirvish-header-line-height (+ (frame-char-height) 8))))
|
||||
(+dired-update-mode-line-heigth-h)
|
||||
|
||||
(if (modulep! +dirvish)
|
||||
(setq dirvish-attributes '(file-size)
|
||||
dirvish-mode-line-format
|
||||
'(:left (sort file-time symlink) :right (omit yank index)))
|
||||
(setq dirvish-attributes nil
|
||||
dirvish-use-header-line nil
|
||||
dirvish-mode-line-format nil))
|
||||
dirvish-use-mode-line nil))
|
||||
|
||||
;; Match the height of `doom-modeline', if it's being used.
|
||||
;; TODO: Make this respect user changes to these variables.
|
||||
(when (modulep! :ui modeline)
|
||||
(add-hook! 'dired-mode-hook
|
||||
(defun +dired-update-mode-line-height-h ()
|
||||
(when-let (height (bound-and-true-p doom-modeline-height))
|
||||
(setq dirvish-mode-line-height height
|
||||
dirvish-header-line-height height)))))
|
||||
|
||||
(when (modulep! :ui vc-gutter)
|
||||
(push 'vc-state dirvish-attributes))
|
||||
|
||||
(when (modulep! +icons)
|
||||
(setq dirvish-subtree-always-show-state t)
|
||||
(appendq! dirvish-attributes '(nerd-icons subtree-state)))
|
||||
|
||||
;; HACK: Doom will treat an integer value for `dirvish-hide-details' to mean
|
||||
;; hide file/dir details if window is less than N characters wide (e.g. for
|
||||
;; side windows or small full-window layouts).
|
||||
(setq dirvish-hide-details 50)
|
||||
;; TODO: Proc this hook sooner. The delay on `dirvish-setup-hook' is jarring.
|
||||
(add-hook! 'dirvish-setup-hook
|
||||
(defun +dired-hide-details-in-side-mode-h ()
|
||||
(when (integerp dirvish-hide-details)
|
||||
(dired-hide-details-mode
|
||||
(if (< (window-width dirvish--selected-window) dirvish-hide-details)
|
||||
+1 -1)))))
|
||||
;; HACK: Makes `dirvish-hide-details' accept a list of symbols to instruct
|
||||
;; Dirvish in what contexts `dirvish-hide-details' should be enabled. The
|
||||
;; accepted values are:
|
||||
;; - `dired': when opening a directory directly or w/o Dirvish's full UI.
|
||||
;; - `dirvish': when opening full-frame Dirvish.
|
||||
;; - `dirvish-side': when opening Dirvish in the sidebar.
|
||||
;; REVIEW: Upstream this behavior later. (Maybe with similar treatment for
|
||||
;; `dirvish-hide-cursor'?)
|
||||
(setq dirvish-hide-details '(dirvish dirvish-side))
|
||||
(defadvice! +dired--hide-details-maybe-a (fn &rest args)
|
||||
:around #'dirvish-init-dired-buffer
|
||||
(let ((dirvish-hide-details
|
||||
(if (listp dirvish-hide-details)
|
||||
(cond ((if dirvish--this (memq 'side (dv-type dirvish--this)))
|
||||
(memq 'dirvish-side dirvish-hide-details))
|
||||
((or (null dirvish--this)
|
||||
(null (car (dv-layout dirvish--this))))
|
||||
(memq 'dired dirvish-hide-details))
|
||||
((memq 'dirvish dirvish-hide-details)))
|
||||
dirvish-hide-details)))
|
||||
(apply fn args)))
|
||||
|
||||
(when (modulep! :ui tabs)
|
||||
(after! centaur-tabs
|
||||
|
@ -155,6 +166,20 @@ Fixes #3939: unsortable dired entries on Windows."
|
|||
:n "S" #'dirvish-relative-symlink
|
||||
:n "h" #'dirvish-hardlink))
|
||||
|
||||
;; HACK: Modifies Dirvish to fall back to default `mode-line-format' if
|
||||
;; `dirvish-use-mode-line' is nil, instead of when
|
||||
;; `dirvish-mode-line-format' is nil (since the latter *still* prepends to
|
||||
;; the default `mode-line-format'), and is overall less intuitive.
|
||||
;; REVIEW: Upstream this behavior later.
|
||||
(defadvice! +dired--dirvish-use-modeline-a (fn &rest args)
|
||||
"Change how `dirvish-use-mode-line' and `dirvish-mode-line-format' operate."
|
||||
:around #'dirvish--setup-mode-line
|
||||
(when dirvish-use-mode-line
|
||||
(let ((dirvish--mode-line-fmt
|
||||
(if dirvish-mode-line-format
|
||||
dirvish--mode-line-fmt)))
|
||||
(apply fn args))))
|
||||
|
||||
;; HACK: Kill Dirvish session before switching projects/workspaces, otherwise
|
||||
;; it errors out on trying to delete/change dedicated windows.
|
||||
(add-hook! '(persp-before-kill-functions projectile-before-switch-project-hook)
|
||||
|
@ -165,7 +190,6 @@ Fixes #3939: unsortable dired entries on Windows."
|
|||
(and dirvish--this (selected-window)))))
|
||||
(delete-window win))))
|
||||
|
||||
|
||||
;; HACK: If a directory has a .dir-locals.el, its settings could
|
||||
;; interfere/crash Dirvish trying to preview it.
|
||||
;; REVIEW: Upstream this later.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue