Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Completion and snippets

Mitos suggests words from open buffers and filesystem paths while you type. Install a language server for code completion and LSP snippets, or define your own user-defined snippets.

Use the completion menu

Press Ctrl-x in insert mode to request completion yourself. When the menu is open:

KeyAction
Tab, Ctrl-n, DownSelect the next suggestion
Shift-Tab, Ctrl-p, UpSelect the previous suggestion
EnterAccept the selected suggestion
Ctrl-cDismiss the menu and reject the preview

Typing another character normally accepts the selected suggestion and continues typing. Mitos previews the selected suggestion in the document by default. Disable this with editor.completion.preview-insert = false.

When a language server provides label details, the menu shows the signature or type beside the name and its module or file path in a separate column. These details help distinguish suggestions and are not inserted into the document.

To request suggestions only with Ctrl-x:

[editor.completion]
auto-trigger = false

See the completion settings for delays, word completion, and path completion. Remap menu keys under keys.menu.

Snippet placeholders

Language servers can return snippets with editable placeholders, such as a function call’s arguments. After accepting one, type over the selected placeholder and press Tab to move to the next one when smart-tab is active and non-whitespace precedes the cursor.

You can bind placeholder navigation directly, including backward navigation:

[keys.insert]
A-j = "snippet_next_tabstop"
A-k = "snippet_previous_tabstop"

LSP snippets are enabled by default. To disable them, set editor.lsp.completion.snippets = false, reload configuration, and run :lsp-restart.

Smart Tab

Outside a snippet, Tab moves to the end of the enclosing syntax node when there is non-whitespace text before the cursor. At the start of a line it inserts indentation. Shift-Tab explicitly inserts indentation with the default bindings.

While the completion menu is open, Tab normally selects the next suggestion. Set editor.indent.smart-tab.supersede-menu = true to give smart-tab priority. You can still select suggestions with Ctrl-n and Ctrl-p.

To always insert indentation when the menu is closed:

[editor.indent.smart-tab]
enable = false

Inline completions

Servers supporting inline completion can show suggestions as faint text after the cursor. These suggestions leave the document unchanged until accepted. They disappear when you edit, move, leave insert mode, or switch documents. When you select a plain-text item in the completion menu, the server can extend that item with an inline suggestion. Selecting a different item refreshes the suggestion. Items with snippet placeholders, additional edits, or commands keep their ordinary completion preview.

There are no default keys for inline suggestions. Add these to config.toml:

[keys.insert]
C-y = "inline_completion_accept"
C-e = "inline_completion_dismiss"
C-g = "inline_completion_trigger"
A-n = "inline_completion_next"
A-p = "inline_completion_previous"

To request suggestions only with your trigger binding:

[editor.inline-completion]
auto-trigger = false

Mitos uses the first configured server with the inline-completion feature. Suggestions can span multiple lines; inline snippet suggestions and multiple cursors are not supported. See feature routing if you use several servers.

Snippet variables

Snippet bodies can insert selected text, filenames, dates, and other values. See the snippet variable reference for supported names and examples. These variables work in both language-server and user-defined snippets.

User-defined snippets

You can define your own snippets without a language server. Keep them in your Mitos configuration directory or share them with a project.