Modifiers
Modifiers allow you to change the behavior of lookup.
You can toggle a modifier in three different ways:
- Using the Lookup View that appears in the explorer when a note lookup is active
- Clicking on the respective modifier icons in the lookup bar
- Passing custom arguments to
dendron.lookupNote
when defining a custom keyboard shortcut inkeybindings.json
Overview
Here is a list of modifiers that are available for lookup:
- filter
- selection
- note
- split
- effect
- other
Filter modifier
directChildOnly
Description
By default, unless you are at the root of your workspace, Dendron performs a fuzzy search of all notes that match your current hierarchy prefix.
This is useful to see your entire sub-tree in one glance but can be overwhelming if you have a lot of notes.
The directChildOnly
filter is a toggle that limits lookup depth to one level deeper than the current value. It will also filter out stub notes.
This filter is useful when exploring notes one level of depth at a time.
Enabling directChildOnly
filter
There are two ways to enable this filter:
- Toggle the icon to enable.
- Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json.
* Use `Preference: Open Keyboard Shortcuts (JSON)` to open.
*/
[
...
{
"key": "{desired keybinding}",
"command": "dendron.lookupNote",
"args": {
"filterMiddleWare": ["directChildOnly"]
}
},
...
]
Demonstration
selectionType
The selectionType
modifiers determine the behavior of selected text in the active editor when looking up a note.
The default selectionType
set by lookup is selectionExtract
.
There are currently two types that you can choose: selectionExtract
and selection2link
. You can only apply one at a time.
selectionExtract
Description
If the selectionExtract
modifier is on, selection in the active text editor will be extracted to be appended to the note that you looked up.
If you look up an existing note, the selection will be removed and appended to the destination. If you look up a new note, the selection will be used as the initial body of the new note.
If the source of this selection is a non-Dendron file, the selection will not be removed from the source, but will still use it to prefill the new note.
If leaveTrace is set to true, a note reference to the extracted and moved text will be created in the place of the selection.
Enabling selectionExtract
modifier
There are three ways to enable selectionExtract
:
-
Toggle the icon to enable.
-
Configure default lookup selection type as below:
<!-- in dendron.yml --> ... lookup: note: selectionType: selectionExtract ...
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "selectionType": "selectionExtract" } }, ... ]
selection2link
Description
If the selection2link
modifier is on, selection in the active text editor will be used to create the note path.
The note path will be created with the following pattern:
{current-path}.{slug-of-selection}
A slug is the human readable portion of an url
Enabling selection2link
modifier
There are three ways to enable selectionExtract
:
-
Toggle the icon to enable.
-
Configure default lookup selection type as below:
# in dendron.yml ... lookup: note: selectionType: selection2link ...
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "selectionType": "selection2link" } }, ... ]
Demonstration
noteType
The note type modifiers let you modify the note path in a special way.
There are two kinds of note type modifiers: journal
and scratch
. You can only select one at a time.
journal
Description
If the journal
modifier is on, the lookup note path will be determined by the journal
configuration in dendron.yml
.
You can read more about the journal note here
Enabling journal
modifier
There are two ways to enable the journal
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "noteType": "journal" } }, ... ]
scratch
Description
If the scratch
modifier is on, the lookup note path will be determined by the scratch
configuration in dendron.yml
.
You can read more about the scratch note here
Enabling scratch
modifier
There are two ways to enable the scratch
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "noteType": "scratch" } }, ... ]
splitType
This modifier type allows you to select which column of the editor you want the lookup result to be opened.
horizontal
Description
If the horizontal
modifier is on, the result of the lookup will be opened in the column directly right of the active editor.
This is a horizontal split.
This will work for both existing notes and creating new notes.
Enabling the horizontal
modifier
There are two ways to enable the horizontal
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "splitType": "horizontal" } }, ... ]
Demonstration
effectType
Effect type modifiers are a collection of modifiers that are not covered by the aforementioned modifier types.
There are currently three effect type modifiers:
multiSelect
, copyNoteLink
and vaultSelectionMode
.
All three of these modifiers can work in any combination.
multiSelect
Description
If the multiSelect
modifier is on, you can select multiple items in the lookup bar. This lets you open multiple notes at once.
Enabling multiSelect
modifier
There are two ways to enable the multiSelect
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "multiSelect": true } }, ... ]
Demonstration
copyNoteLink
Description
If the copyNoteLink
modifier is on, link(s) to the result of the lookup will be copied into your clipboard once the lookup has been executed.
If combined with the multiSelect
modifier, you can copy multiple links at once.
This behavior is triggered after the lookup has been complete, so it will also work for newly created notes.
Enabling copyNoteLink
modifier
There are two ways to enable the copyNoteLink
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "copyNoteLink": true } }, ... ]
vaultSelectionMode
Description
The vaultSelectionMode
modifier is a multimode modifier that determines how lookup should select vaults when creating new notes.
This mode is disabled by default, and is only configurable if confirmVaultOnCreate
is set to true in dendron.yml
# in dendron.yml
...
confirmVaultOnCreate: true
...
Once it's visible, you can choose between smart
mode and alwaysPrompt
mode.
smart
mode will try to suggest which vault should be used using the context of the current note / active editor state.
alwaysPrompt
mode will always prompt before creating a new note.
Enabling vaultSelectionMode
modifier
There are two ways to enable the vaultSelectionMode
modifier:
-
Toggle the icon to enable.
-
Pass it as an argument to a keyboard shortcut as below:
/* in keybindings.json. * Use `Preference: Open Keyboard Shortcuts (JSON)` to open. */ [ ... { "key": "{desired keybinding}", "command": "dendron.lookupNote", "args": { "vaultSelectionMode": 1 // 1: smart mode, 2: alwaysPrompt } }, ... ]
other
These modifiers are not exposed to a togglable button and only able to set programatically (by passing it as an argument).
noConfirm
Description
If set, this will select the first option from lookup and execute immediately without confirmation.
Enabling noConfirm
modifier.
noConfirm
modifier is only configurable by passing it as an argument as below:
```json
/* in keybindings.json.
* Use `Preference: Open Keyboard Shortcuts (JSON)` to open.
*/
[
...
{
"key": "{desired keybinding}",
"command": "dendron.lookupNote",
"args": {
"noConfirm": true
}
},
...
]
initialValue
Description
If set, it will be used as a custom initial value for lookup instead of the current active note's path.
Enabling initialValue
modifier.
initialValue
modifier is only conmfigurable by passing it as an argument as below:
```json
/* in keybindings.json.
* Use `Preference: Open Keyboard Shortcuts (JSON)` to open.
*/
[
...
{
"key": "{desired keybinding}",
"command": "dendron.lookupNote",
"args": {
"initialValue": "foo"
}
},
...
]
```
Examples
Below are some examples of keyboard shortcut settings. Use them as a starting point to customize various flavors of lookup to your liking.
Please refer to the official documentation about setting key bindings for a full reference.
Lookup with a frequently used initial value.
If you find yourself looking up a certain hierarchy a lot, it could be useful to set a keybinding that will automatically prefill the initial value with the frequently used hierarchy:
[
{
...
},
{ // lookup `recipe.` hierarchy
"key": "alt+l r",
"command": "dendron.lookupNote",
"args": {
"initialValue": "recipe."
}
},
{ // lookup `meeting.{journal-format}.` hierarchy
"key": "alt+l m",
"command": "dendron.lookupNote",
"args": {
"initialValue": "meet",
"noteType": "journal"
}
},
{
...
}
]
Open a fixed note that you reference a lot to the side.
If you have a note that has a fixed hierarchy that you frequently look up while working on other notes, it is useful to have it open to the side (horizontal split) so that you can read it at the same time.
For example, one could have a single todo list that they use as a source of truth for everything that they need to do. (We are assuming this is the single file that holds all todo items.)
[
{
...
},
{ // open the note `todo` to the side, without confirmation.
"key": "alt+l 0",
"command": "dendron.lookupNote",
"args": {
"initialValue": "todo",
"splitType": "horizontal",
"noConfirm": true
}
},
{
...
}
]
Look up a note that you want to reference in another note, open it to the side.
When working on a note, you may want to reference another note by adding a link to it. You may also want to read through that reference beforehand.
In this case, it may be useful to open the note you want to reference to the side, and also automatically copy the note link to the clipboard so that you can seamlessly go back to your original note and insert it.
[
{
...
},
{ // look up note, then open it to the side. also copy selected note's link.
"key": "alt+l .",
"command": "dendron.lookupNote",
"args": {
"splitType": "horizontal",
"copyNoteLink": true
}
},
{ // same as above, but with multi select.
"key": "alt+l >",
"command": "dendron.lookupNote",
"args": {
"splitType": "horizontal",
"copyNoteLink": true,
"multiSelect": true
}
},
{
...
}
]
Backlinks