Browse code
refactor(emacs): split projectile config to its own file
Showing 5 changed files
- emacs.d/init.el
- emacs.d/lisp/configurations/helm-conf.el
- emacs.d/lisp/configurations/lsp-conf.el
- emacs.d/lisp/configurations/projectile-conf.el
- emacs.d/lisp/utils.el
... | ... |
@@ -234,31 +234,7 @@ |
234 | 234 |
|
235 | 235 |
(load-package-configuration 'evil) |
236 | 236 |
(load-package-configuration 'helm) |
237 |
- |
|
238 |
-(use-package projectile |
|
239 |
- :ensure t |
|
240 |
- :config |
|
241 |
- (setq |
|
242 |
- ;; projectile-enable-caching t |
|
243 |
- projectile-generic-command "rg --files -0" |
|
244 |
- ) |
|
245 |
- |
|
246 |
- (projectile-register-project-type |
|
247 |
- 'clojure '("project.clj") |
|
248 |
- :compile "lein uberjar" |
|
249 |
- :test-dir "src/test/") |
|
250 |
- |
|
251 |
- (projectile-register-project-type |
|
252 |
- 'lisp '("*.asd")) |
|
253 |
- |
|
254 |
- (projectile-register-project-type |
|
255 |
- 'npm '("package.json") |
|
256 |
- :compile "npm install" |
|
257 |
- :test "npm test" |
|
258 |
- :run "npm start" |
|
259 |
- :test-suffix ".spec") |
|
260 |
- |
|
261 |
- (define-key evil-normal-state-map "gf" 'project-aware-ffap)) |
|
237 |
+(load-package-configuration 'projectile) |
|
262 | 238 |
|
263 | 239 |
;; slime depends on fwoar-git-repo |
264 | 240 |
(load-package-configuration 'slime) |
... | ... |
@@ -354,20 +330,6 @@ |
354 | 330 |
(define-key global-map "\C-cc" 'org-capture) |
355 | 331 |
(evil-define-key 'visual 'global (kbd "<leader>c") 'org-capture)) |
356 | 332 |
|
357 |
-(use-package org-projectile |
|
358 |
- :ensure t |
|
359 |
- :after company |
|
360 |
- :config |
|
361 |
- (progn |
|
362 |
- (org-projectile-per-project) |
|
363 |
- (setq org-agenda-skip-unavailable-files t) |
|
364 |
- (setq org-projectile-per-project-filepath |
|
365 |
- "notes/README.org") |
|
366 |
- (setq org-agenda-files (append org-agenda-files (org-projectile-todo-files))) |
|
367 |
- (push (org-projectile-project-todo-entry) org-capture-templates) |
|
368 |
- (define-key projectile-mode-map (kbd "C-c c") 'org-capture)) |
|
369 |
- :ensure t) |
|
370 |
- |
|
371 | 333 |
(use-package delight |
372 | 334 |
:ensure t) |
373 | 335 |
|
... | ... |
@@ -406,39 +368,6 @@ |
406 | 368 |
(direnv-mode 1) |
407 | 369 |
(add-hook 'js2-mode-hook 'direnv-mode) |
408 | 370 |
(add-hook 'typescript-mode-hook 'direnv-mode)) |
409 |
- |
|
410 |
-(defun more-than-one-project-file-p () |
|
411 |
- (= (length (projectile-select-files (projectile-current-project-files))) |
|
412 |
- 1)) |
|
413 |
- |
|
414 |
-(defun global-find-known-file ()) |
|
415 |
- |
|
416 |
-(defun helm-find-known-file (&optional arg) |
|
417 |
- "Use projectile with Helm for finding files in project |
|
418 |
- |
|
419 |
-With a prefix ARG invalidates the cache first." |
|
420 |
- (interactive "P") |
|
421 |
- (let ((projectile-enable-caching t)) |
|
422 |
- (if (projectile-project-p) |
|
423 |
- (projectile-maybe-invalidate-cache arg) |
|
424 |
- (unless t |
|
425 |
- (error "You're not in a project")))) |
|
426 |
- (let ((helm-ff-transformer-show-only-basename nil) |
|
427 |
- (helm-boring-file-regexp-list nil)) |
|
428 |
- (helm :sources 'helm-source-projectile-files-in-all-projects-list |
|
429 |
- :buffer (concat "*helm projectile: " |
|
430 |
- (projectile-project-name) |
|
431 |
- "*") |
|
432 |
- :truncate-lines helm-projectile-truncate-lines |
|
433 |
- :prompt (projectile-prepend-project-name "Find file in projects: ")))) |
|
434 |
- |
|
435 |
-(defun project-aware-ffap (&rest args) |
|
436 |
- (interactive "F") |
|
437 |
- (apply (if (and (projectile-project-p) |
|
438 |
- (more-than-one-project-file-p)) |
|
439 |
- 'helm-projectile-find-file-dwim |
|
440 |
- 'find-file-at-point) |
|
441 |
- args)) |
|
442 | 371 |
|
443 | 372 |
|
444 | 373 |
(use-package cl-generic |
... | ... |
@@ -507,8 +436,6 @@ With a prefix ARG invalidates the cache first." |
507 | 436 |
|
508 | 437 |
(use-package ripgrep :ensure t) |
509 | 438 |
|
510 |
-(use-package projectile-ripgrep :ensure t) |
|
511 |
- |
|
512 | 439 |
(use-package scss-mode :ensure t) |
513 | 440 |
|
514 | 441 |
(use-package smartparens :ensure t :ensure t :config |
... | ... |
@@ -557,10 +484,6 @@ With a prefix ARG invalidates the cache first." |
557 | 484 |
:after treemacs evil |
558 | 485 |
:ensure t) |
559 | 486 |
|
560 |
-(use-package treemacs-projectile |
|
561 |
- :after treemacs projectile |
|
562 |
- :ensure t) |
|
563 |
- |
|
564 | 487 |
(use-package treemacs-icons-dired |
565 | 488 |
:after treemacs dired |
566 | 489 |
:ensure t |
... | ... |
@@ -570,10 +493,6 @@ With a prefix ARG invalidates the cache first." |
570 | 493 |
:after treemacs magit |
571 | 494 |
:ensure t) |
572 | 495 |
|
573 |
-(use-package lsp-treemacs |
|
574 |
- :after treemacs lsp |
|
575 |
- :ensure t) |
|
576 |
- |
|
577 | 496 |
(progn ;; emacs-lisp stuff |
578 | 497 |
(modify-syntax-entry ?- "w" emacs-lisp-mode-syntax-table) |
579 | 498 |
(modify-syntax-entry ?_ "w" emacs-lisp-mode-syntax-table) |
... | ... |
@@ -590,11 +509,6 @@ With a prefix ARG invalidates the cache first." |
590 | 509 |
(when (file-exists-p custom-file) |
591 | 510 |
(load-file custom-file)) |
592 | 511 |
|
593 |
-(defun edit-init-el () |
|
594 |
- (interactive) |
|
595 |
- (let ((default-directory *dotfiles-repo*)) |
|
596 |
- (helm-projectile-find-file))) |
|
597 |
- |
|
598 | 512 |
;;(setq gc-cons-threshold (* 100 1024)) |
599 | 513 |
|
600 | 514 |
(unless fwoar.is-ordinary |
... | ... |
@@ -8,7 +8,6 @@ |
8 | 8 |
(when filename |
9 | 9 |
(insert filename)))) |
10 | 10 |
|
11 |
- |
|
12 | 11 |
(use-package helm :ensure t |
13 | 12 |
:custom |
14 | 13 |
(helm-boring-buffer-regexp-list '("\\` " "\\`\\*helm" "\\`\\*Echo Area" "\\`\\*Minibuf" "\\`\\Pfuture")) |
... | ... |
@@ -19,26 +18,12 @@ |
19 | 18 |
(helm-mode) |
20 | 19 |
(global-set-key (kbd "M-x") 'helm-M-x) |
21 | 20 |
(global-set-key (kbd "C-x C-f") 'helm-find-files) |
22 |
- (evil-define-key 'normal 'global (kbd "<leader>f") 'helm-projectile) |
|
23 | 21 |
(evil-define-key 'normal 'global (kbd "<leader>j") 'helm-buffers-list) |
24 | 22 |
(evil-define-key 'normal 'global (kbd "<leader>s") 'helm-occur) |
25 |
- (evil-define-key 'normal 'global (kbd "<leader>S") 'helm-projectile-rg) |
|
26 | 23 |
(define-key helm-map (kbd "C-r") 'fwoar--paste-register-from-helm-current-buffer) |
27 | 24 |
(define-key helm-map (kbd "<right>") 'helm-execute-persistent-action) |
28 |
- (define-key helm-map |
|
29 |
- (kbd "<left>") |
|
30 |
- 'helm-find-files-up-one-level)) |
|
31 |
- |
|
32 |
- |
|
33 |
-(use-package org-projectile-helm |
|
34 |
- :ensure t |
|
35 |
- :after org-projectile helm helm-org |
|
36 |
- :config |
|
37 |
- (define-key projectile-mode-map (kbd "C-c n p") 'org-projectile-helm-template-or-project)) |
|
25 |
+ (define-key helm-map (kbd "<left>") 'helm-find-files-up-one-level)) |
|
38 | 26 |
|
39 |
-(use-package helm-projectile :after helm :ensure t |
|
40 |
- :config |
|
41 |
- (evil-define-key 'normal 'global (kbd "<leader>h") 'helm-projectile-find-file-dwim)) |
|
42 | 27 |
|
43 | 28 |
(use-package helm-ls-git :after helm :ensure t) |
44 | 29 |
(use-package helm-org :after helm :ensure t) |
17 | 21 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,119 @@ |
1 |
+(use-package projectile |
|
2 |
+ :ensure t |
|
3 |
+ :config |
|
4 |
+ (setq |
|
5 |
+ ;; projectile-enable-caching t |
|
6 |
+ projectile-generic-command "rg --files -0" |
|
7 |
+ ) |
|
8 |
+ |
|
9 |
+ (projectile-register-project-type |
|
10 |
+ 'clojure '("project.clj") |
|
11 |
+ :compile "lein uberjar" |
|
12 |
+ :test-dir "src/test/") |
|
13 |
+ |
|
14 |
+ (projectile-register-project-type |
|
15 |
+ 'lisp '("*.asd")) |
|
16 |
+ |
|
17 |
+ (projectile-register-project-type |
|
18 |
+ 'npm '("package.json") |
|
19 |
+ :compile "npm install" |
|
20 |
+ :test "npm test" |
|
21 |
+ :run "npm start" |
|
22 |
+ :test-suffix ".spec") |
|
23 |
+ |
|
24 |
+ (define-key evil-normal-state-map "gf" 'project-aware-ffap) |
|
25 |
+ (projectile-mode 1) |
|
26 |
+ ) |
|
27 |
+ |
|
28 |
+(use-package org-projectile |
|
29 |
+ :ensure t |
|
30 |
+ :after projectile company |
|
31 |
+ :config |
|
32 |
+ (progn |
|
33 |
+ (org-projectile-per-project) |
|
34 |
+ (setq org-agenda-skip-unavailable-files t) |
|
35 |
+ (setq org-projectile-per-project-filepath |
|
36 |
+ "notes/README.org") |
|
37 |
+ (setq org-agenda-files (append org-agenda-files (org-projectile-todo-files))) |
|
38 |
+ (push (org-projectile-project-todo-entry) org-capture-templates) |
|
39 |
+ (define-key projectile-mode-map (kbd "C-c c") 'org-capture)) |
|
40 |
+ :ensure t) |
|
41 |
+ |
|
42 |
+(use-package projectile-ripgrep |
|
43 |
+ :ensure t |
|
44 |
+ :after projectile) |
|
45 |
+ |
|
46 |
+(use-package treemacs-projectile |
|
47 |
+ :after treemacs projectile |
|
48 |
+ :ensure t) |
|
49 |
+ |
|
50 |
+(use-package org-projectile-helm |
|
51 |
+ :ensure t |
|
52 |
+ :after org-projectile helm helm-org |
|
53 |
+ :config |
|
54 |
+ (define-key projectile-mode-map (kbd "C-c n p") 'org-projectile-helm-template-or-project)) |
|
55 |
+ |
|
56 |
+(use-package helm-projectile |
|
57 |
+ :after helm projectile |
|
58 |
+ :ensure t |
|
59 |
+ :config |
|
60 |
+ |
|
61 |
+ (evil-define-key 'normal 'global (kbd "<leader>f") 'helm-projectile) |
|
62 |
+ (evil-define-key 'normal 'global (kbd "<leader>S") 'helm-projectile-rg) |
|
63 |
+ (evil-define-key 'normal 'global (kbd "<leader>h") 'helm-projectile-find-file-dwim)) |
|
64 |
+ |
|
65 |
+(defun more-than-one-project-file-p () |
|
66 |
+ (= (length (projectile-select-files (projectile-current-project-files))) |
|
67 |
+ 1)) |
|
68 |
+ |
|
69 |
+(defun global-find-known-file ()) |
|
70 |
+ |
|
71 |
+(defun helm-find-known-file (&optional arg) |
|
72 |
+ "Use projectile with Helm for finding files in project |
|
73 |
+ |
|
74 |
+With a prefix ARG invalidates the cache first." |
|
75 |
+ (interactive "P") |
|
76 |
+ (let ((projectile-enable-caching t)) |
|
77 |
+ (if (projectile-project-p) |
|
78 |
+ (projectile-maybe-invalidate-cache arg) |
|
79 |
+ (unless t |
|
80 |
+ (error "You're not in a project")))) |
|
81 |
+ (let ((helm-ff-transformer-show-only-basename nil) |
|
82 |
+ (helm-boring-file-regexp-list nil)) |
|
83 |
+ (helm :sources 'helm-source-projectile-files-in-all-projects-list |
|
84 |
+ :buffer (concat "*helm projectile: " |
|
85 |
+ (projectile-project-name) |
|
86 |
+ "*") |
|
87 |
+ :truncate-lines helm-projectile-truncate-lines |
|
88 |
+ :prompt (projectile-prepend-project-name "Find file in projects: ")))) |
|
89 |
+ |
|
90 |
+(defun project-aware-ffap (&rest args) |
|
91 |
+ (interactive "F") |
|
92 |
+ (apply (if (and (projectile-project-p) |
|
93 |
+ (more-than-one-project-file-p)) |
|
94 |
+ 'helm-projectile-find-file-dwim |
|
95 |
+ 'find-file-at-point) |
|
96 |
+ args)) |
|
97 |
+ |
|
98 |
+(defun edit-init-el () |
|
99 |
+ (interactive) |
|
100 |
+ (let ((default-directory *dotfiles-repo*)) |
|
101 |
+ (helm-projectile-find-file))) |
|
102 |
+ |
|
103 |
+(defun helm-projectile-rg () |
|
104 |
+ "Projectile version of `helm-rg'." |
|
105 |
+ (interactive) |
|
106 |
+ (if (require 'helm-rg nil t) |
|
107 |
+ (if (projectile-project-p) |
|
108 |
+ (let ((helm-rg-prepend-file-name-line-at-top-of-matches nil) |
|
109 |
+ (helm-rg-include-file-on-every-match-line t)) |
|
110 |
+ (helm-rg (helm-projectile-rg--region-selection) |
|
111 |
+ nil |
|
112 |
+ (list (projectile-project-root)))) |
|
113 |
+ (error "You're not in a project")) |
|
114 |
+ (when (yes-or-no-p "`helm-rg' is not installed. Install? ") |
|
115 |
+ (condition-case nil |
|
116 |
+ (progn |
|
117 |
+ (package-install 'helm-rg) |
|
118 |
+ (helm-projectile-rg)) |
|
119 |
+ (error "`helm-rg' is not available. Is MELPA in your `package-archives'?"))))) |
... | ... |
@@ -135,24 +135,6 @@ from the selected region." |
135 | 135 |
,@(cdr pck))) |
136 | 136 |
packages))) |
137 | 137 |
|
138 |
-(defun helm-projectile-rg () |
|
139 |
- "Projectile version of `helm-rg'." |
|
140 |
- (interactive) |
|
141 |
- (if (require 'helm-rg nil t) |
|
142 |
- (if (projectile-project-p) |
|
143 |
- (let ((helm-rg-prepend-file-name-line-at-top-of-matches nil) |
|
144 |
- (helm-rg-include-file-on-every-match-line t)) |
|
145 |
- (helm-rg (helm-projectile-rg--region-selection) |
|
146 |
- nil |
|
147 |
- (list (projectile-project-root)))) |
|
148 |
- (error "You're not in a project")) |
|
149 |
- (when (yes-or-no-p "`helm-rg' is not installed. Install? ") |
|
150 |
- (condition-case nil |
|
151 |
- (progn |
|
152 |
- (package-install 'helm-rg) |
|
153 |
- (helm-projectile-rg)) |
|
154 |
- (error "`helm-rg' is not available. Is MELPA in your `package-archives'?"))))) |
|
155 |
- |
|
156 | 138 |
(defmacro fwoar/defvaralias! (var val-var) |
157 | 139 |
`(progn |
158 | 140 |
(setq ,var ,val-var) |
... | ... |
@@ -179,7 +161,6 @@ from the selected region." |
179 | 161 |
|
180 | 162 |
(defun post-init () |
181 | 163 |
;;(centaur-tabs-mode 1) |
182 |
- (projectile-mode 1) |
|
183 | 164 |
(evil-mode 1) |
184 | 165 |
|
185 | 166 |
(setup-indentation) |