Projectile
You can use projectile
to manage interactions with files in project directories instead of bookmarks
.
;projectile add .projectile to any file
(use-package projectile
:config
(projectile-global-mode)
(setq projectile-enable-caching t)
;(setq projectile-indexing-method 'alien)
(setq projectile-indexing-method 'hybrid)
;(setq projectile-indexing-method 'native)
(setq projectile-sort-order 'recently-active)
;(setq projectile-switch-project-action 'projectile-dired)
;enable safe local variables
(setq enable-local-variables ':safe)
(setq enable-local-eval ':safe)
(setq projectile-completion-system 'helm)
(setq projectile-switch-project-action 'helm-projectile)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
;:bind ("C-c p" . projectile-command-map)
;(setq projectile-enable-caching t)
(with-eval-after-load 'projectile
(defun projectile-find-file-other-window (&optional invalidate-cache)
"Jump to a project's file using completion and show it in another window. With a prefix arg INVALIDATE-CACHE invalidates the cache first."
(interactive "P")
(progn
(setq split-window-preferred-function 'split-window-sensibly)
(projectile--find-file invalidate-cache #'find-file-other-window)
(setq split-window-preferred-function nil)
);end progn
));end redfined projectile function
(setq projectile-mode-line-function '(lambda () (format " Projectile[%s]" (projectile-project-name))))
);end projectile
Projectile Hydra
;define with-octicon function, to use in engine-mode title
(defun with-octicon (icon str &rest height v-adjust)
(s-concat (all-the-icons-octicon icon :v-adjust (or v-adjust 0) :height (or height 1)) " " str))
(defvar projectile-title (with-octicon "briefcase" "Projectile"))
;generate hydra
(pretty-hydra-define Projectile (:title projectile-title :quit-key "q" :color teal )
("This Frame/Window"
(
("s" helm-projectile-switch-project "Switch Projects")
("f" helm-projectile-find-file "Find File In Project")
("n" helm-projectile-find-file-in-known-projects "Find File In All Projects")
("d" helm-projectile-find-dir "Find Dir In Project")
("p" helm-projectile-find-file-dwim "Find File At Point")
("r" helm-projectile-recentf "Find Recent Files")
("b" helm-projectile-switch-to-buffer "Switch Buffers")
("a" helm-projectile-ag "Search Project")
);end local
"Other Frame/Window"
(
("F" projectile-find-file-other-frame "Find File Other Frame")
("w" projectile-find-file-other-window "Find File Other Window")
("o" projectile-find-other-file-other-window "Find Other Other Window")
("B" projectile-switch-to-buffer-other-window "Switch Buffer Other Window")
("m" projectile-multi-occur "Search Multi Occurances")
);end chrome
"Actions"
(
; ("i" projectile-initiate-project "Add .projectile To Dir")
("c" projectile-edit-dir-locals "Add Project Config")
("I" projectile-invalidate-cache "Clear Projectile Cache")
("S" projectile-run-shell "Run Shell")
("v" projectile-save-project-buffers "Save Project Buffers")
("k" projectile-kill-project-buffers "kill Project Buffers")
("t" projectile-toggle-read-only "Toggle Project Read Only")
("D" projectile-discover-projects-in-directory "Discover Projects Directory")
("h" hydra-helm/body "Return To Helm" :color blue )
("<SPC>" nil "Quit" :color blue )
);end addressbook
);end hydra body
);end pretty-hydra-find-files
(bind-key "<C-m> j" 'Projectile/body)