about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/glittershark/emacs.d/grid.el22
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"