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.
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.
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. |
show_call_tip (api, start) | Displays a call tip based on the word to the left of the cursor and a given API table. |
smart_cutcopy (copy) | Cuts or copies text ranges intelligently. |
smart_paste (action, reindent) | Retrieves the top item off the kill-ring and pastes it. |
squeeze (char) | Reduces multiple characters occurances to just one. |
transpose_chars () | Transposes characters intelligently. |
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.
- show_call_tip (api, start)
-
Displays a call tip based on the word to the left of the cursor and a given API table.
Parameters
- api: Table of functions call tips can be displayed for. Each key is a function name, and each value is a table of tables. Each of those tables represents a function. It has 2 indexes: parameters and a description. This enables call tips for 'overloaded' functions. Even if there is just one function, it must be enclosed in a table. You can get an API table from a file via textadept.io.read_api_file().
- start: Flag indicating whether or not to start a call tip. If the user clicks an arrow, you should call show_call_tip again with this value being false to display the next function.
See also:
- 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 and pushed onto the kill-ring. If there is text selected, it is cut or copied and pushed onto the kill-ring.
Parameters
- copy: If false, the text is cut. Otherwise it is copied.
See also:
- smart_paste (action, reindent)
-
Retrieves the top item off the kill-ring and pastes it. If an action is specified, the text is kept selected for scrolling through the kill-ring.
Parameters
- action: If given, specifies whether to cycle through the kill-ring in normal or reverse order. A value of 'cycle' cycles through normally, 'reverse' in reverse.
- reindent: Flag indicating whether or not to reindent the pasted text.
See also:
- squeeze (char)
-
Reduces multiple characters occurances to just one. If char is not given, the character to be squeezed is the one under 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.