E5E5 Add projectile-add-and-switch-project command by bbatsov · Pull Request #1973 · bbatsov/projectile · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -5886,6 +5886,15 @@ Return a list of projects removed."
(setq projectile-known-projects (seq-uniq projectile-known-projects))
(projectile-merge-known-projects)))

;;;###autoload
(defun projectile-add-and-switch-project (project-root)
"Add PROJECT-ROOT to the list of known projects and switch to it.
This combines `projectile-add-known-project' and
`projectile-switch-project-by-name' into a single command."
(interactive (list (read-directory-name "Add and switch to project: ")))
(projectile-add-known-project project-root)
(projectile-switch-project-by-name (file-name-as-directory project-root)))

(defun projectile-load-known-projects ()
"Load saved projects from `projectile-known-projects-file'.
Also set `projectile-known-projects'."
Expand Down Expand Up @@ -6365,6 +6374,7 @@ Magit that don't trigger `find-file-hook'."
["Next buffer" projectile-next-project-buffer])
("Projects"
["Add known project" projectile-add-known-project]
["Add and switch to project" projectile-add-and-switch-project]
"--"
["Switch to project" projectile-switch-project]
["Switch to open project" projectile-switch-open-project]
Expand Down
0