diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-06-18T16·58-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-06-18T17·00+0000 |
commit | ca67aa65982211ad57b8bf018190b794dcb74979 (patch) | |
tree | 43d3864cab021a0f0fe86c61cd96dca53edb8493 /users | |
parent | 794441793cbb5e90e465e7aee8978dc8c966398b (diff) |
feat(g/emacs/grid): Allow finding repositories r/1023
Change-Id: Idbc3cc90587a5c64a246e7e2097efcec6cefdc5c
Diffstat (limited to 'users')
-rw-r--r-- | users/glittershark/emacs.d/grid.el | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/users/glittershark/emacs.d/grid.el b/users/glittershark/emacs.d/grid.el index 31c69097c665..ad524504e9a9 100644 --- a/users/glittershark/emacs.d/grid.el +++ b/users/glittershark/emacs.d/grid.el @@ -78,6 +78,22 @@ The bound variable is \"filename\"." (`(,app ,model) (s-lex-format "python/urbint_lib/${app}/models/${model}.py")))))) +(defun projectile-grid-find-repository () + "Find a repository." + (interactive) + (projectile-grid-find-resource + "repository: " + '(("python/urbint_lib/repositories/" + "\\(.+\\)\\.py$") + ("python/urbint_lib/" + "\\(.+\\)/repositories/\\(.+\\).py$")) + (lambda (filename) + (pcase (s-split "/" filename) + (`(,repository) + (s-lex-format "python/urbint_lib/repositories/${repository}.py")) + (`(,app ,repository) + (s-lex-format "python/urbint_lib/${app}/repositories/${repository}.py")))))) + (defun projectile-grid-find-controller () "Find a controller." (interactive) @@ -94,14 +110,16 @@ The bound variable is \"filename\"." (`(,app ,controller) (s-lex-format "backend/src/grid/api/apps/${app}/controllers/${controller}.py")))))) -(defvar projectile-grid-mode-map +(setq projectile-grid-mode-map (let ((map (make-keymap))) (map! (:map map (:leader (:desc "Edit..." :prefix "e" :desc "Model" :n "m" #'projectile-grid-find-model - :desc "Controller" :n "c" #'projectile-grid-find-controller)))))) + :desc "Controller" :n "c" #'projectile-grid-find-controller + :desc "Repository" :n "r" #'projectile-grid-find-repository)))) + map)) (define-minor-mode projectile-grid-mode "Minor mode for finding files in GRID" |