Textadept
- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List
Contents
_M.textadept.editing
Editing commands for the textadept module.
Fields
AUTOINDENT
(bool)
Match the indentation level of the previous line when pressing the Enter
key.
The default value is true
.
AUTOPAIR
(bool)
Opening (
, [
, [
, "
, or '
characters are automatically closed.
The default value is true
.
HIGHLIGHT_BRACES
(bool)
Highlight matching ()[]{}
characters.
The default value is true
.
INDIC_HIGHLIGHT_ALPHA
(number)
The alpha transparency value between 0
(transparent) and 255
(opaque)
used for an indicator for a highlighted word.
The default value is 100
.
INDIC_HIGHLIGHT_BACK
(number)
The color used for an indicator for a highlighted word in 0xBBGGRR
format.
MARK_HIGHLIGHT_BACK
(number)
The background color used for a line containing a highlighted word in
0xBBGGRR
format.
STRIP_WHITESPACE_ON_SAVE
(bool)
Strip trailing whitespace on file save.
The default value is true
.
Functions
autocomplete_word
(word_chars, default_words)
Pops up an autocompletion list for the current word based on other words in the document.
Parameters:
word_chars
: String of chars considered to be part of words.default_words
: Optional list of words considered to be in the document, even if they are not. Words may contain registered images.
Return:
true
if there were completions to show;false
otherwise.
block_comment
(comment)
Block comments or uncomments code with a given comment string.
If none is specified, uses the comment_string
table.
Parameters:
comment
: The comment string inserted or removed from the beginning of each line in the selection.
See also:
convert_indentation
()
Converts indentation between tabs and spaces.
enclose
(left, right)
Encloses text within a given pair of strings. If text is selected, it is enclosed. Otherwise, the previous word is enclosed.
Parameters:
left
: The left part of the enclosure.right
: The right part of the enclosure.
goto_line
(line)
Goes to the requested line.
Parameters:
line
: Optional line number to go to. Ifnil
, the user is prompted for one.
grow_selection
(amount)
Grows the selection by a character amount on either end.
Parameters:
amount
: The amount to grow the selection on either end.
highlight_word
()
Highlights all occurances of the word under the caret and adds markers to the lines they are on.
join_lines
()
Joins the currently selected lines. If no lines are selected, joins the current line with the line below.
match_brace
(select)
Goes to a matching brace position, selecting the text inside if specified to.
Parameters:
select
: Iftrue
, selects the text between matching braces.
prepare_for_save
()
Prepares the buffer for saving to a file.
Strips trailing whitespace off of every line if STRIP_WHITESPACE_ON_SAVE
is
true
, ensures an ending newline, and converts non-consistent EOLs.
See also:
select_enclosed
(left, right)
Selects text between a given pair of strings.
Parameters:
left
: The left part of the enclosure.right
: The right part of the enclosure.
select_indented_block
()
Selects indented 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 to the top and bottom of 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 delimited by two or more consecutive newlines.
select_word
()
Selects the current word under the caret.
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
Highlighted brace characters. Keys are lexer language names and values are tables of characters that count as brace characters. This table can be populated by language-specific modules. The defaults are ‘(’, ‘)’, ‘[’, ‘]’, ‘{’, and ‘}’.
Usage:
_M.textadept.editing.braces.hypertext = { ..., [60] = 1, [62] = 1 }
See also:
char_matches
Auto-matched characters. Used for auto-matching parentheses, brackets, braces, quotes, etc. Keys are lexer language names and values are tables of character match pairs. This table can be populated by language-specific modules. The defaults are ‘()’, ‘[]’, ‘{}’, ‘’‘’, and ‘“”’.
Usage:
_M.textadept.editing.char_matches.hypertext = { ..., [60] = '>' }
See also:
comment_string
Comment strings for various lexer languages.
Used by the block_comment()
function. Keys are lexer language names and
values are the line comment delimiters for the language. This table is
typically populated by language-specific modules.
See also: