summary refs log tree commit diff
path: root/emacs.d/modules/module-project.el
blob: 1dd46cf8b24063ee93918cf2814e4ca3463441a9 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
(require 'config-env)
(require 'config-package)

(defhydra hydra-projectile-other-window (:color teal)
  "projectile-other-window"
  ("f"  projectile-find-file-other-window        "file")
  ("g"  projectile-find-file-dwim-other-window   "file dwim")
  ("d"  projectile-find-dir-other-window         "dir")
  ("b"  projectile-switch-to-buffer-other-window "buffer")
  ("q"  nil                                      "cancel" :color blue))

(defhydra hydra-projectile (:color blue :hint nil)
  "
     PROJECTILE: %(projectile-project-root)
     Find File            Search/Tags          Buffers                Cache
------------------------------------------------------------------------------------------
_s-f_: file            _a_: ag                _i_: Ibuffer           _c_: cache clear
 _ff_: file dwim       _g_: update gtags      _b_: switch to buffer  _x_: remove known project
 _fd_: file curr dir   _o_: multi-occur     _s-k_: Kill all buffers  _X_: cleanup non-existing
  _r_: recent file                                               ^^^^_z_: cache current
  _d_: dir
"
  ("a"   projectile-ag)
  ("b"   projectile-switch-to-buffer)
  ("c"   projectile-invalidate-cache)
  ("d"   projectile-find-dir)
  ("s-f" projectile-find-file)
  ("ff"  projectile-find-file-dwim)
  ("fd"  projectile-find-file-in-directory)
  ("g"   ggtags-update-tags)
  ("s-g" ggtags-update-tags)
  ("i"   projectile-ibuffer)
  ("K"   projectile-kill-buffers)
  ("s-k" projectile-kill-buffers)
  ("m"   projectile-multi-occur)
  ("o"   projectile-multi-occur)
  ("s-p" projectile-switch-project "switch project")
  ("p"   projectile-switch-project)
  ("s"   projectile-switch-project)
  ("r"   projectile-recentf)
  ("x"   projectile-remove-known-project)
  ("X"   projectile-cleanup-known-projects)
  ("z"   projectile-cache-current-file)
  ("`"   hydra-projectile-other-window/body "other window")
  ("q"   nil "cancel" :color blue))

(use-package projectile
  :diminish projectile-mode
  :bind-keymap ("C-c p" . projectile-command-map)
  :bind (("M-p" . hydra-projectile/body))

  :init
  (add-hook 'after-init-hook #'projectile-mode)

  :config
  (setq projectile-switch-project-action 'projectile-dired
        projectile-enable-caching t
        projectile-completion-system 'ivy
        projectile-known-projects-file (expand-file-name "var/projectile-bookmarks.eld" user-emacs-directory)
        projectile-cache-file (expand-file-name "var/projectile.cache" user-emacs-directory)
        projectile-globally-ignored-directories (append fcuny-projects-ignored-dirs
                                                        projectile-globally-ignored-directories)
        projectile-globally-ignored-files (append fcuny-projects-ignored-files
                                                  projectile-globally-ignored-files)))

(use-package ag
  :commands (counsel-ag ag)
  :bind (:map ag-mode-map
              ("p" . compilation-previous-error)
              ("n" . compilation-next-error)
              ("N" . compilation-next-file)
              ("P" . compilation-previous-file))
  :config
  (setq ag-highlight-search t
        ag-reuse-buffers t
        ag-reuse-window t))

(provide 'module-project)