1 ;;; bandali-projectile.el --- bandali's Projectile setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
6 ;; Keywords: convenience
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
23 ;; My Projectile setup.
27 (use-package projectile
30 :bind-keymap
("C-c p" . projectile-command-map
)
34 (defun b/projectile-mode-line-fun
()
35 "Report project name and type in the modeline."
36 (let ((project-name (projectile-project-name))
37 (project-type (projectile-project-type)))
39 projectile-mode-line-prefix
41 (format ":%s" project-type
)
43 (setq projectile-mode-line-function
'b
/projectile-mode-line-fun
)
45 (defun my-projectile-invalidate-cache (&rest _args
)
46 ;; ignore the args to `magit-checkout'
47 (projectile-invalidate-cache nil
))
49 (eval-after-load 'magit-branch
51 (advice-add 'magit-checkout
52 :after
#'my-projectile-invalidate-cache
)
53 (advice-add 'magit-branch-and-checkout
54 :after
#'my-projectile-invalidate-cache
)))
56 (when (featurep 'which-key
)
57 (which-key-add-key-based-replacements
59 "C-c p s" "projectile/search"
60 "C-c p x" "projectile/execute"
61 "C-c p 4" "projectile/other-window"))
63 (projectile-completion-system 'ivy
)
64 (projectile-mode-line-prefix " proj"))
66 (provide 'bandali-projectile
)
67 ;;; bandali-projectile.el ends here