# List of commands

Source: https://developers.inkdrop.app/guides/list-of-commands

Inkdrop provides a bunch of commands to allow you to associate arbitrary interactions with the features.
You can bind them with [keystrokes](https://developers.inkdrop.app/modules/keymap-manager), [menu](https://developers.inkdrop.app/modules/menu-manager) and [context menu](https://developers.inkdrop.app/modules/context-menu-manager) from [plugins](https://developers.inkdrop.app/guides/plugin-word-count), [the init file](https://developers.inkdrop.app/guides/the-init-file) or [keymap config file](https://docs.inkdrop.app/manual/customizing-keybindings).
Note that some commands like `core:open-note` require parameters so you have to invoke them programmatically with [CommandRegistry](https://developers.inkdrop.app/modules/command-registry) like so:

```js
inkdrop.commands.dispatch(document.body, 'core:open-note', {
  noteId: 'note:uugSvPq5r'
})
```

## Table of Contents

- [Application commands](#application-commands)
- [Core commands](#core-commands)
- [Telescope commands](#telescope-commands)
- [Sidebar commands](#sidebar-commands)
- [Editor commands](#editor-commands)
- [AI commands](#ai-commands)
- [Table editor commands](#table-editor-commands)
- [Export commands](#export-commands)
- [Import commands](#import-commands)
- [View commands](#view-commands)
- [Window commands](#window-commands)
- [Special commands](#special-commands)

---

## Application commands

Special commands that run in the main process to control the Inkdrop app.
To invoke them, do like so:

```js
import { ipcRenderer } from 'electron'
ipcRenderer.send('command', 'application:about', {})
```

### application:about

Shows a dialog about Inkdrop.

### application:bring-all-windows-to-front

Arranges windows listed in the Window menu in front of all other windows.

### application:check-for-update

Checks for available app updates.

### application:cycle-through-windows

Cycles through open Inkdrop windows.

### application:hide

Hides Inkdrop windows.

### application:hide-other-applications

Hides all apps, except Inkdrop.

### application:inspect

Shows a Developer Tools and inspects an element.

### application:logout

Logs out from the currently authenticated account.

### application:minimize

Minimizes Inkdrop application.

### application:open-preferences

Opens up the preference window.

### application:open-website

Opens up the Inkdrop website.

### application:open-website-signup

Opens up the Inkdrop sign-up page.

### application:quit

Quits the app.

### application:report-issue

Opens up the Inkdrop forum.

### application:show-credits

Opens up the list of software licenses.

### application:unhide-all-applications

Unhides all apps, including Inkdrop.

### application:view-help

Opens up the user manual.

### application:view-api-doc

Opens up the API documentation website.

### application:zoom

Toggles the size and location of the window between its standard state and its user state.

### application:sync-db

Perform data sync from the last checkpointer.

### application:quick-note

Create a note and show it in a separate window.

---

## Core commands

### core:activate-package

Activates the named package.

- **name** (string, required)

  The package name.

### core:activate-themes

Re-applies the currently selected UI and syntax themes.

### core:choose-template

Opens the template picker to apply a template to the current note.
Only available when the editing note is empty and is not in Templates or Trash.

### core:copy

Copy the selected text to clipboard.

### core:copy-image

Copy the target element's image to clipboard.

### core:copy-note-link

Copy links to notes as Markdown links. By default, copy currently selected on the note list.

- **noteId** (string|array)

  (Optional) The ID(s) of the note(s) to process.

### core:copy-note-uri

Copy `inkdrop://` URIs to notes. By default, copy currently selected on the note list.

- **noteId** (string|array)

  (Optional) The ID(s) of the note(s) to process.

### core:copy-link-address

Copy the link address of an `<a>` element under the event target in the preview pane.

### core:copy-preview-selection

Copy the currently selected text in the preview pane to the clipboard.

### core:copy-note-id

Copies the IDs of the selected notes to the clipboard, one per line.

- **noteId** (string | string\[])

  The note ID(s) to copy. Defaults to the notes selected on the note list bar.

### core:copy-notebook-id

Copies a notebook ID to the clipboard.

- **bookId** (string)

  The notebook ID to copy. Defaults to the target element's `data-bookid`, then to the notebook targeted by the context menu.

### core:copy-tag-id

Copies a tag ID to the clipboard.

- **tagId** (string)

  The tag ID to copy. Defaults to the target element's `data-tagid`, then to the tag targeted by the context menu.

### core:cut

Delete the selected text and copy it to clipboard.

### core:deactivate-package

Deactivates the named package, if it is active.

- **name** (string, required)

  The package name.

### core:delete-note

Move notes currently selected on the note list to trash.
If the notes are already in trash, they will be permanently deleted.

### core:delete-notebook

> **Warning:**
>
> It's a private command for now

### core:delete-tag

> **Warning:**
>
> It's a private command for now

### core:duplicate-note

Duplicates notes currently selected on the note list.

### core:emphasize

Emphasize currently selected text.

### core:empty-trash

Empties trash.

### core:filter-notes

Filters current note list items with given keywords.

- **keyword** (string, required)

  The keywords to filter.

### core:filter-by-tag

Adds a filter condition with specified tag.

- **tagId** (string, required)

  The ID of the tag to filter by.

### core:find

Activates the search bar.

### core:find-focus

Moves focus to the search bar.

### core:find-clear

Clears the search bar text.

### core:find-global

Moves focus to the search bar and switch the search scope to global.

- **focus** (boolean)

  Whether to move focus to the search bar. Default: `true`.

### core:focus-next

Moves focus to the next focusable UI component.

### core:focus-note-list-bar

Moves focus to the note list bar.

### core:focus-previous

Moves focus to the previous focusable UI component.

### core:indent

Indents the selected line(s).

### core:insert-code-block

Inserts a code block.

### core:insert-horizontal-rule

Inserts a horizontal rule: `* * *`.

### core:insert-link

Inserts a link.

### core:insert-image

Shows a file picker and inserts the selected image into the editor at the cursor position.

### core:move-notebook

> **Warning:**
>
> It's a private command for now

### core:move-to-notebook

> **Warning:**
>
> It's a private command for now

### core:navigate

Moves through the note open history in the given direction.
Dispatches `core:navigate-back` or `core:navigate-forward` accordingly.

- **direction** (string, required)

  Either `"back"` or `"forward"`. Default: `"back"`

### core:navigate-back

Moves backward through the note open history.

### core:navigate-forward

Moves forward through the note open history.

### core:new-note

Creates a new note and open it in the editor.

- **bookId** (string)

  (Optional) The notebook ID to create the note in.

### core:new-note-in-separate-window

Creates a new note in a separate window. Uses the currently selected notebook if applicable.

### core:new-note-from-selection

Creates a new note from the selected text on the editor.

### core:new-note-from-link

Creates a new note from a link that targets an unresolved note in the preview pane.

- **title** (string, required)

  The title of the new note (also used as the link label).
- **line** (number, required)

  The line of the editor where the link appears.
- **newWindow** (boolean)

  Whether to open the new note in a separate window.

### core:new-notebook

Shows up a dialog for creating a new notebook.

- **parentBookId** (string)

  A parent notebook ID. If `undefined`, a notebook will be created under the root. Default: `undefined`

### core:note-list-show-all-notes

Lists all notes on the note list bar.

- **selectFirstNote** (boolean)

  Whether to select the first note or not. Default: `true`

### core:note-list-show-notes-in-templates

Lists note templates on the note list bar, and closes the currently open note.

- **callback** (function)

  Invoked after the note list has finished reloading.

### core:note-list-show-notes-in-trash

Lists notes in the trash on the note list bar.

- **selectFirstNote** (boolean)

  Whether to select the first note or not. Default: `true`

### core:note-list-show-notes-in-book

List notes in specified notebook on the note list bar

- **bookId** (string, required)

  The notebook ID
- **tagId** (string)

  The tag ID to filter items
- **status** (NoteStatus)

  The note status which should be **one of:**`"none"` or `"active"` or `"onHold"` or `"completed"` or `"dropped"`
- **selectFirstNote** (boolean)

  Whether to select the first note or not. Default: `true`
- **includeChildren** (boolean)

  Whether to include the notes in the child notebooks. Default: `false`

### core:note-list-show-notes-with-tag

List notes with specified tag on the note list bar

- **tagId** (string, required)

  The tag ID.
- **selectFirstNote** (boolean)

  Whether to select the first note or not. Default: `true`.

### core:note-list-show-notes-with-status

List notes with specified note status on the note list bar

- **status** (NoteStatus, required)

  The note status which should be **one of:** `"none"` or `"active"` or `"onHold"` or `"completed"` or `"dropped"`.
- **selectFirstNote** (boolean)

  Whether to select the first note or not. Default: `true`.

### core:note-tags-bar-item-list-unselect

Unselect items on the note tags bar.

### core:note-tags-bar-item-list-select-prev

Select the previous item on the note tags bar.

### core:note-tags-bar-item-list-select-next

Select the next item on the note tags bar.

### core:note-tags-bar-item-list-remove-item-before

Remove the selected item and select its previous item on the note tags bar.

### core:note-tags-bar-item-list-remove-item

Remove the target item on the note tags bar.

- **tagId** (string)

  (Optional) The tag ID to remove.

### core:open-first-note

Opens the first note of the note list bar in the editor.

### core:open-next-note

Opens the next note of currently selected note on the note list bar.

### core:open-prev-note

Opens the previous note of currently selected note on the note list bar.

### core:close-note

Closes the currently editing note.

### core:open-note

Opens a note with specified note ID.

- **noteId** (string, required)

  The ID of the note to open.
- **revision** (string)

  (Optional) Open the specific revision of the note.
- **selectInNoteListBar** (boolean)

  Whether to select the correspond note in the note list bar. Default: `true`.
- **pushState** (boolean)

  Remember it in the navigation history. Default: `true`.
- **newWindow** (boolean)

  Whether to open the note in a separate window. Default: `false`.
- **viewMode** (EditorViewMode)

  The editor view mode to switch to after opening. One of `"edit"`, `"preview"`, or `"sidebyside"`.
- **focus** (boolean)

  Whether to focus the editor after opening. Default: `false`.

### core:open-note-in-separate-window

Opens notes in separate windows. By default, opens notes selected on the note list bar.

- **noteId** (string|array)

  (Optional) The ID(s) of the note(s) to open.

### core:open-tag-settings

Opens up the settings window for the tag with specified ID.

- **tagId** (string)

  The ID of the tag to set.

### core:open-template

Opens a note template in the editor.
A template that already exists in the database is opened like a normal note; an official template that has not been saved yet is loaded into the editor unsaved.

- **template** (Note, required)

  The template note to open.

### core:paste

Pastes a text from clipboard.

### core:paste-as-plain-text

Pastes a text from clipboard as plain text.

### core:pin-note-to-top

Pin or unpin notes to the top of the note list. By default, applies to notes currently selected on the note list.

- **noteId** (string|array)

  (Optional) The ID(s) of the note(s) to pin or unpin.
- **pinned** (boolean)

  (Optional) The desired pinned state. If omitted, toggles the current state of the first target note.

### core:popup-app-menu

Shows the application menu as a popup context menu (useful on Windows / Linux where the menu bar is hidden).

### core:redo

Redoes the last undone change.

### core:reload-package

Unloads and re-loads the named package, if it is loaded.

- **name** (string, required)

  The package name.

### core:rename-notebook

> **Warning:**
>
> It's a private command for now

### core:save-image

Saves the target element's image to disk.

### core:save-note

Saves the currently editing note to the local database.

### core:select-all

Select all text.

### core:search-notes

Search notes globally with given keywords.

- **keyword** (string, required)

  The keywords to search.

### core:share-note

Shows up a dialog for sharing note with specified ID.

- **noteId** (string, required)

  The ID of the note to be shared.

### core:show-note-revisions

Shows up a dialog for viewing note change history with specified ID.

- **noteId** (string, required)

  The ID of the note to view its revision history.

### core:show-editor-action-menu

Opens the editor's action menu below the header button, with the per-note actions (move, duplicate, copy link, pin, revisions, share, delete).

### core:show-image-viewer

Opens the full-screen image viewer for the given image.

- **src** (string, required)

  The image URL or URI to display.
- **alt** (string)

  The alt text to show as a caption.

### core:strikethrough

Toggles strikethrough to the selected text.

### core:strong

Toggles strong emphasis to the selected text.

### core:toggle-blockquote

Toggles blockquote to the selected lines.

### core:toggle-bulleted-list

Toggles bulleted list to the selected lines.

### core:toggle-heading-1

Toggles h1 heading to the selected lines.

### core:toggle-heading-2

Toggles h2 heading to the selected lines.

### core:toggle-heading-3

Toggles h3 heading to the selected lines.

### core:toggle-heading-4

Toggles h4 heading to the selected lines.

### core:toggle-heading-bigger

Decreases heading level of the selected lines.

### core:toggle-heading-smaller

Increases heading level of the selected lines.

### core:toggle-numbered-list

Toggles ordered list to the selected lines.

### core:toggle-task-list

Toggles task list to the selected lines.

### core:toggle-inline-code

Toggles inline code block to the selected text.

- **selectionOnly** (boolean)

  Whether to limit the toggle to the current selection only.

### core:toggle-inline-mark-tag

Toggles an inline `<mark>` tag around the selected text.

### core:undo

Undoes the last change.

### core:unindent

Unindents the current lines.

### core:unload-package

Unloads the named package from memory, if it is loaded.

- **name** (string, required)

  The package name.

### core:insert-alert

Inserts an alert block with the specified type.

- **type** (string, required)

  The type of the alert block. It should be one of "NOTE", "TIP", "IMPORTANT", "WARNING", or "CAUTION".

### core:insert-alert-note

Inserts a note alert block.

### core:insert-alert-tip

Inserts a tip alert block.

### core:insert-alert-important

Inserts an important alert block.

### core:insert-alert-warning

Inserts a warning alert block.

### core:insert-alert-caution

Inserts a caution alert block.

---

## Telescope commands

[Telescope](https://docs.inkdrop.app/manual/quick-finder) is the quick finder for commands, notebooks, tags, and more.

### core:toggle-telescope

Opens Telescope if it is closed, or closes it if it is open.

### core:show-telescope

Opens Telescope.

- **scopedSourceId** (string)

  (Optional) Restrict the search to a specific source (e.g. commands, notebooks, tags).
- **scopedWorkspaceId** (string|null)

  (Optional) Restrict the search to a specific workspace.
- **initialSelectedItemId** (string|null)

  (Optional) The initially selected item.
- **cancelBehavior** (string)

  (Optional) Behavior when canceling, e.g. `"close"`.

### core:close-telescope

Closes Telescope.

### core:telescope-clear-query

Clears the Telescope query input.

### core:telescope-clear-active-source

Clears the active scoped source in Telescope.

### core:telescope-commands

Opens Telescope scoped to the commands source.

### core:telescope-notebooks

Opens Telescope scoped to the notebooks source.

### core:telescope-tags

Opens Telescope scoped to the tags source.

---

## Sidebar commands

### core:sidebar-focus

Moves focus to the side bar.

### core:sidebar-select-next-item

Select the next item of the side bar menu.

### core:sidebar-select-prev-item

Select the previous item of the side bar menu.

### core:sidebar-select-item

Activate the currently selected item.

### core:sidebar-disclose-item

Toggle the disclosure (expand/collapse) of the currently selected item.

### core:sidebar-expand-item

Expand the currently selected item.

### core:sidebar-collapse-item

Collapse the currently selected item.

### core:sidebar-scroll-to-selection

Scrolls the side bar to the currently selected item.

### core:sidebar-open-workspace-menu

Open the workspace menu for a notebook.

- **bookId** (string)

  (Optional) The notebook ID. If omitted, opens the current workspace.
- **selectFirstNote** (boolean)

  Whether to select the first note in the workspace. Default: `true`.

### core:sidebar-hide-workspace-menu

Hide the workspace menu.

### core:sidebar-workspace-go-up

Navigate one level up in the workspace menu.

---

## Editor commands

### editor:clear-find

Clears the text in the editor search bar.

- **focus** (boolean)

  Whether to keep the search bar focused after clearing.

### editor:toggle-regex

Toggles regex matching in the editor search bar.

### editor:toggle-case-sensitive

Toggles case-sensitive matching in the editor search bar.

### editor:change-note-status-none

Set the note status of the editing note to None.

### editor:change-note-status-active

Set the note status of the editing note to Active.

### editor:change-note-status-onhold

Set the note status of the editing note to OnHold.

### editor:change-note-status-completed

Set the note status of the editing note to Completed.

### editor:change-note-status-dropped

Set the note status of the editing note to Dropped.

### editor:copy-line-up

Duplicates the selected lines upward, keeping the selection in the top copy.

### editor:copy-line-down

Duplicates the selected lines downward, keeping the selection in the bottom copy.

### editor:delete-char-after

Deletes the char after the cursor.

### editor:delete-char-before

Deletes the char before the cursor.

### editor:delete-group-after

Deletes the text group after the cursor.

### editor:delete-group-before

Deletes the text group before the cursor.

### editor:delete-line

Deletes the line.

### editor:delete-word-after

Deletes the word after the cursor.

### editor:delete-word-before

Deletes the word before the cursor.

### editor:delete-wrapped-line-left

Deletes the wrapped line left.

### editor:delete-wrapped-line-right

Deletes the wrapped line right.

### editor:upcase-at-cursor

Uppercases the selection, or the word at the cursor when nothing is selected.

### editor:downcase-at-cursor

Lowercases the selection, or the word at the cursor when nothing is selected.

### editor:edit-with-ai

Opens the AI inline assistant to edit the currently selected text. Does nothing if there is no selection.

### editor:trigger-nes

Requests a Next Edit Suggestion at the cursor.
Suggestions are rendered as dim ghost text and can also be triggered automatically after an idle pause, depending on the `ai.nextEditSuggestions` config.

### editor:accept-nes

Accepts the visible Next Edit Suggestion, inserting the ghost text as a single undoable edit.
Does nothing and lets the keystroke fall through when no suggestion is visible.

### editor:dismiss-nes

Dismisses the visible Next Edit Suggestion.

### editor:find

Toggles the editor search bar.

### editor:find-next

Locates the next item in the editor that matches criteria.

### editor:find-prev

Locates the previous item in the editor that matches criteria.

### editor:find-text

Finds given text in the editor.

- **text** (string, required)

  The text to find.
- **parseAsQuery** (boolean)

  Whether to parse the text as a search query (with operators).

### editor:find-under

Selects the next occurrence of the selection, or of the word at the cursor when nothing is selected, wrapping around the end of the note.

### editor:find-under-previous

Selects the previous occurrence of the selection, or of the word at the cursor when nothing is selected, wrapping around the start of the note.

### editor:focus

Focuses to the MDE or preview pane depending on the editor mode.

### editor:focus-mde

Moves focus to the MDE.

### editor:focus-preview

Moves focus to the preview pane.

### editor:go-char-left

Moves the cursor to one character left.

### editor:go-char-right

Moves the cursor to one character right.

### editor:go-doc-end

Moves the cursor to the end of the document.

### editor:go-doc-start

Moves the cursor to the start of the document.

### editor:go-group-left

Moves the cursor to one group left.

### editor:go-group-right

Moves the cursor to one group right.

### editor:go-line-down

Moves the cursor to one line down.

### editor:go-line-end

Moves the cursor to the line end.

### editor:go-line-left

Moves the cursor to the line left.

### editor:go-line-right

Moves the cursor to the line right.

### editor:go-line-start

Moves the cursor to the line start.

### editor:go-line-up

Moves the cursor to one line up.

### editor:go-matching-bracket

Moves the cursor to the bracket matching the one it is on.

### editor:go-page-down

Moves the cursor to one page down.

### editor:go-page-up

Moves the cursor to one page up.

### editor:go-subword-left

Moves the cursor one group or camel-case subword backward.

### editor:go-subword-right

Moves the cursor one group or camel-case subword forward.

### editor:go-syntax-left

Moves the cursor one syntax node to the left.

### editor:go-syntax-right

Moves the cursor one syntax node to the right.

### editor:select-char-left

Extends the selection by one character to the left.

### editor:select-char-right

Extends the selection by one character to the right.

### editor:select-syntax-left

Extends the selection one syntax node to the left.

### editor:select-syntax-right

Extends the selection one syntax node to the right.

### editor:select-subword-left

Moves the selection head one group or camel-case subword backward.

### editor:select-subword-right

Moves the selection head one group or camel-case subword forward.

### editor:select-group-left

Extends the selection by one group to the left.

### editor:select-group-right

Extends the selection by one group to the right.

### editor:select-line-up

Extends the selection one line up.

### editor:select-line-down

Extends the selection one line down.

### editor:select-line-start

Extends the selection to the line start.

### editor:select-line-end

Extends the selection to the line end.

### editor:select-line-left

Extends the selection to the line boundary on the left.

### editor:select-line-right

Extends the selection to the line boundary on the right.

### editor:select-page-up

Extends the selection one page up.

### editor:select-page-down

Extends the selection one page down.

### editor:select-doc-start

Extends the selection to the start of the document.

### editor:select-doc-end

Extends the selection to the end of the document.

### editor:select-line

Expands the selection to cover entire lines.

### editor:select-parent-syntax

Expands the selection to the next larger syntactic construct.

### editor:select-matching-bracket

Extends the selection to the bracket matching the one the selection head is on.

### editor:select-next-occurrence

Adds a selection at the next occurrence of the selected text, or selects the word at the cursor when the selection is empty.

### editor:select-selection-matches

Selects all instances of the currently selected text.

### editor:skip-and-select-next-occurrence

Moves the selection on to the next occurrence instead of adding it, dropping the range it searched from.
With nothing selected, the first press only expands the selection to the word at the cursor.

### editor:split-selection-by-line

Replaces every selection range with one range per line it covers.

### editor:move-line-up

Moves the current line(s) up.

### editor:move-line-down

Moves the current line(s) down.

### editor:indent

Indents the currently selected line(s).

### editor:indent-less

Unindents the currently selected line(s).

### editor:indent-more

Indents one more the currently selected line(s).

### editor:insert-blank-line

Creates a blank, indented line below the current line.

### editor:insert-line-before

Opens an indented blank line above the line at the cursor and moves the cursor onto it — the upward counterpart of `editor:insert-blank-line`.

### editor:insert-images

Inserts image files at the cursor to the editing note.

### editor:insert-link

Opens the "Insert a link" dialog, pre-filled with the given title and URL, and inserts `[title](url)` at the cursor.
Not registered while the session is read-only.

- **title** (string)

  The link title to pre-fill.
- **url** (string)

  The URL to pre-fill. When given, the URL field is selected instead of the
  title field.

### editor:resize-image-auto

Restores the image at the cursor to its natural size, by removing the `w:` and `h:` tokens from its alt text.
Does nothing when the cursor is not inside an image.

### editor:resize-image-small

Resizes the image at the cursor to 30% width.

### editor:resize-image-half

Resizes the image at the cursor to 50% width.

### editor:resize-image-full

Resizes the image at the cursor to 100% width.

- **pos** (object)

  Position to insert with the following keys:
  - **ch** (number)

    Character position.
  - **line** (number)

    Line position.
- **files** (FileList|array)

  [FileList](https://developer.mozilla.org/en-US/docs/Web/API/FileList), or an Array of [File](https://developer.mozilla.org/en-US/docs/Web/API/File) or [NativeImage](https://electronjs.org/docs/api/native-image) to insert.

You can override the default file drop handler like so:

```js title="Example"
const mde = inkdrop.getActiveEditorOrThrowError()
inkdrop.commands.add(mde.wrapper.wrapper, {
  'editor:insert-images': e => {
    const { files, pos } = e
    // Do something

    // prevent the default behavior
    e.stopPropagation()
  }
})
```

### editor:join-lines

Joins the lines each selection range covers into a single line, separated by one space and dropping the indentation of the absorbed lines.
An empty selection joins the line at the cursor with the one below it.

### editor:jump-to-line

Toggles a dialog which allows you to jump to the line at the specified number.

### editor:kill-line

Deletes from the cursor to the end of the line.

### editor:new-line

Inserts a plain new line at the cursor without continuing any Markdown markup.

### editor:new-line-continue-markup

Inserts a new line and continues the current Markdown markup — list markers, ordered-list numbers, task list checkboxes, and blockquotes — then indents to match the surrounding block.

### editor:open-line

Inserts a new line above the cursor.

### editor:redo-selection

Redoes the last selection.

### editor:replace

Initiates the replace sequence in the editor.

### editor:replace-next

Replaces the next occurrence in the editor.

### editor:replace-all

Replaces all occurrences in the editor.

### editor:replace-selection

Replaces selected text with the given text.

- **text** (string)

  String, the text to replace.

### editor:save-editor-scroll

> **Warning:**
>
> It's a private command

### editor:save-preview-scroll

> **Warning:**
>
> It's a private command

### editor:scroll-line-up

Scrolls the viewport up by one line, leaving the cursor where it is.

### editor:scroll-line-down

Scrolls the viewport down by one line, leaving the cursor where it is.

### editor:show-in-center

Scrolls the line with the cursor on it to the vertical center of the viewport.

### editor:sort-lines

Sorts the lines covered by each selection range alphabetically.
Ranges covering fewer than two lines are left alone, so an empty selection never rewrites the note.

### editor:reverse-sort-lines

Sorts the selected lines in reverse alphabetical order.

### editor:sort-lines-insensitive

Sorts the selected lines alphabetically, ignoring case.
Lines that differ only in case keep a stable order between themselves.

### editor:reverse-sort-lines-insensitive

Sorts the selected lines in reverse alphabetical order, ignoring case.

### editor:scroll-editor-to-line

Scrolls the editor to the given line.

- **line** (number)

  Number, the destination line number.

### editor:scroll-preview-to-line

Scrolls the preview to the given line.

- **line** (number)

  Number, the destination line number.

### editor:select-all

Selects all text in the editor.

### editor:select-lines-downward

Adds a cursor downward.

### editor:select-lines-upward

Adds a cursor upward.

### editor:single-selection

Removes all cursors except the primary one.

### editor:sync-editor-scroll

Syncs the scroll position of the editor with the same position of the preview pane.

### editor:sync-preview-scroll

Syncs the scroll position of the preview pane with the same position of the editor.

### editor:focus-title

Moves focus to the title input bar of the editor.

### editor:focus-and-go-doc-start

Focuses the editor and moves the cursor to the start of the document.

### editor:move-focus-to-next

Moves focus from the title input bar to the next editable area.

### editor:insert-text

Inserts the given text at the current cursor position.

- **text** (string, required)

  The text to insert.
- **selection** (object)

  (Optional) Selection to set after insertion, with `anchor` (number) and optional `head` (number) offsets from the insertion position.

### editor:open-link

Opens the URL at the cursor in the default browser.

### editor:copy-link

Copies the URL at the cursor to the clipboard.

### editor:paste-url

Pastes a URL at the cursor. If text is selected, wraps it as a Markdown link.

- **url** (string, required)

  The URL to paste.

### editor:start-completion

Manually triggers the autocompletion popup.

### editor:accept-completion

Accepts the currently highlighted completion suggestion.

### editor:close-completion

Closes the autocompletion popup.

### editor:move-completion-selection-up

Moves the highlighted completion suggestion up.

### editor:move-completion-selection-down

Moves the highlighted completion suggestion down.

### editor:move-completion-selection-page-up

Moves the highlighted completion suggestion up by a page.

### editor:move-completion-selection-page-down

Moves the highlighted completion suggestion down by a page.

### editor:refresh

Requests the editor to recompute its measurements (after layout changes).

### editor:set-doc

Replaces the entire editor content with the given body.

- **body** (string, required)

  The new document body.

### editor:toggle-comment

Comments or uncomments the selection, using line comments when the language provides them and block comments otherwise.
In Markdown text this produces an HTML comment (`<!-- -->`), since Markdown defines only block comment tokens.

### editor:toggle-line-comment

Comments or uncomments the selection using line comments.
This only takes effect inside a fenced code block whose language provides line comment tokens — in Markdown text it does nothing.

### editor:toggle-line-numbers

Toggles line numbers in the editor.

### editor:toggle-line-wrapping

Toggles soft line wrapping in the editor.

### editor:toggle-readable-line-length

Toggles a maximum readable line length in the editor.

### editor:toggle-limit-max-width

Toggles whether the editor limits its maximum content width.

### editor:add-code-language

Registers a code language with the Markdown editor for fenced-code syntax highlighting.

- **lang** (LanguageDescription, required)

  A CodeMirror `LanguageDescription` instance.

### editor:remove-code-language

Removes a previously registered code language.

- **name** (string, required)

  The name of the language to remove.

### editor:add-extension

Adds a CodeMirror extension to the editor.

- **extension** (Extension, required)

  A CodeMirror `Extension`.

### editor:remove-extension

Removes a previously added CodeMirror extension.

- **extension** (Extension, required)

  The extension to remove.

### editor:add-markdown-extension

Adds a Lezer Markdown extension to the parser.

- **extension** (MarkdownExtension, required)

  A Lezer `MarkdownExtension`.

### editor:remove-markdown-extension

Removes a previously added Markdown extension.

- **extension** (MarkdownExtension, required)

  The extension to remove.

### editor:add-slash-commands

Registers additional items for the slash-command menu.

- **commands** (SlashCommandList, required)

  The slash commands to add.

### editor:remove-slash-commands

Unregisters previously added slash-command items.

- **commands** (SlashCommandList, required)

  The slash commands to remove.

### editor:new-table-row-and-continue

Inserts a new row in the table at the cursor and continues editing.

### editor:move-to-next-table-cell

Moves the cursor to the next cell of the table at the cursor.

### editor:move-to-previous-table-cell

Moves the cursor to the previous cell of the table at the cursor.

### editor:toggle-task-list

Toggles task list to the current selections.

### editor:transpose-chars

Transposes characters at the cursor.

### editor:undo-selection

Undoes the last selection.

### editor:unindent

Unindents the current lines.

### editor:show-notes-in-book-of-editing-note

Display notes in a notebook of the currently editing note on the note list bar.

### editor:go-to-workspace-of-editing-note

Switches to the workspace of the notebook of the currently editing note.

---

## AI commands

Commands for managing the AI inline assistant. These are global commands you typically invoke programmatically (for example, from a plugin) to customize the built-in prompt presets shown when editing the selection with AI.

### ai:add-inline-assistant-prompt-presets

Adds prompt presets to the AI inline assistant. A preset whose ID matches an existing one replaces it; the rest are appended to the list.

- **presets** (array, required)

  An array of preset objects, each with the following keys:
  - **id** (string, required)

    A unique identifier for the preset.
  - **label** (string, required)

    The label shown in the preset list.
  - **prompt** (string, required)

    The prompt sent to the AI when the preset is selected.

### ai:remove-inline-assistant-prompt-presets

Removes prompt presets from the AI inline assistant by ID.

- **ids** (array, required)

  The IDs of the presets to remove.

---

## Table editor commands

These commands operate while the cursor is inside a Markdown table.

### table-editor:select-cell

Selects the contents of the current cell.

### table-editor:next-cell

Moves to the next cell.

### table-editor:previous-cell

Moves to the previous cell.

### table-editor:next-row

Moves to the next row.

### table-editor:escape

Exits the table editing mode.

### table-editor:move-left

Moves one cell to the left.

### table-editor:move-right

Moves one cell to the right.

### table-editor:move-up

Moves one cell up.

### table-editor:move-down

Moves one cell down.

### table-editor:align-left

Aligns the current column to the left.

### table-editor:align-right

Aligns the current column to the right.

### table-editor:align-center

Aligns the current column to the center.

### table-editor:align-none

Removes column alignment.

### table-editor:move-row-up

Moves the current row up.

### table-editor:move-row-down

Moves the current row down.

### table-editor:move-column-left

Moves the current column to the left.

### table-editor:move-column-right

Moves the current column to the right.

### table-editor:delete-column

Deletes the current column.

### table-editor:delete-row

Deletes the current row.

### table-editor:insert-column

Inserts a new column.

### table-editor:insert-row

Inserts a new row.

### table-editor:format

Reformats the current table.

### table-editor:format-all

Reformats all tables in the note.

---

## Export commands

### export-as-html:selections

Exports the selected notes on the note list bar as HTML to disk.
Exporting more than one note prompts for a destination directory; exporting exactly one opens a save dialog.

- **noteId** (string)

  The note to export. Defaults to the notes selected on the note list bar, then to the editing note.

### export-as-html:notebook

Prompts for a directory and exports every note in a notebook, and its child notebooks, as HTML.

- **bookId** (string)

  The notebook to export. Defaults to the notebook targeted by the context
  menu.

### export-as-html:copy

Copies a note to the clipboard as full templated HTML, with images inlined as data URIs.

- **noteId** (string)

  The note to copy. Defaults to the first note selected on the note list bar.

### export-as-html:copy-simple

Copies a note to the clipboard as stripped-down HTML, without the document template.

- **noteId** (string)

  The note to copy. Defaults to the first note selected on the note list bar.

### export-as-markdown:all

Exports all notes as Markdown to disk.

### export-as-markdown:selections

Exports the selected notes on the note list bar as Markdown, along with their attachments.
Exporting more than one note prompts for a destination directory; exporting exactly one opens a save dialog.

- **noteId** (string)

  The note to export. Defaults to the notes selected on the note list bar, then to the editing note.

### export-as-markdown:notebook

Prompts for a directory and exports every note in a notebook, and its child notebooks, as Markdown.

- **bookId** (string)

  The notebook to export. Defaults to the notebook targeted by the context
  menu.

### export-print:export-as-pdf

Exports the editing note as PDF to disk.

### export-print:print

Prints the editing note.

---

## Import commands

### import-html:import-from-file

Imports a note from a HTML file.

### import-markdown:import-from-file

Opens the Markdown import wizard, which scans the chosen files or directory and imports them into a notebook you pick.

---

## View commands

### view:sort-by-title-in-asc

Sorts the note list by title in ascending order.

### view:sort-by-title-in-desc

Sorts the note list by title in descending order.

### view:sort-by-date-created-in-asc

Sorts the note list by date created in ascending order.

### view:sort-by-date-created-in-desc

Sorts the note list by date created in descending order.

### view:sort-by-date-updated-in-asc

Sorts the note list by date updated in ascending order.

### view:sort-by-date-updated-in-desc

Sorts the note list by date updated in descending order.

### view:show-editor

Shows the editor pane.

### view:show-preview

Shows the preview pane.

### view:show-side-by-side

Shows the editor and preview side by side.

### view:toggle-distraction-free

Toggles distraction-free mode.

### view:toggle-preview

Toggles the preview pane.

### view:toggle-side-by-side

Toggles the side-by-side mode.

### view:toggle-sidebar

Toggles the side bar.

---

## Window commands

### window:close

Closes the window.

### window:decrease-font-size

Decreases the font size in the editor.

### window:increase-font-size

Increases the font size in the editor.

### window:new-inkdrop-window

Opens up a new window.

### window:reload

Reloads the window.

### window:toggle-dev-tools

Toggles the Developer Tools window.

### window:toggle-full-screen

Toggles full screen mode.

### window:toggle-menu-bar

Toggles the `core.autoHideMenuBar` config, which hides or shows the menu bar.
When the menu bar is hidden it can be revealed temporarily by pressing the Alt key.

---

## Special commands

The following commands are special for controlling the key event handler.

### native!

Triggers the default behavior of the key event.

### unset!

Unbinds the existing keybinding.

### abort!

Prevents the default behavior of the key event. It calls `preventDefault` on the event object.
