Variables
VS Code Stanard Variables
Template Variables
Dendron supports various template variables.
- For inserting the current date and time:
- CURRENT_YEAR: The current year
- CURRENT_MONTH: The month as two digits (example '02')
- CURRENT_DAY: The day of the month as two digits (example '08')
- CURRENT_HOUR: The current hour in 24-hour clock format
- CURRENT_MINUTE: The current minute as two digits
- CURRENT_SECOND: The current second as two digits
VS Code default variables
The following variables can be used:
TM_SELECTED_TEXT
The currently selected text or the empty stringTM_CURRENT_LINE
The contents of the current lineTM_CURRENT_WORD
The contents of the word under cursor or the empty stringTM_LINE_INDEX
The zero-index based line numberTM_LINE_NUMBER
The one-index based line numberTM_FILENAME
The filename of the current documentTM_FILENAME_BASE
The filename of the current document without its extensionsTM_DIRECTORY
The directory of the current documentTM_FILEPATH
The full file path of the current documentRELATIVE_FILEPATH
The relative (to the opened workspace or folder) file path of the current documentCLIPBOARD
The contents of your clipboardWORKSPACE_NAME
The name of the opened workspace or folderWORKSPACE_FOLDER
The path of the opened workspace or folder
For inserting the current date and time:
CURRENT_YEAR
The current yearCURRENT_YEAR_SHORT
The current year's last two digitsCURRENT_MONTH
The month as two digits (example '02')CURRENT_MONTH_NAME
The full name of the month (example 'July')CURRENT_MONTH_NAME_SHORT
The short name of the month (example 'Jul')CURRENT_DATE
The day of the month as two digits (example '08')CURRENT_DAY_NAME
The name of day (example 'Monday')CURRENT_DAY_NAME_SHORT
The short name of the day (example 'Mon')CURRENT_HOUR
The current hour in 24-hour clock formatCURRENT_MINUTE
The current minute as two digitsCURRENT_SECOND
The current second as two digitsCURRENT_SECONDS_UNIX
The number of seconds since the Unix epoch
Example
Today is {{ CURRENT_YEAR }}.{{ CURRENT_MONTH }}.{{ CURRENT_DAY }},
output:
Today is 2022.01.04
Template Variable replacement
For replacing the standard variables inside the dendron template files
https://wiki.dendron.so/notes/GelEQPZrSgr3CK9y10Nrg/#template-variables
VSCode Snippet Tricks
- You can set a default value for a variable by using a colon (:).
Example:
- The DUE: property in the below snippet defaults to the current current month, date, hour but can be edited fairly quick
"TODO": {
"prefix": "stodo",
"body": [
"- [ ] ${1:Enter Task}",
"- **CAPTURED:** ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}-08:00",
"- **DUE:** ${CURRENT_YEAR}-${2:${CURRENT_MONTH}}-${3:${CURRENT_DATE}}T${4:${CURRENT_HOUR}}:${5:${CURRENT_MINUTE}}:00-08:00",
"- **PRIORITY:** ${6|HIGH,MEDIUM,LOW|}",
"- **STATUS:** ${7|TODO,WAITING,IN PROGRESS,DONE|}",
"- **NOTES:** ",
" - $0",
],
"description": "Capture new TODO"
}
- You can set dropdown values for a variable using a pipe (|).
Example:
"Context Switch": {
"prefix": "scontext",
"body": [
"- **TYPE:** ${1|COMMS,SUPPORT,RESEARCH,MEETING,DEVELOPMENT,TESTING,VALIDATION,CI/CD,PROJECT MGMT,CONSULTING,DOCUMENTATION,ADMINISTRATION,TRAINING,BREAK|}",
"- **PROJECT:** ${2|PROJ1,PROJ2|}",
"- **TOOLS:** ${3|N/A,PYTHON,AZURE,POWER APPS,POWER AUTOMATE,POWER BI,SHAREPOINT,DENDRON|}",
"- **START:** ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:{$CURRENT_MINUTE}:${CURRENT_SECOND}-08:00",
"- **END:** ",
"- **DURATION:** ",
"- **NOTES:** ",
" - $0",
"---"
],
"description": "Capture new context switch"
}
Backlinks