about summary refs log tree commit diff stats
path: root/emacs-prelude/personal/lisp/init-projectile.el
blob: e46e221c2a794854a16ec751ea51068d2e84c6c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(prelude-require-packages '(perspective persp-projectile ripgrep))

(use-package perspective
 :init (persp-mode)
 :custom (persp-modestring-short t))

(use-package persp-projectile)

(use-package projectile
  :diminish
  :config
  (def-projectile-commander-method ?B
    "consult-buffer"
    (progn
      (setq unread-command-events (listify-key-sequence "p "))
      (consult-buffer)))
  (def-projectile-commander-method ?r
    "consult-ripgrep"
    (consult-ripgrep))
  (def-projectile-commander-method ?p
    "DWIM"
    (cond ((> (length (projectile-project-buffer-names)) 4) (projectile-switch-to-buffer)) ;; TODO consult-buffer
          ((> (length (projectile-recentf-files)) 0) (projectile-recentf))
          (t (projectile-find-file))))
  :custom
  (projectile-switch-project-action 'projectile-commander))

(defun projectile-add-new-project (project-root)
  (interactive (list (read-directory-name "Select project directory: " "~/src/"))) ;; TODO var
  (projectile-add-known-project project-root)
  (projectile-persp-switch-project project-root)) ;; TODO var

(provide 'init-projectile)