如题 比如 提取url并打开 org 提取标题并跳转 用模糊搜索补全路径
先用projectile选定一个项目然后打开该项目的文件/magit/文本搜索:
(defvar jester-projectile-project-history nil "projectile project history")
(defun jester/select-project-and-do (action &optional do-what)
"Select a project with projectile, then do `ACTION' in the project.
`ACTION' takes one arg, the selected project dir.
`DO-WHAT' is a string, which is action name displayed by completion interface."
(let ((projects (projectile-relevant-known-projects)))
(if projects
(ivy-read (concat (when do-what (format "%s " do-what)) "in project: ")
projects
:history 'jester-projectile-project-history
:action action)
(user-error "There are no known projects"))))
(defun jester/select-project-and-search ()
"Select a project with projectile, and search it."
(interactive)
(jester/select-project-and-do
(lambda (project-dir) (let ((default-directory project-dir))
(counsel-rg)))
"search"))
(defun jester/select-project-and-magit-status ()
"Select a project with projectile, and open magit status."
(interactive)
(jester/select-project-and-do
(lambda (project-dir) (let ((default-directory project-dir))
(magit-status)))
"magit"))
(defun jester/select-project-and-open-file ()
"Select a project with projectile, and open a file."
(interactive)
(jester/select-project-and-do
(lambda (project-dir) (let ((default-directory project-dir))
(counsel-git)))
"open file")))
1 个赞
内置的project.el有一个
project-switch-project
,可以试试(在master branch),