perf: optimize tramp + projectile integration
Reduce how much projectile hits the server in TRAMP buffers by: - Not looking for fd/fdfind (just use the VCS-specific commands projectile provides and assume they're present on the remote). - Not walking up the directory tree to display the project name in the mode line. - Reducing TRAMP file-cache misses. - Reducing how chatty tramp is about its connections. Fix #5360
This commit is contained in:
parent
44412955cc
commit
0b5243c12c
2 changed files with 24 additions and 5 deletions
|
@ -411,6 +411,16 @@ files, so this replace calls to `pp' with the much faster `prin1'."
|
|||
(server-start)))
|
||||
|
||||
|
||||
(after! tramp
|
||||
(setq remote-file-name-inhibit-cache 60
|
||||
tramp-completion-reread-directory-timeout 60
|
||||
tramp-verbose 1
|
||||
vc-ignore-dir-regexp (format "%s\\|%s\\|%s"
|
||||
vc-ignore-dir-regexp
|
||||
tramp-file-name-regexp
|
||||
"[/\\\\]node_modules")))
|
||||
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
|
|
|
@ -36,7 +36,15 @@ debian, and derivatives). On most it's 'fd'.")
|
|||
projectile-kill-buffers-filter 'kill-only-files
|
||||
projectile-known-projects-file (concat doom-cache-dir "projectile.projects")
|
||||
projectile-ignored-projects '("~/")
|
||||
projectile-ignored-project-function #'doom-project-ignored-p)
|
||||
projectile-ignored-project-function #'doom-project-ignored-p
|
||||
|
||||
;; The original `projectile-default-mode-line' can be expensive over
|
||||
;; TRAMP, so we gimp it in remote buffers.
|
||||
projectile-mode-line-function
|
||||
(lambda ()
|
||||
(if (file-remote-p default-directory)
|
||||
(projectile-default-mode-line)
|
||||
"")))
|
||||
|
||||
(global-set-key [remap evil-jump-to-tag] #'projectile-find-tag)
|
||||
(global-set-key [remap find-tag] #'projectile-find-tag)
|
||||
|
@ -147,13 +155,14 @@ c) are not valid projectile projects."
|
|||
;; HACK Don't rely on VCS-specific commands to generate our file lists. That's
|
||||
;; 7 commands to maintain, versus the more generic, reliable and
|
||||
;; performant `fd' or `ripgrep'.
|
||||
(defadvice! doom--only-use-generic-command-a (vcs)
|
||||
(defadvice! doom--only-use-generic-command-a (fn vcs)
|
||||
"Only use `projectile-generic-command' for indexing project files.
|
||||
And if it's a function, evaluate it."
|
||||
:override #'projectile-get-ext-command
|
||||
(if (functionp projectile-generic-command)
|
||||
:around #'projectile-get-ext-command
|
||||
(if (and (functionp projectile-generic-command)
|
||||
(not (file-remote-p default-directory)))
|
||||
(funcall projectile-generic-command vcs)
|
||||
projectile-generic-command))
|
||||
(funcall fn vcs)))
|
||||
|
||||
;; `projectile-generic-command' doesn't typically support a function, but my
|
||||
;; `doom--only-use-generic-command-a' advice allows this. I do it this way so
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue