Projectile requires a lot of file system interaction to stay up to date, this does not work well when accessing remote files and causes massive slowdowns when used over a less than ideal SSH connection. My solution based on a comment regarding this issue has been to deactivate projectile on remote files, sadly its not just files but also dired buffers which suffer so a small addition is needed to the solution in the comment adding dired buffers to the list of things dired should not be enabled for.
(defadvice projectile-on (around exlude-tramp activate) "This should disable projectile when visiting a remote file" (unless (--any? (and it (file-remote-p it)) (list (buffer-file-name) list-buffers-directory default-directory dired-directory)) ad-do-it))
furthermore to avoid unneeded calculation of the current project the projectile modeline needs to be set static.
(setq projectile-mode-line "Projectile")
with this in place projectile works nicely locally and remote file interactions are as quick as they can be.
4 thoughts on “Projectile and TRAMP”
great ! I’ve posted it in https://github.com/bbatsov/projectile/issues/1232
LikeLiked by 1 person
It looks like “projectile-on” method is not exists in curent version of projectile, we can add advice on “projectile-project-root” function instead:
(defun my/ad-projectile-project-root (orig-fun &optional dir)
“This should disable projectile when visiting files with ftp tramp.”
(let ((dir (file-truename (or dir default-directory))))
(unless (file-remote-p dir)
(funcall orig-fun dir))))
(advice-add ‘projectile-project-root :around #’my/ad-projectile-project-root)
projectile-project-root makes sense I think. 👍