明天在VS代码段中插入日期
我有一个 alfred noreferrer“> alfred sminippet your to in of Me of Me of Me of Mearly of Alfred noreferrer”> alfred noreferrer 这就是它的外观:
## Week (4/25–4/29)
- [ ]
### Monday Apr 25, 2022
- [ ] Snippet
----
作为参考,这就是我的阿尔弗雷德的定义:
## Week ({date:M/d}–{date +4d:M/d})
- [ ]
### Monday {date}
- [ ] Snippet
----
I have an Alfred Snippet that types the outline of a weekly Markdown checklist for me. Here's what it comes out looking like:
## Week (4/25–4/29)
- [ ]
### Monday Apr 25, 2022
- [ ] Snippet
----
I'd like to move this over to a VS Code Snippet. VS Code defines environment variables like $CURRENT_YEAR
and $CURRENT_MONTH_NAME_SHORT
that can fill out some of this. But for the "Week (4/25-4/29)" line, I'd really like to have the date for the next Friday (usually four days from today). Is there any way to do this with a VS Code snippet?
For reference, this is how my Alfred is defined:
## Week ({date:M/d}–{date +4d:M/d})
- [ ]
### Monday {date}
- [ ] Snippet
----
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用VSC片段,这是不可能的。
使用扩展 file noreferrer“> file模板(v1.10.0)生成日期/时间是
现在
的特定偏移。您必须定义您的首选
dateTimeFormat
设置。定义以下设置(我们具有命名的日期格式:
week-schedule
)是全局或工作空间中
定义以下模板(全局或工作空间中)
可以 .md
它将使用日期和一些(可选)附加文本创建一个文件名。
第一行需要这么长。整个文件名模板必须在第1行中。
模板可以包含VSC摘要和输入字段以及其他一些变量。
编辑
在V1.11.0中有一个命令
templates.pasteTemplate
您可以在其中插入使用键绑定的模板With the VSC snippets it is not possible.
With the extension File Templates (v1.10.0) you can generate dates/times that are a particular offset from
now
.You have to define your preferred
dateTimeFormat
setting.Define the following setting (we have a named date format:
week-schedule
)Can be Global or in your Workspace
Define the following template (Global or in your Workspace)
week-schedule.md
It will create a filename with the dates and some (optional) additional text.
The first line needs to be that long. The whole filename template must be on line 1.
The template can contain VSC snippets and input fields and a few other variables.
Edit
In v1.11.0 there is a command
templates.pasteTemplate
where you can insert a Template with a key binding