diff --git a/emacs/init.org b/emacs/init.org index 9d6ae88..5af4c66 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1321,13 +1321,13 @@ Olivetti is a minor mode for a nice writing environment. * Winum This package includes functions to switch windows by number. #+BEGIN_SRC emacs-lisp - (defun winum-assign-0-to-neotree () - (when (string-match-p (buffer-name) ".*\\NeoTree\\*.*") 10)) + (defun winum-assign-0-to-dired-sidebar () + (when (equal major-mode 'dired-sidebar-mode) 10)) (use-package winum :config (winum-mode) - (add-to-list 'winum-assign-functions #'winum-assign-0-to-neotree) + (add-to-list 'winum-assign-functions #'winum-assign-0-to-dired-sidebar) (leader-def-key "0" 'winum-select-window-0-or-10) (leader-def-key "1" 'winum-select-window-1) (leader-def-key "2" 'winum-select-window-2) @@ -1347,52 +1347,6 @@ I don't want which-key display "lambda" for the descriptions of these, so set a (push '((nil . "select-window-[1-9]") . t) which-key-replacement-alist) #+END_SRC -* NeoTree -A package to browse files in a tree view -#+BEGIN_SRC emacs-lisp - (use-package neotree - :straight (neotree :host github :repo "jaypei/emacs-neotree" :branch "dev") - :commands (neotree-project-dir neotree-toggle) - :init - (leader-def-key "d" 'neotree-project-dir) - :general - ('normal neotree-mode-map "SPC" leader-map) - :config - (defun neotree-project-dir () - "Open NeoTree using the git root." - (interactive) - (let ((project-dir (projectile-project-root)) - (file-name (buffer-file-name)) - (cw (selected-window))) - (neotree-toggle) - (if project-dir - (if (neo-global--window-exists-p) - (progn - (neotree-dir project-dir) - (neotree-find file-name)) - (message "Could not find git project root."))) - (select-window cw t))) - (setq neo-smart-open nil - neo-force-change-root t - neo-show-hidden-files nil - neo-toggle-window-keep-p t - neo-theme (if (display-graphic-p) 'icons 'arrow) - neo-autorefresh t - projectile-switch-project-action 'neotree-project-action)) - - (use-package all-the-icons - :after (neotree)) -#+END_SRC - -And while we're here let's enable all-the-icons for dired as well: -#+BEGIN_SRC emacs-lisp - (use-package all-the-icons-dired - :after (all-the-icons) - :commands (all-the-icons-dired-mode) - :config - (add-hook 'dired-mode-hook #'all-the-icons-dired-mode)) -#+END_SRC - * Backups and Autosaves Store backups and autosaves in a centralized place. This should really be the default... #+BEGIN_SRC emacs-lisp @@ -4567,13 +4521,35 @@ Or Gnus can read RSS feeds directly: #+END_SRC * Dired -Variables: +** Dired sidebar +#+BEGIN_SRC emacs-lisp + (use-package dired-sidebar + :commands (dired-sidebar-toggle-sidebar) + :init + (leader-def-key "d" #'dired-sidebar-toggle-sidebar) + (add-hook 'dired-sidebar-mode-hook + (lambda () + (unless (file-remote-p default-directory) + (auto-revert-mode)))) + :custom + (dired-sidebar-should-follow-file t) + (dired-sidebar-pop-to-sidebar-on-toggle-open nil)) +#+END_SRC + +** All-the-icons +#+BEGIN_SRC emacs-lisp + (use-package all-the-icons) + (use-package all-the-icons-dired + :hook ((dired-mode . all-the-icons-dired-mode))) +#+END_SRC + + +** Variables #+BEGIN_SRC emacs-lisp (setq dired-dwim-target t) #+END_SRC - -Set up a hydra for dired: +** Dired hydra #+BEGIN_SRC emacs-lisp (use-package dired :straight (:type built-in) @@ -5981,10 +5957,10 @@ A better terminal emulator for Emacs. Replaces ansi-term, not EShell. #+END_SRC * Hide mode line -Does what it says on the box. I use it to hide the mode line in Neotree buffers. +Does what it says on the box. #+BEGIN_SRC emacs-lisp (use-package hide-mode-line - :hook ((neotree-mode imenu-list-major-mode) . hide-mode-line-mode)) + :hook ((dired-sidebar-mode imenu-list-major-mode) . hide-mode-line-mode)) #+END_SRC * show-paren-mode