A simple and opinionated modal code editor for your terminal
These are the builtin commands that can be used to interact with the editor. Their main purpose is to provide features that complement text editing. Commands is also how you can configure your editor on config files.
When passing arguments that contain spaces, you can wrap them between ", ' or a balanced {} pair.
helpSearches the help pages for <keyword>.
If <keyword> is not present, opens the main help page.
hhelp [<keyword>]logLogs each <argument> to the editor log using the <log-kind>.
Each argument is separated by a new line.
Possible <log-kind>:
status: will write a message only to the status barinfo: will write a message only to both the log file status bardiagnostic: will write a message only to the log fileerror: will write an error message to both the log file and status bar
log <log-kind> <arguments...>open-logOpens the editor log file as a buffer (if you want to refresh it, use the reopen command).
open-logquitQuits this client. With ‘!’ will discard any unsaved changes.
quit[!]qquit-allQuits all clients. With ‘!’ will discard any unsaved changes.
quit-all[!]qaopenOpens buffer up for editing.
If file <path> exists, it will be loaded into the buffer’s content.
Also, if <path> ends with :<line>[,<column>], it will be opened at that location.
A buffer has a set of properties that can be changed when opening it:
history-enabled, history-disabled: enables/disables undo history (enabled by default)saving-enabled, saving-disabled: enables/disables saving (enabled by default)file-backed-enabled, file-backed-disabled: enabled/disables being file backed (enabled by default)word-database-enabled, word-database-disabled: enables/disables contributing words for the word database (builtin autocomplete) (enabled by default)It’s also possible to change these properties in batch by passing:
text: will enable all propertiesscratch: will disable all properties except historylog: will disable all properties except file-backedoutput: will disable all propertiesNote that the property evaluation order is the same as the order of the arguments.
That is, calling open history-enabled log my-buffer.txt will actually open my-buffer.txt with undo history disabled!
open [<properties...>] <path>[:<line>[,<column>]]osaveSaves buffer to file.
If <path> is present, it will use that path so save the buffer’s content, making it the new buffer’s associated filepath
(it will also enable saving for that buffer from now on).
save [<path>]ssave-allSaves all buffers to file.
save-allsareopenReopens buffer from file. If it can not save, it does nothing. With ‘!’ will discard any unsaved changes.
reopen[!]rreopen-allReopens all buffers from file. Buffers that can not save, are skipped. With ‘!’ will discard any unsaved changes
reopen-all[!]racloseCloses current buffer. With ‘!’ will discard any unsaved changes.
close[!]cclose-allCloses all buffers. With ‘!’ will discard any unsaved changes.
close-all[!]caconfigIf <value> is present, it sets the editor config <key> to its value (if valid).
Otherwise, it returns its current value.
config <key> [<value>]| key | type | doc |
|---|---|---|
tab_size |
integer |
size of a tab relative to space |
indent_with_tabs |
bool |
if false, the editor will indent with tab_size spaces |
visual_empty |
char |
the character that will be drawn to indicate end of buffer |
visual_space |
char |
the character that will be drawn in place of spaces |
visual_tab_first |
char |
the first character that will be drawn in place of a tab |
visual_tab_repeat |
char |
the character that will be drawn repeatedly in place of a tab until we read a tab stop |
completion_min_len |
integer |
min number of bytes before auto completion is triggered |
picker_max_height |
integer |
max number of lines that are shown at a time when a picker ui is opened |
status_bar_max_height |
integer |
max number of lines that the status bar can occupy |
colorIf <value> is present, it sets the editor theme color <key> to that color.
Otherwise, it returns its current color.
color <key> [<value>]| key | doc |
|---|---|
background |
The color displayed behind the characters on the screen |
highlight |
The color of search highlights that appear behind search matches. Also the cursor color while in insert mode |
statusbar_active_background |
The background color for the focused client’s statusbar |
statusbar_inactive_background |
The background color for the unfocused client’s statusbar |
normal_cursor |
The cursor color while in normal mode |
select_cursor |
The cursor color while in normal mode and selecting text |
insert_cursor |
The cursor color while in insert mode |
inactive_cursor |
The cursor color for unfocused clients |
token_whitespace |
All highlighted whitespace tokens have this color |
token_text |
All highlighted text tokens have this color |
token_comment |
All highlighted comment tokens have this color |
token_keyword |
All highlighted keyword tokens have this color |
token_type |
All highlighted type tokens have this color |
token_symbol |
All highlighted symbol tokens have this color |
token_string |
All highlighted string tokens have this color |
token_literal |
All highlighted literal tokens have this color |
mapCreates a keyboard mapping for an editor mode.
<mode> is one of normal, insert, command, readline and picker.
<from> and <to> are a string of keys.
map <mode> <from> <to>syntaxEither begins a new syntax definition for buffer paths that match a glob <glob>,
or sets the pattern for tokens of kind <token-kind> for the previously defined syntax.
<token-kind> is one of keywords, types, symbols, literals, strings, comments and texts.
syntax <glob> or syntax <token-kind> <pattern>Read more about language syntax definitions.
list-buffersLists all buffers together with their properties in a buffers.refs buffer.
list-bufferslist-lintsLists all lints together with their locations in a lints.refs buffer.
list-lintslist-breakpointsLists all breakpoints together with their locations in a breakpoints.refs buffer.
list-breakpointscopy-commandSets the command to be used when copying text to clipboard.
The copied text is written to stdin utf8 encoded.
This is most useful on platforms that do not have an unique way to interact with the clipboard.
If <command> is empty, no command is used.
copy-command <command>By default, this is set per platform:
xsel --clipboard --inputxclip -inpbcopypaste-commandSets the command to be used when pasting text from clipboard.
The pasted text is read from stdout and needs to be utf8 encoded.
This is most useful on platforms that do not have an unique way to interact with the clipboard.
If <command> is empty, no command is used.
paste-command <command>By default, this is set per platform:
xsel --clipboard --outputxclip -outpbpasteenqueue-keysEnqueue keys as if they were typed in the current client.
enqueue-keys <keys>insert-textDeletes text inside all cursor ranges. Then inserts <text> at each cursor.
Equivalent to enqueue-keys i<text><enter> however more performant since the text insertion happens at once instead of char by char.
insert-text <text>to-lowercaseMakes all selected text lowercase (ascii only).
to-lowercaseto-uppercaseMakes all selected text uppercase (ascii only).
to-uppercasetoggle-commentFor each line, toggles its <comment-prefix> starting text.
For example, in a C++ like language, it would be used like toggle-comment //.
toggle-comment <comment-prefix>set-registerSet the content of register <key> to <value>.
set-register <key> <value>set-clipboardSets the contents of the system clipboard to <text>.
set-clipboard <text>set-envSet the value of the environment variable <key> to <value>
set-env <key> <value>readlineEnters readline mode and once a line is read, executes the commands in <continuation>.
It’s possible to access the line input through @register(i) when <continuation> executes.
readline <continuation>pickEnters picker mode and once an entry is selected, executes the commands in <continuation>.
It’s possible to access the selected entry input through @picker-entry() when <continuation> executes.
pick <continuation>picker-entriesClears and then adds all <entries...> to be selected with the pick command.
picker-entries <entries...>picker-entries-from-linesClears and then adds a picker entry for each <command> stdout line (with stdin closed) to be selected with the pick command.
picker-entries-from-lines <command>spawnSpawns the external <command> (with stdin closed and ignoring its stdout).
spawn <command>replace-with-outputPass each cursor selection as stdin to the external <command> and substitute each for its stdout.
replace-with-output <command>commandDefines a new command that can be called by its <name> which executes all commands in its <source>.
Commands which name starts with - won’t show up in the command completion menu.
command <name> <source>evalEvaluate <commands> as if they were typed in directly.
However it enables expansions to happen before evaluation.
eval <commands>ifConditionally evaluate <commands> as if they were typed in directly.
However it enables expansions to happen before evaluation.
<op> can be one of the following:
==: executes if <left-expr> is equal to <right-expr>!=: executes if <left-expr> is not equal to <right-expr>
if <left-expr> <op> <right-expr> <commands>