Fix dired issues
Had a couple of bugs as well as an annoyance by pinning it to "Window 0". Keeping it simple by focusing on `dired` (and mostly letting dirvish just pretty it up) and let it be in a buffer where it works better.
This commit is contained in:
parent
26744944a0
commit
0fcfaebdfe
3 changed files with 9 additions and 29 deletions
|
@ -574,7 +574,7 @@ Browsing on a work laptop is a bit different. According to [[http://ergoemacs.or
|
|||
(osx-browse-url url new-window browser focus)))
|
||||
#+end_src
|
||||
* Dirvish
|
||||
The [[https://github.com/alexluigit/dirvish][dirvish]] project aims to be a better =dired=. And since the =major-mode= is still =dired-mode=, the decades of finger memory isn’t lost. For people starting to use =dired=, most commands are pretty straight-forward (and Prot did a pretty good [[https://www.youtube.com/watch?v=5dlydii7tAU][introduction]] to it), but to remind myself, keep in mind:
|
||||
The [[https://github.com/alexluigit/dirvish][dirvish]] project aims to make a prettier =dired=. And since the =major-mode= is still =dired-mode=, the decades of finger memory isn’t lost. For people starting to use =dired=, most commands are pretty straight-forward (and Prot did a pretty good [[https://www.youtube.com/watch?v=5dlydii7tAU][introduction]] to it), but to remind myself, keep in mind:
|
||||
|
||||
- ~%~ :: will /mark/ a bunch of files based on a regular expression
|
||||
- ~m~ :: marks a single file
|
||||
|
@ -596,12 +596,12 @@ I’m beginning with dirvish to use the [[https://github.com/alexluigit/dirvish/
|
|||
#+begin_src emacs-lisp
|
||||
(use-package dirvish
|
||||
:straight (:host github :repo "alexluigit/dirvish")
|
||||
:init
|
||||
(dirvish-override-dired-mode)
|
||||
:init (dirvish-override-dired-mode)
|
||||
|
||||
:custom
|
||||
(dirvish-quick-access-entries
|
||||
'(("h" "~/" "Home")
|
||||
("e" "~/.emacs.d/" "Emacs user directory")
|
||||
("p" "~/personal" "Personal")
|
||||
("p" "~/projects" "Projects")
|
||||
("t" "~/technical" "Technical")
|
||||
|
@ -624,7 +624,6 @@ I’m beginning with dirvish to use the [[https://github.com/alexluigit/dirvish/
|
|||
;; With `ls' as an alias, and `gls' available on _some_ of my systems, I dont:
|
||||
;; (setq insert-directory-program "gls")
|
||||
;; And instead use Emacs' built-in directory lister:
|
||||
(setq insert-directory-program nil)
|
||||
(setq ls-lisp-use-insert-directory-program nil)
|
||||
(require 'ls-lisp)
|
||||
(setq dired-listing-switches
|
||||
|
@ -632,6 +631,7 @@ I’m beginning with dirvish to use the [[https://github.com/alexluigit/dirvish/
|
|||
|
||||
(set-face-attribute 'dirvish-hl-line nil :background "darkmagenta"))
|
||||
#+end_src
|
||||
|
||||
While in =dirvish-mode=, we can rebind some keys:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package dirvish
|
||||
|
@ -646,6 +646,7 @@ While in =dirvish-mode=, we can rebind some keys:
|
|||
("q" . dirvish-quit)
|
||||
("s" . dirvish-quicksort) ; remapped `dired-sort-toggle-or-edit'
|
||||
("v" . dirvish-vc-menu) ; remapped `dired-view-file'
|
||||
("," . dirvish-dispatch)
|
||||
("TAB" . dirvish-subtree-toggle)
|
||||
("M-f" . dirvish-history-go-forward)
|
||||
("M-b" . dirvish-history-go-backward)
|
||||
|
|
|
@ -587,9 +587,10 @@ Since I wasn’t using all the features that [[https://github.com/bbatsov/projec
|
|||
"p !" '("run cmd in project root" . project-shell-command)
|
||||
"p &" '("run cmd async" . project-async-shell-command)
|
||||
"p a" '("add new project" . project-remember-projects-under)
|
||||
"p d" '("remove known project" . project-forget-project)
|
||||
"p d" '("dired" . project-dired)
|
||||
"p k" '("kill project buffers" . project-kill-buffers)
|
||||
"p p" '("switch project" . project-switch-project)
|
||||
"p x" '("remove known project" . project-forget-project)
|
||||
|
||||
"p f" '("find file" . project-find-file)
|
||||
"p F" '("find file o/win" . project-find-file-other-window)
|
||||
|
|
|
@ -259,7 +259,7 @@ With these helper functions in place, I can create a leader collection for file-
|
|||
"f D" '("delete" . delete-file)
|
||||
"f y" '("yank path" . ha-yank-buffer-path)
|
||||
"f Y" '("yank path from project" . ha-yank-project-buffer-path)
|
||||
"f d" '("dired" . dirvish)
|
||||
"f d" '("dired" . dired)
|
||||
|
||||
"f 1" '("load win-1" . ha-find-file-window-1)
|
||||
"f 2" '("load win-2" . ha-find-file-window-2)
|
||||
|
@ -479,32 +479,11 @@ To jump to a window even quicker, use the [[https://github.com/deb0ch/emacs-winu
|
|||
|
||||
This is nice since the window numbers are always present on a Doom modeline, but they sometime order the window numbers /differently/ than =ace-window=.
|
||||
|
||||
The ~0~ key/window should be always associated with a project-specific tree window of =dired= (or [[Dirvish][Dirvish]]):
|
||||
#+begin_src emacs-lisp
|
||||
(use-package winum
|
||||
:config
|
||||
(winum-mode +1)
|
||||
(add-to-list 'winum-assign-functions
|
||||
(lambda () (when (eq major-mode 'dired-mode) 10))))
|
||||
:config (winum-mode +1))
|
||||
#+end_src
|
||||
|
||||
I’d like to have dirvish show in Window 0:
|
||||
#+begin_src emacs-lisp
|
||||
(defun dirvish-show-or-switch ()
|
||||
"As it says on the tin. Show or start Dirvish.
|
||||
If `divish' is showing, that is, is window 0 is showing,
|
||||
switch to it, otherwise, start 'er up."
|
||||
(interactive)
|
||||
(if (seq-contains (winum--available-numbers) 0)
|
||||
(winum-select-window-0-or-10)
|
||||
(dirvish-side (project-root (project-current)))))
|
||||
#+end_src
|
||||
|
||||
And let’s bind Command-0 to select the window that shows dirvish, or open drvish:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package winum
|
||||
:bind ("s-0" . dirvish-show-or-switch))
|
||||
#+end_src
|
||||
Let's try this out with a Hydra since some I can /repeat/ some commands (e.g. enlarge window). It also allows me to organize the helper text.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package hydra
|
||||
|
@ -569,7 +548,6 @@ Let's try this out with a Hydra since some I can /repeat/ some commands (e.g. en
|
|||
("7" winum-select-window-7)
|
||||
("8" winum-select-window-8)
|
||||
("9" winum-select-window-9)
|
||||
("0" dirvish-dwim)
|
||||
|
||||
;; Extra bindings:
|
||||
("q" nil :color blue)))
|
||||
|
|
Loading…
Reference in a new issue