extra stuff

pull/8675/merge^2
mattwparas 2023-08-20 09:34:07 -07:00
parent d3845014ff
commit 4544bffbe9
1 changed files with 16 additions and 0 deletions

View File

@ -71,6 +71,22 @@ to be used as typed commands. For example:
(define (git-add cx) (define (git-add cx)
(shell cx "git" "add" "%")) (shell cx "git" "add" "%"))
;; Functions to assist with the above
(define (editor-get-doc-if-exists editor doc-id)
(if (editor-doc-exists? editor doc-id) (editor->get-document editor doc-id) #f))
(define (current-path cx)
(let* ([editor (cx-editor! cx)]
[focus (editor-focus editor)]
[focus-doc-id (editor->doc-id editor focus)]
[document (editor-get-doc-if-exists editor focus-doc-id)])
(if document (Document-path document) #f)))
``` ```
Now, if you'd like to add the current file you're editing to git, simply type `:git-add` - you'll see the doc pop up with it since we've annotated the function Now, if you'd like to add the current file you're editing to git, simply type `:git-add` - you'll see the doc pop up with it since we've annotated the function