Skip to content

Settings

There are three places a setting can come from, and they apply in this order: the built-in default, your config file, then the project's .editorconfig. :set at any point overrides all of them for the buffer you are in.

:set

:set nu          line numbers                    (number)
:set nonu        …off
:set rnu         relative numbers                (relativenumber)
:set nornu       …off
:set hls         highlight search matches
:set nohls       …off
:set syntax      say what this buffer is coloured as
:set syntax=rust colour it as something else
:set nosyn       plain
:set ff=unix     write LF line endings           (fileformat)
:set ff=dos      write CRLF
:set eol         end the file with a newline
:set noeol       do not
:set encoding=utf-8

Line numbers are on by default, which is where this differs from vi and matches every editor written since.

The config file

$XDG_CONFIG_HOME/turbovi/config (in practice ~/.config/turbovi/config) is a list of ex commands, the way a vimrc is:

" Anything after a double quote is a comment, as in vim.
set nonu
set rnu
set nohls

A leading : is allowed and ignored, because half the world will write :set nu out of habit and being strict about it would teach nobody anything. Blank lines are skipped. A missing or unreadable file is not an error: the editor has to start on a machine whose home directory is read-only.

Anything you can type at : you can put in the file. In practice it holds :sets.

.editorconfig

EditorConfig is honoured, walking up from the file you opened and stopping at the first config that says root = true. Sections nearest the file win.

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[*.{js,json,yml}]
indent_size = 2
Property What it changes
indent_style whether Tab, o, cc and >> use a tab or spaces
indent_size how many spaces, when it is spaces
tab_width how wide an existing tab is drawn
end_of_line lf, crlf or cr on write
insert_final_newline whether the file ends with one
trim_trailing_whitespace trailing spaces removed on :w

Trailing whitespace is trimmed on the way out, not as you type: an editor that deleted the space under the cursor would be unusable in insert mode.

Sensible defaults

With no .editorconfig anywhere, Tab inserts four spaces. The exceptions are Makefile, GNUmakefile, *.mk and *.go, where it inserts a tab. Those are the files where a tab is not a preference: make rejects a recipe indented with spaces and gofmt puts the tabs back.

Only an explicit indent_style overrides that. A project-wide indent_size = 2 is about the language the project is written in, and the Makefile stays exempt from it.

What is not honoured

charset is deliberately ignored. The encoding is detected from the bytes, and that detection is what makes opening a file and saving it a no-op; letting a config file override it would silently re-encode every file it was wrong about. max_line_length is ignored because there is no ruler for it to drive.

Globs support *, **, ?, [abc] and {a,b}. Numeric ranges ({1..9}) and braces inside braces are not supported; a section using one is matched literally.

Syntax colouring

Colour comes from the file's name, not from its contents. Guessing from the text means a file changes colour as it is typed, which is worse than a plain file that stays plain.

Known out of the box: .c .css .go .h .hs .html .java .js .json .jsx .lua .md .ml .pl .py .pyi .rb .rs .sh .sql .toml .ts .tsx .yaml .yml, plus Makefile, Dockerfile, .bashrc, .profile and .zshrc.

:set syntax=NAME reaches the rest of what Pygments knows, which is several hundred languages. An unknown name leaves the buffer plain, because :set syntax=nonsense is a typo somebody made once and it must not take the editor down.

Four colours, because that is what a terminal palette can tell apart at a glance and what Borland shipped: comments, literals, keywords, and the names a language defines for you. Files over 120,000 characters are drawn plain: colouring one costs more per keystroke than an editor can afford.

Themes

The colour scheme comes from turbodesk and is set with an environment variable:

TURBODESK_THEME=gruvbox_dark turbovi notes.md

Nineteen flavours, mocha by default: bluloco, borland, dracula, frappe, gruvbox_dark, gruvbox_light, kanagawa, latte, macchiato, mocha, monokai, solarized_dark, solarized_light, terminal_16, terminal_16_inverted, tokyo_night_dark, tokyo_night_light, vscode_dark, vscode_light.

terminal_16 and terminal_16_inverted name no colours of their own and use the terminal's sixteen, for a connection that mangles truecolour.