blob: d314c8bf97db324a9de32e301053138f2440d2c8 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
;;; init-projectile.el --- Projectile Configuration File -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(defcustom projectile-default-dir "~/src"
"Starting directory when looking for new projects."
:group 'djm
:type 'directory)
(defcustom projectile-switch-project-command 'projectile-persp-switch-project
"Projectile switch project command."
:group 'djm
:type 'function)
(use-package projectile
:diminish
:after smartrep
:config
(projectile-mode t)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(def-projectile-commander-method ?b
"consult-buffer"
(progn
(setq unread-command-events (listify-key-sequence "p "))
(consult-buffer)))
(def-projectile-commander-method ?B
"Switch to project buffer"
(projectile-switch-to-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))
((> (length (projectile-recentf-files)) 0) (projectile-recentf))
(t (projectile-find-file))))
(defun projectile-open-new-project (project-root)
(interactive (list (read-directory-name "Select project directory: " (file-name-as-directory projectile-default-dir))))
(projectile-add-known-project project-root)
(funcall projectile-switch-project-command project-root))
(smartrep-define-key projectile-mode-map
"C-c p" '(("C-p" . projectile-previous-project-buffer)
("C-n" . projectile-next-project-buffer)))
:bind-keymap ("C-c p" . projectile-command-map)
:bind
(:map projectile-mode-map
("C-c p n" . projectile-open-new-project)
("C-x f" . projectile-recentf))
:custom
(projectile-switch-project-action 'projectile-commander)
(projectile-cache-file (expand-file-name "projectile.cache" save-dir)))
(use-package perspective
:init (persp-mode)
:bind ("C-x C-b" . persp-ibuffer)
:custom (persp-modestring-short t))
(use-package persp-projectile)
(provide 'init-projectile)
;;; init-projectile.el ends here
|