Module _m.textadept.editing

Editing commands for the textadept module.

Settings

  • AUTOPAIR: Flag indicating whether or not when an opening (, [, [, ", or ' is typed, its closing complement character is automatically inserted.
  • HIGHLIGHT_BRACES: Flag indicating whether or not when the caret is over a brace character (any of the following: ()[]{}<>), its matching complement brace is highlighted.
  • AUTOINDENT: Flag indicating whether or not when the enter key is pressed, the inserted line has is indented to match the level of indentation of the previous line.

Functions

autocomplete_word (word_chars) Pops up an autocompletion list for the current word based on other words in the document.
block_comment (comment) Block comments or uncomments code with a given comment string.
convert_indentation () Converts indentation between tabs and spaces.
current_word (action) Selects the current word under the caret and if action indicates, deletes it.
enclose (str) Encloses text in an enclosure set.
goto_line (line) Goes to the requested line.
grow_selection (amount) Grows the selection by a character amount on either end.
join_lines () Joins the current line with the line below, eliminating whitespace.
match_brace (select) Goes to a matching brace position, selecting the text inside if specified.
prepare_for_save () Prepares the buffer for saving to a file.
select_enclosed (str) Selects text in a specified enclosure.
select_indented_block () Selects indented blocks intelligently.
select_line () Selects the current line.
select_paragraph () Selects the current paragraph.
select_scope () Selects all text with the same scope/style as under the caret.
smart_cutcopy (copy) Cuts or copies text ranges intelligently.
squeeze (char) Reduces multiple characters occurances to just one.
transpose_chars () Transposes characters intelligently.

Tables

comment_string Comment strings for various lexer languages.
enclosure Enclosures for enclosing or selecting ranges of text.


Functions

autocomplete_word (word_chars)
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.
block_comment (comment)
Block comments or uncomments code with a given comment string.

Parameters

  • comment: The comment string inserted or removed from the beginning of each line in the selection.
convert_indentation ()
Converts indentation between tabs and spaces.
current_word (action)
Selects the current word under the caret and if action indicates, deletes it.

Parameters

  • action: Optional action to perform with selected word. If 'delete', it is deleted.
enclose (str)
Encloses text in an enclosure set. If text is selected, it is enclosed. Otherwise, the previous word is enclosed. The n previous words can be enclosed by appending n (a number) to the end of the last word. When enclosing with a character, append the character to the end of the word(s). To enclose previous word(s) with n characters, append n (a number) to the end of character set. Examples: enclose this2 -> 'enclose this' (enclose in sng_quotes) enclose this2**2 -> **enclose this**

Parameters

  • str: The enclosure type in enclosure.

See also:

goto_line (line)
Goes to the requested line.

Parameters

  • line: Optional line number to go to.
grow_selection (amount)
Grows the selection by a character amount on either end.

Parameters

  • amount: The amount to grow the selection on either end.
join_lines ()
Joins the current line with the line below, eliminating whitespace.
match_brace (select)
Goes to a matching brace position, selecting the text inside if specified.

Parameters

  • select: If true, selects the text between matching braces.
prepare_for_save ()
Prepares the buffer for saving to a file. Strips trailing whitespace off of every line, ensures an ending newline, and converts non-consistent EOLs.
select_enclosed (str)
Selects text in a specified enclosure.

Parameters

  • str: The enclosure type in enclosure.

See also:

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_scope ()
Selects all text with the same scope/style as under the caret.
smart_cutcopy (copy)
Cuts or copies text ranges intelligently. (Behaves like Emacs.) If no text is selected, all text from the cursor to the end of the line is cut or copied as indicated by action. If there is text selected, it is cut or copied.

Parameters

  • copy: If false, the text is cut. Otherwise it is copied.
squeeze (char)
Reduces multiple characters occurances to just one. If char is not given, the character to be squeezed is the one behind the caret.

Parameters

  • char: The character (integer) to be used for squeezing.
transpose_chars ()
Transposes characters intelligently. If the caret is at the end of the current word, the two characters before the caret are transposed. Otherwise the characters to the left and right of the caret are transposed.

Tables

comment_string
Comment strings for various lexer languages. Used for the block_comment function. This table is typically populated by language-specific modules.
enclosure
Enclosures for enclosing or selecting ranges of text. Note chars and tag enclosures are generated at runtime. You can add entries to the table in language-specific modules and use the 'enclose' function in key commands.

Valid XHTML 1.0!