complete-computing-environment/navigating_projects_with_pr...

70 lines
2.7 KiB
Org Mode

:PROPERTIES:
:ID: cce/navigating_projects_with_projectile
:END:
#+TITLE: Navigating Projects With Projectile
#+filetags: :Emacs:CCE:Coding:
#+PROPERTY: header-args :mkdirp yes :results none
#+PROPERTY: header-args:emacs-lisp :tangle projectile.el
#+ARCOLOGY_KEY: cce/projectile
#+ARCOLOGY_ALLOW_CRAWL: t
#+ARROYO_EMACS_MODULE: projectile
#+ARROYO_MODULE_WANTS: cce/deadgrep.org
#+ARROYO_MODULE_WANTS: cce/selectrum_etc.org
#+ARROYO_MODULE_WANTS: cce/hydra.org
#+ARROYO_MODULE_WANTS: cce/emacs_and_the_language_server_protocol.org
Projectile, and =hydra-projectile= are the tools I use to move around a project's source code. Projectile defines a wealth of [[id:a7420bb9-395f-4afa-92fb-8eaa0b8a4cd8][Tool]]s to enable [[id:cce/emacs][Emacs]] to work with all sorts of different code projects, I can't really stress how useful this package is. My hydra uses a lot of functionality from other places, for example [[id:cce/deadgrep][Deadgrep]] and [[id:cce/selectrum_etc][Selectrum, etc]].
#+begin_src emacs-lisp
(provide 'cce/projectile)
(use-package projectile
:after (deadgrep consult)
:diminish
:hook (prog-mode . projectile-mode)
:bind
(:map evil-leader--default-map
("p" . hydra-projectile/body))
("C-x p" . hydra-projectile/body)
:config
(setq projectile-switch-project-action #'projectile-commander)
(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-dired "dired")
("b" projectile-switch-to-buffer-other-window "buffer")
("q" nil "cancel" :color blue))
(defhydra hydra-projectile (:color teal)
"
PROJECTILE: %(projectile-project-root)
Search: [_a_] deadgrep [_A_] consult-rg
Find: [_b_] buffer [_d_] dir [_f_] file
Look: [_i_] ibuffer [_j_] imenu
Fun: [_o_] other win [_l_] lsp [_K_] cleanup
"
("a" deadgrep "rg")
("A" consult-ripgrep "qrg")
("b" projectile-switch-to-buffer "buf")
("d" projectile-dired "dired")
("f" projectile-find-file "file")
("i" projectile-ibuffer "ibuf")
("j" consult-imenu "imenu")
("K" projectile-kill-buffers)
("l" hydra-lsp/body)
("m" magit-project-status)
("P" projectile-switch-project)
("p" projectile-switch-project)
("r" projectile-recentf "recentf")
("x" projectile-remove-known-project)
("X" projectile-cleanup-known-projects)
("z" projectile-cache-current-file)
("o" hydra-projectile-other-window/body "other")
("q" nil "cancel" :color blue)))
#+end_src