Options for editing text
Prev | Chapter 1. Preferences | Next

## Options for editing text

medit has some editing options which can be set in the document text, or in the Preferences dialog for sets of files or for given syntax highlighting language.

To set the options in the document text, place the following on the first, second or the last line of the document:

    -%- options -%-

where `options` is the option string

    key: value; key: value; ...

(the latter is the format used also in the Preferences dialog).

For example, the following might be the first line in a C file:

    /* -%- indent-width: 2; use-tabs: yes; strip: yes -%- */

Values can be strings, integers, or booleans.

Booleans are `yes`, `no`, `true`, `false`, `1`, `0`.

If a string value contains `:` character, then the following syntax may be used: ``key`=/`value`/`. Any character may be used instead of slash (and it must not occur in the `value`). Example: `word-chars=@-/:@`

The following options are available:

`lang` : | syntax highlighting language to use in this document. Special value `none` will turn off syntax highlighting in this document.
`strip` : | a boolean value, whether trailing whitespace should be removed from the document on save.
`add-newline` : | a boolean value, whether the editor should ensure that saved files have a trailing new line character.
`indent-width` : | an integer specifying indentation offset used when the Tab key is pressed to indent text.
`tab-width` : | displayed width of the tab character. Note that this is not the same as `indent-width`.
`use-tabs` : | whether tab character should be used for indentation.

medit tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly pick up the conventional settings from source files.

Prev | Up | Next
File Selector tab | Home | Preferences files