8.0 KiB
Using Foam with VS Code Features
Foam builds on Visual Studio Code's powerful editing capabilities, integrating seamlessly with VS Code's native features to create a comprehensive knowledge management experience. This guide explores how to leverage VS Code's built-in functionality alongside Foam.
Keyboard shortcuts
VS Code supports various keyboard shortcuts, the most important for us are:
| Shortcut | Action |
|---|---|
cmd+N |
create a new file |
cmd+S |
save the current file |
cmd+O |
open a file |
cmd+P |
use quickpick to open a file |
alt+D |
open the daily note for today |
alt+H |
open the daily note for a day |
cmd+shift+P |
invoke a command (see below) |
For more information, see the VS Code keyboard cheat sheets, where you can also see how to customize your keybindings.
Commands
Commands make VS Code extremely powerful.
To invoke a command, press cmd+shift+P and select the command you want to execute.
For example, to see the Foam graph:
- press
cmd+shift+Pto open the command bar - start typing
show graph - select the
Foam: Show Graphcommand
And watch the magic unfold.
To see all foam commands, type "foam" in the command bar. For more information on commands, see commands on the VS Code site.
If you want to learn more about VS Code, check out their website.
Panels
Foam integrates with VS Code panels to provide insights into individual notes and the whole knowledge base.
Foam: links: Shows all notes that link to and from the currently active note, helping you understand connections and navigate your knowledge graphFoam: Orphaned Notes: Displays notes that have no incoming or outgoing links, helping you identify isolated content that might need better integrationTag Explorer: Shows all tags used across your workspace in a hierarchical view, see [tags] for more information on tagsFoam: Graph: Visual representation of your note connections (also available as a separate graph view)
Styling and Themes
VS Code is very configurable when it comes to themes and style. Find your ideal set up by running the command Color Theme.
For more information see the VS Code documentation.
Multi-Cursor Editing
Edit multiple locations simultaneously for efficient note management:
Basic Multi-Cursor:
Alt+Click/Option+Click- Add cursor at click locationCtrl+Alt+Down/Cmd+Option+Down- Add cursor belowCtrl+Alt+Up/Cmd+Option+Up- Add cursor aboveCtrl+D/Cmd+D- Select next occurrence of wordCtrl+Shift+L/Cmd+Shift+L- Select all occurrences
Bulk wikilink creation:
- Select a word (e.g., "Python")
- Press
Ctrl+Shift+Lto select all occurrences - Type
[[]]to wrap all instances - Arrow key to position cursor inside brackets
Find and Replace
Powerful search and replace for note maintenance:
Basic Find/Replace:
Ctrl+F/Cmd+F- Find in current fileCtrl+H/Cmd+H- Replace in current fileCtrl+Shift+F/Cmd+Shift+F- Find across workspaceCtrl+Shift+H/Cmd+Shift+H- Replace across workspace
Text Folding
Organize long notes with collapsible sections:
Folding Controls:
- Click fold icons in the gutter next to headings
Ctrl+Shift+[/Cmd+Option+[- Fold current sectionCtrl+Shift+]/Cmd+Option+]- Unfold current sectionCtrl+K Ctrl+0/Cmd+K Cmd+0- Fold allCtrl+K Ctrl+J/Cmd+K Cmd+J- Unfold all
File Management
Explorer Integration
Leverage VS Code's file explorer for note organization:
File Operations:
- Drag and drop files to reorganize
- Right-click context menus for quick actions
- New file/folder creation with shortcuts
- Bulk selection with Ctrl+Click / Cmd+Click
Quick File Actions:
F2- Rename file (Foam updates links automatically)Delete- Move to trashCtrl+C/Cmd+CthenCtrl+V/Cmd+V- Copy/paste files- Right-click → Reveal in Explorer/Finder - Open in file system
Quick Open
Rapid file navigation for large knowledge bases:
Quick Open Commands:
Ctrl+P/Cmd+P- Go to fileCtrl+Shift+O/Cmd+Shift+O- Go to symbol (headings in Markdown)Ctrl+T/Cmd+T- Go to symbol in workspaceCtrl+G/Cmd+G- Go to line number
Search Patterns:
# Go to File (Ctrl+P)
machine # Finds "machine-learning.md"
proj alpha # Finds "project-alpha.md"
daily/2025 # Finds files in daily/2025 folder
# Go to Symbol (Ctrl+Shift+O)
@introduction # Jump to "Introduction" heading
@#setup # Jump to "Setup" heading
:50 # Go to line 50
Search and Discovery
Global Search
Find content across your entire knowledge base:
Search Interface (Ctrl+Shift+F / Cmd+Shift+F):
- Search box - Enter your query
- Replace box - Toggle with replace arrow
- Include/Exclude patterns - Filter by file types or folders
- Match case - Case-sensitive search
- Match whole word - Exact word matching
- Use regular expression - Advanced pattern matching
Timeline View
Track changes to your notes over time:
Accessing Timeline:
- Open Explorer panel
- Expand "Timeline" section at bottom
- Select a file to see its change history
- Click timeline entries to see diff views
Timeline Features:
- Git commits show when notes were changed
- File saves track editing sessions
- Diff views highlight what changed
- Restore points for recovering previous versions
Outline View
Navigate long notes with hierarchical structure:
Outline Panel:
- Enable in Explorer (expand "Outline" section)
- Shows heading hierarchy for current note
- Click headings to jump to sections
- Collapse/expand sections in outline
Version Control Integration
Git Integration
Track changes to your knowledge base:
Source Control Panel:
- View changes - See modified files
- Stage changes - Click
+to stage files - Commit changes - Enter message and commit
- Sync changes - Push/pull from remote
Git Workflow for Notes:
- Write and edit your notes
- Review changes in Source Control panel
- Stage relevant files for commit
- Write meaningful commit message
- Commit and push to backup/share
Useful Git Features:
- Diff view - See exactly what changed
- File history - Track note evolution over time
- Branch management - Experiment with different organization approaches
- Merge conflicts - Resolve when collaborating
Markdown Features
Preview Integration
View formatted notes alongside editing:
Preview Commands:
Ctrl+Shift+V/Cmd+Shift+V- Open previewCtrl+K V/Cmd+K V- Open preview to side- Preview lock - Pin preview to specific file
Diagrams (with Mermaid extension):
```mermaid
graph TD
A[Foam Workspace] --> B[Notes]
A --> C[Templates]
A --> D[Assets]
B --> E[Wikilinks]
B --> F[Tags]
E --> G[Graph View]
```
Extension Ecosystem
Extend Foam's capabilities with complementary extensions. Look for them in the VS Code Marketplace.
What's Next?
With VS Code mastery, explore advanced Foam topics:
- [recommended-extensions] - See complementary extensions to improve your note taking experience
- [publishing] - Share your knowledge base