From eb00835f6dc8ba2041c66994c47a0d197fa8df74 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 21 Aug 2022 03:05:28 +0200 Subject: Emacs: Add Neotree --- Emacs.org | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'Emacs.org') diff --git a/Emacs.org b/Emacs.org index c7a67bc..d83c2b4 100644 --- a/Emacs.org +++ b/Emacs.org @@ -614,6 +614,47 @@ #+end_src +** Neotree + +#+begin_src emacs-lisp + + (defun jd/neotree-project-dir () + "Open NeoTree using the git root." + (interactive) + (let ((project-dir (projectile-project-root)) + (file-name (buffer-file-name))) + (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.")))) + + (use-package neotree + :init + (setq neo-theme 'icons) + :config + + (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter) + (evil-define-key 'normal neotree-mode-map (kbd "C-RET") 'neotree-quick-look) + (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) + (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) + (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) + (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle) + (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle)) + +#+end_src + +*** Keybinds + +#+begin_src emacs-lisp + + (jd/leader-key-def + "op" '(jd/neotree-project-dir :which-key "Open neotree")) + +#+end_src + ** Magit #+begin_src emacs-lisp @@ -623,6 +664,7 @@ (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) #+end_src + *** Keybinds #+begin_src emacs-lisp -- cgit v1.2.3