Contents

_M.textadept.editing

Editing features for Textadept.


Fields


AUTOINDENT (bool)

Match the indentation level of the previous line when inserting a new line. The default value is true.


AUTOPAIR (bool)

Automatically close opening ‘(’, ‘[’, ‘{’, ‘"’, or ‘'’ characters. The default value is true. Auto-paired characters are defined in the char_matches table.


HIGHLIGHT_BRACES (bool)

Highlight matching brace characters like “()[]{}”. The default value is true. Matching braces are defined in the braces table.


INDIC_HIGHLIGHT_BACK (number)

The color, in “0xBBGGRR” format, used for an indicator for the highlighted word.


STRIP_WHITESPACE_ON_SAVE (bool)

Strip trailing whitespace on file save. The default value is true.


TYPEOVER_CHARS (bool)

Move over the typeover character under the caret when typing it instead of inserting it. The default value is true. Typeover characters are defined in the typeover_chars table.


Functions


autocomplete_word(default_words)

Displays an autocompletion list, built from the set of default_words and existing words in the buffer, for the word behind the caret, returning true if completions were found.

Parameters:

Return:

See also:


block_comment(prefix)

Comments or uncomments the selected lines with line comment prefix string prefix or the prefix from the comment_string table for the current lexer. As long as any part of a line is selected, the entire line is eligible for commenting/uncommenting.

Parameters:

See also:


convert_indentation()

Converts indentation between tabs and spaces depending on the buffer’s indentation settings. If buffer.use_tabs is true, buffer.tab_width indenting spaces are converted to tabs. Otherwise, all indenting tabs are converted to buffer.tab_width spaces.

See also:


enclose(left, right)

Encloses the selected text or the word behind the caret within strings left and right.

Parameters:


filter_through(cmd)

Passes selected or all buffer text to string shell command cmd as standard input (stdin) and replaces the input text with the command’s standard output (stdout). Standard input is as follows:

  1. If text is selected and spans multiple lines, all text on the lines containing the selection is used. However, if the end of the selection is at the beginning of a line, only the EOL (end of line) characters from the previous line are included as input. The rest of the line is excluded.
  2. If text is selected and spans a single line, only the selected text is used.
  3. If no text is selected, the entire buffer is used.

Parameters:


goto_line(line)

Goes to line number line or the user-specified line in the buffer.

Parameters:


highlight_word()

Highlights all occurrences of the selected text or the current word.

See also:


join_lines()

Joins the currently selected lines or the current line with the line below it. As long as any part of a line is selected, the entire line is eligible for joining.


match_brace(select)

Goes to the current character’s matching brace, selecting the text in-between if select is true.

Parameters:


select_enclosed(left, right)

Selects the text in-between strings left and right containing the caret. If already selected, toggles between selecting the left and right enclosures too.

Parameters:


select_indented_block()

Selects indented text blocks intelligently. If no block of text is selected, all text with the current level of indentation is selected. If a block of text is selected and the lines immediately above and below it are one indentation level lower, they are added to the selection. In all other cases, the behavior is the same as if no text is selected.


select_line()

Selects the current line.


select_paragraph()

Selects the current paragraph. Paragraphs are surrounded by one or more blank lines.


select_word()

Selects the current word.

See also:


transpose_chars()

Transposes characters intelligently. If the caret is at the end of a line, the two characters before the caret are transposed. Otherwise, the characters to the left and right are.


Tables


braces

Table of brace characters to highlight, with language-specific brace character tables assigned to a lexer name key. The ASCII values of brace characters are keys and are assigned non-nil values. The default brace characters are ‘(’, ‘)’, ‘[’, ‘]’, ‘{’, and ‘}’.

Usage:

See also:


char_matches

Map of auto-paired characters like parentheses, brackets, braces, and quotes, with language-specific auto-paired character maps assigned to a lexer name key. The ASCII values of opening characters are assigned to strings containing complement characters. The default auto-paired characters are “()”, “[]”, “{}”, “''”, and “""”.

Usage:

See also:


comment_string

Map of lexer names to line comment prefix strings for programming languages, used by the block_comment() function. Keys are lexer names and values are the line comment prefixes for the language. This table is typically populated by language-specific modules.

See also:


typeover_chars

Table of characters to move over when typed, with language-specific typeover character tables assigned to a lexer name key. The ASCII values of characters are keys and are assigned non-nil values. The default characters are ‘)’, ‘]’, ‘}’, ‘'’, and ‘"’.

Usage:

See also: