camscortex

Foam Commands

Foam has various commands that you can explore by calling the command palette and typing “Foam”.

In particular, some commands can be very customizable and can help with custom workflows and use cases.

foam-vscode.create-note command

This command creates a note. Although it works fine on its own, it can be customized to achieve various use cases. Here are the settings available for the command:

To customize a command and associate a key binding to it, open the key binding settings and add the appropriate configuration, here are some examples:

{
  "key": "alt+f",
  "command": "foam-vscode.create-note",
  "args": {
    "text": "test note ${FOAM_DATE_YEAR}",
    "notePath": "test note.md",
    "onFileExists": "ask"
  }
}
{
  "key": "alt+g",
  "command": "foam-vscode.create-note",
  "args": {
    "templatePath": ".foam/templates/weekly-note.md",
    "onFileExists": "open"
  }
}

foam-vscode.open-resource command

This command opens a resource.

Normally it receives a URI, which identifies the resource to open.

It is also possible to pass in a filter, which will be run against the workspace resources to find one or more matches.

Examples:

{
  "key": "alt+f",
  "command": "foam-vscode.open-resource",
  "args": {
    "filter": {
      "title": "Weekly Note*"
    }
  }
}