-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templates #1282
base: main
Are you sure you want to change the base?
Templates #1282
Conversation
I am not sure if depending on |
Wow, I like the possibilities very much. code:
I tried quickly:
more feedback:
definitely IMO. (cl-template has 0 dependencies) |
I think the next thing I will make will be a snippets system, which hopefully will cover most of the other features you want. |
Oh, I found the interactive command useful. I think it just needed one or two checks and "message"s more. (yes no need to pull an arrow macro dependency; maybe not use |
Okay, I have added the option to use named templates, if there are multiple templates registered for a pattern, it prompts the user to choose one, otherwise it automatically uses the only one there is. (lem-template:register-templates
(:pattern ".*\.asd"
:name "Basic ASD"
:file (merge-pathnames "templates/asd.clt" (lem-home)))
(:pattern ".*\.asd"
:name "Test ASD"
:file (merge-pathnames "templates/test.asd.clt" (lem-home)))
(:pattern ".*\.lisp"
:file (merge-pathnames "templates/lisp.clt" (lem-home)))) Here there are two named options for Screencast.from.2024-01-29.18-27-33.webmI will spend some time cleaning up and testing more today. |
Added You can use a file, like with templates, or just a string if its small. (register-snippets
(:mode 'lem-lisp-mode:lisp-mode
:name "test"
:string "(message \"testing\")")
(:mode 'lem-lisp-mode:lisp-mode
:name "hi"
:string "(message \"hi\")")
(:mode 'lem-go-mode:go-mode
:name "loop"
:file (merge-pathnames "snippets/loop.go.clt" (lem-home)))
(:mode 'lem-go-mode:go-mode
:name "err"
:file (merge-pathnames "snippets/if-err.go.clt" (lem-home)))) snippets.webm |
Awesome. minor:
|
lem-template
A templating extension to generate boilerplate in new files.
Usage
Here is an example template file that generates a simple
.asd
to help get you started.Assuming this file exists in
~/.config/lem/templates/asd.clt
, you can register it like this:You can create any kind of template you want in the cl-template format,
buffer
andpath
are passed to the template and you can read it with(@ buffer)
etc.Examples
See my templates for more examples, I used the plural
register-templates
to register them like this: