Skip to content

Instantly share code, notes, and snippets.

@sathishmanohar
Forked from idcrook/neotree-project-dir.el
Created November 3, 2022 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sathishmanohar/6db14b6e5bfb3dd1ebe42731b735986c to your computer and use it in GitHub Desktop.
Save sathishmanohar/6db14b6e5bfb3dd1ebe42731b735986c to your computer and use it in GitHub Desktop.
emacs neotree and projectile: sync with projectile
;; NeoTree can be opened (toggled) at projectile project root
(defun 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."))))
;; need another one for python stuff, since this gets re-bound
(global-set-key (kbd "C-c C-p") 'neotree-project-dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment