From 92a1e1cae3029a3c4dde56c8dcc5d212fdc11e26 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 26 Aug 2013 22:36:10 -0400 Subject: Renamed `_M.textadept` to `textadept`; `_M` is for language modules only now. --- core/._M.luadoc | 32 ++-- core/.buffer.luadoc | 337 +++++++++++++++++++-------------------- core/init.lua | 2 +- core/keys.lua | 2 +- core/ui.lua | 14 +- doc/03_UserInterface.md | 2 +- doc/05_FileNavigation.md | 2 +- doc/06_AdeptEditing.md | 2 +- doc/07_Modules.md | 2 +- doc/08_Preferences.md | 24 +-- doc/14_Appendix.md | 39 ++--- init.lua | 2 +- modules/cpp/init.lua | 16 +- modules/lua/init.lua | 14 +- modules/textadept/adeptsense.lua | 34 ++-- modules/textadept/bookmarks.lua | 6 +- modules/textadept/editing.lua | 8 +- modules/textadept/file_types.lua | 2 +- modules/textadept/find.lua | 4 +- modules/textadept/init.lua | 4 +- modules/textadept/keys.lua | 105 ++++++------ modules/textadept/menu.lua | 96 +++++------ modules/textadept/run.lua | 4 +- modules/textadept/session.lua | 6 +- modules/textadept/snippets.lua | 4 +- 25 files changed, 374 insertions(+), 389 deletions(-) diff --git a/core/._M.luadoc b/core/._M.luadoc index 89c0cb57..587898c9 100644 --- a/core/._M.luadoc +++ b/core/._M.luadoc @@ -4,7 +4,7 @@ --[[ This comment is for LuaDoc. --- --- A table of loaded Lua modules used by Textadept. +-- A table of loaded Textadept language modules. -- -- ## Module Guidelines -- @@ -27,27 +27,27 @@ -- -- The `Ctrl+Shift+R` and `Ctrl+R` (`⌘⇧R` and `⌘R` on Mac OSX | `M-^R` and `^R` -- in curses) key bindings compile and run code, respectively. In order for --- these to work for your language, the [`_M.textadept.run.compile_command`][] --- and [`_M.textadept.run.run_command`][] tables must have keys with the --- language's lexer name assigned to compile and run shell commands, --- respectively. Commands may contain [macros][]. For Lua, it would look like +-- these to work for your language, the [`textadept.run.compile_command`][] and +-- [`textadept.run.run_command`][] tables must have keys with the language's +-- lexer name assigned to compile and run shell commands, respectively. Commands +-- may contain [macros][]. For Lua, it would look like -- --- _M.textadept.run.compile_command.lua = 'luac %(filename)' --- _M.textadept.run.run_command = 'lua %(filename)' +-- textadept.run.compile_command.lua = 'luac %(filename)' +-- textadept.run.run_command = 'lua %(filename)' -- -- The module should also define error details in --- [`_M.textadept.run.error_detail`][] so double-clicking on compile or runtime +-- [`textadept.run.error_detail`][] so double-clicking on compile or runtime -- errors jumps to the error's location. The format for Lua errors looks like -- --- _M.textadept.run.error_detail.lua = { +-- textadept.run.error_detail.lua = { -- pattern = '^lua: (.-):(%d+): (.+)$', -- filename = 1, line = 2, message = 3 -- } -- --- [`_M.textadept.run.compile_command`]: _M.textadept.run.html#compile_command --- [`_M.textadept.run.run_command`]: _M.textadept.run.html#run_command --- [macros]: _M.textadept.run.html#execute --- [`_M.textadept.run.error_detail`]: _M.textadept.run.html#error_detail +-- [`textadept.run.compile_command`]: textadept.run.html#compile_command +-- [`textadept.run.run_command`]: textadept.run.html#run_command +-- [macros]: textadept.run.html#execute +-- [`textadept.run.error_detail`]: textadept.run.html#error_detail -- -- #### Buffer Properties -- @@ -70,7 +70,7 @@ -- documentation, respectively, when editing code. In order for these to work -- for your language, you must create an [Adeptsense][]. -- --- [Adeptsense]: _M.textadept.adeptsense.html +-- [Adeptsense]: textadept.adeptsense.html -- -- #### Snippets -- @@ -84,7 +84,7 @@ -- forp = "for %1(k), %2(v) in pairs(%3(table)) do\n\t%0\nend", -- } -- --- [Snippets]: _M.textadept.snippets.html +-- [Snippets]: textadept.snippets.html -- -- #### Commands -- @@ -127,5 +127,5 @@ -- {'Autocomplete "end"', M.try_to_autocomplete_end} -- } -- --- [context menus]: _M.textadept.menu.html#set_contextmenu +-- [context menus]: textadept.menu.html#set_contextmenu module('_M')]] diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index cc6fa1d9..7dabd916 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -73,7 +73,7 @@ -- The default value is `true`. -- @field auto_c_cancel_at_start (bool) -- Cancel autocompletion when backspacing to a position before where --- autocompletion started, rather than before the word being completed. +-- autocompletion started instead of before the word being completed. -- The default value is `true`. -- @field auto_c_case_insensitive_behaviour (number) -- The behavior mode for case insensitive autocompletion when @@ -96,7 +96,7 @@ -- Delete word characters after autocompleted text. -- The default value is `false`. -- @field auto_c_fill_ups (string, Write-only) --- A set of characters that choose the currently selected item in an +-- The set of characters that choose the currently selected item in an -- autocompletion list when typed. -- The default value is an empty string. -- @field auto_c_ignore_case (bool) @@ -124,7 +124,7 @@ -- -- The default value is `buffer.SC_ORDER_PRESORTED`. -- @field auto_c_separator (number) --- The character byte that separates autocompletion list items. +-- The byte value of the character that separates autocompletion list items. -- The default value is `32` (' '). -- @field auto_c_type_separator (number) -- The character byte that separates autocompletion list items and their @@ -150,10 +150,10 @@ -- The foreground color, in "0xBBGGRR" format, of the highlighted part of -- call tips. -- @field call_tip_position (boolean) --- Display the call tip above, rather than below the text. +-- Display the call tip above instead of below the text. -- The default value is `false`. -- @field call_tip_use_style (number) --- The size in pixels of tab characters in call tips. +-- The pixel size of tab characters in call tips. -- When non-zero, also enables the use of style number `buffer.STYLE_CALLTIP` -- instead of `buffer.STYLE_DEFAULT` for call tip styles. -- The default value is `0`. @@ -174,7 +174,7 @@ -- The default value is `false`, showing the line only when the window is in -- focus. -- @field caret_period (number) --- The time in milliseconds between caret blinks. +-- The time between caret blinks in milliseconds. -- A value of `0` stops blinking. -- The default value is `500`. -- @field caret_sticky (number) @@ -191,7 +191,7 @@ -- -- The default value is `buffer.SC_CARETSTICKY_OFF`. -- @field caret_style (number) --- The style of caret to draw. +-- The visual style of the caret. -- -- * `buffer.CARETSTYLE_INVISIBLE` -- No caret. @@ -219,14 +219,14 @@ -- The position of the caret. -- When set, does not scroll the caret into view. -- @field cursor (number) --- The cursor type. +-- The display cursor type. -- -- * `buffer.SC_CURSORNORMAL` --- The normal text insert cursor. +-- The text insert cursor. -- * `buffer.SC_CURSORARROW` -- The arrow cursor. -- * `buffer.SC_CURSORWAIT` --- The wait symbol cursor. +-- The wait cursor. -- * `buffer.SC_CURSORREVERSEARROW` -- The reversed arrow cursor. -- @@ -235,11 +235,11 @@ -- Whether or not the buffer has unsaved changes. -- This field is accessible from any buffer, not just the global one. -- @field edge_colour (number) --- The color, in "0xBBGGRR" format, of the long line marker. +-- The color, in "0xBBGGRR" format, marking long lines. -- @field edge_column (number) --- The column number to display the long line marker at. +-- The column number to start marking long lines at. -- @field edge_mode (number) --- The long line edge mode. +-- The long line mark mode. -- -- * `buffer.EDGE_NONE` -- Long lines are not marked. @@ -265,11 +265,11 @@ -- line endings. Use [`buffer:convert_eo_ls()`](#convert_eo_ls) to do so. -- -- * `buffer.SC_EOL_CRLF` --- "CR+LF" ("\r\n"). +-- Carriage return with line feed ("\r\n"). -- * `buffer.SC_EOL_CR` --- "CR" ("\r"). +-- Carriage return ("\r"). -- * `buffer.SC_EOL_LF` --- "LF" ("\n"). +-- Line feed ("\n"). -- -- The default value is `buffer.SC_EOL_CRLF` on Windows platforms, -- `buffer.SC_EOL_LF` otherwise. @@ -333,8 +333,9 @@ -- Limit hotspots to a single line. -- The default value is `true`. -- @field indent (number) --- The number of spaces of one level of indentation. --- The default value is `0`, which matches the tab width. +-- The number of spaces in one level of indentation. +-- The default value is `0`, which uses the value of +-- [`buffer.tab_width`](#tab_width). -- @field indentation_guides (number) -- The indentation guide drawing mode. -- Indentation guides are dotted vertical lines that appear within indentation @@ -414,11 +415,11 @@ -- -- [`_SCINTILLA.next_indic_number()`]: _SCINTILLA.html#next_indic_number -- @field indic_under (table) --- Table of flags indicating whether or not to draw indicators behind text or --- over the top of it for indicator numbers from `0` to `31`. +-- Table of flags indicating whether or not to draw indicators behind text +-- instead of over the top of it for indicator numbers from `0` to `31`. -- For values to be `true`, [`buffer.two_phase_draw`](#two_phase_draw) must be -- `true`. --- The default values are `false` for drawing indicators over text. +-- The default values are `false`. -- @field indicator_current (number) -- The indicator number in the range of `0` to `31` used by -- [`buffer:indicator_fill_range()`](#indicator_fill_range) and @@ -435,8 +436,8 @@ -- Table of positions at the ends of indentation for line numbers starting -- from zero. -- @field line_indentation (table) --- Table of indentation amounts, measured in character columns, for line --- numbers starting from zero. +-- Table of indentation amounts in character columns, for line numbers +-- starting from zero. -- @field line_state (table) -- Table of integer line states for line numbers starting from zero. -- Line states are used for storing longer lived parse states per line. They @@ -452,7 +453,7 @@ -- The number of the main, or most recent, selection. -- Only an existing selection can be made main. -- @field margin_cursor_n (table) --- Table of cursors shown for margin numbers from zero to four. +-- Table of cursor types shown over margin numbers from zero to four. -- -- * `buffer.SC_CURSORARROW` -- Normal arrow cursor. @@ -461,7 +462,7 @@ -- -- The default values are `buffer.SC_CURSORREVERSEARROW`. -- @field margin_left (number) --- The size in pixels of the left margin of the buffer text. +-- The pixel size of the left margin of the buffer text. -- The default value is `1`. -- @field margin_mask_n (table) -- Table of bit-masks of markers that symbol margins can display for margin @@ -481,7 +482,7 @@ -- -- The default value is `buffer.SC_MARGINOPTION_NONE`. -- @field margin_right (number) --- The size in pixels of the right margin of the buffer text. +-- The pixel size of the right margin of the buffer text. -- The default value is `1`. -- @field margin_sensitive_n (table) -- Table of flags indicating whether or not mouse clicks in margins emit @@ -503,7 +504,8 @@ -- looking up the style. -- The default value is `0`. -- @field margin_text (table) --- Table of text in the text margin for line numbers starting from zero. +-- Table of text displayed in text margins for line numbers starting from +-- zero. -- @field margin_type_n (table) -- Table of margin types for margin numbers from zero to four. -- @@ -525,7 +527,7 @@ -- The default values are `true`, `false`, `false`, `false`, and `false`, for -- a line number margin and symbol margins. -- @field margin_width_n (table) --- Table of margin widths in pixels for margin numbers from zero to four. +-- Table of pixel margin widths for margin numbers from zero to four. -- @field marker_alpha (table, Write-only) -- Table of alpha values, ranging from `0` (transparent) to `255` (opaque), -- of markers drawn in the text area, not the margin, for markers numbers from @@ -544,8 +546,9 @@ -- @field max_line_state (number, Read-only) -- The last line number with a non-zero line state. -- @field mouse_dwell_time (number) --- The number of milliseconds the mouse must idle in order to generate a --- `DWELL_START` event, or `buffer.SC_TIME_FOREVER` to never generate one. +-- The number of milliseconds the mouse must idle before generating a +-- `DWELL_START` event. A time of `buffer.SC_TIME_FOREVER` will never generate +-- one. -- @field multi_paste (number) -- The multiple selection paste mode. -- @@ -570,7 +573,7 @@ -- Map of key-value pairs used by lexers with values interpreted as numbers, -- or `0` if not found. -- @field punctuation_chars (string) --- The set of characters considered to be punctuation characters. +-- The string set of characters recognized as punctuation characters. -- Set this only after setting [`buffer.word_chars`](#word_chars). -- The default value is a string containing all characters not considered to -- be whitespace or word characters. @@ -633,7 +636,7 @@ -- * `buffer.SCFIND_MATCHCASE` -- Match text case sensitively. -- * `buffer.SCFIND_WORDSTART` --- Match text when the previous character is a non-word character. +-- Match text only when the previous character is a non-word character. -- * `buffer.SCFIND_REGEXP` -- Interpret the search string as a regular expression. -- * `buffer.SCFIND_POSIX` @@ -656,10 +659,8 @@ -- Matches one or more of the previous match. -- * `\<` -- Matches the beginning of a word. --- [`buffer.word_chars`](#word_chars) defines word characters. -- * `\>` -- Matches the end of a word. --- [`buffer.word_chars`](#word_chars) defines word characters. -- * `^` -- Matches the start of a line unless inside a set. -- * `$` @@ -730,15 +731,15 @@ -- @field style_at (table, Read-only) -- Table of style numbers at positions in the buffer starting from zero. -- @field style_back (table) --- Table of background colors, in "0xBBGGRR" format, for text within styles --- for style numbers from `0` to `255`. +-- Table of background colors, in "0xBBGGRR" format, of text within styles for +-- style numbers from `0` to `255`. -- @field style_bold (table) -- Table of flags indicating whether or not text within styles has a bold font -- face for style numbers from `0` to `255`. -- The default values are `false`. -- @field style_case (table) --- Table of letter case modes for text within styles for style numbers from --- `0` to `255`. +-- Table of letter case modes of text within styles for style numbers from `0` +-- to `255`. -- -- * `buffer.SC_CASE_MIXED` -- Display text in normally. @@ -760,11 +761,11 @@ -- of the view for style numbers from `0` to `255`. -- The default values are `false`. -- @field style_font (table) --- Table of string font faces for text within styles for style numbers from +-- Table of string font faces of text within styles for style numbers from -- `0` to `255`. -- @field style_fore (table) --- Table of foreground colors, in "0xBBGGRR" format, for text within styles --- for style numbers from `0` to `255`. +-- Table of foreground colors, in "0xBBGGRR" format, of text within styles for +-- style numbers from `0` to `255`. -- @field style_hot_spot (table) -- Table of flags indicating whether or not text within styles is clickable -- for style numbers from `0` to `255`. @@ -774,8 +775,8 @@ -- font face for style numbers from `0` to `255`. -- The default values are `false`. -- @field style_size (table) --- Table of font sizes, expressed in whole number points, for text within --- styles for style numbers from `0` to `255`. +-- Table of font sizes of text within styles for style numbers from `0` to +-- `255`. -- @field style_underline (table) -- Table of flags indicating whether or not text within styles has an -- underlined font face for style numbers from `0` to `255`. @@ -791,7 +792,7 @@ -- The number of space characters represented by a tab character. -- The default value is `8`. -- @field tag (table, Read-only) --- List of tag match values from a regular expression search. +-- List of values for tag match numbers from a regular expression search. -- @field target_end (number) -- The position of the end of the target range. -- This is also set by a successful @@ -812,9 +813,9 @@ -- the undo buffer with the buffer text. -- The default value is `true`. -- @field use_tabs (bool) --- Use tabs, rather than spaces in indentation. Changing the setting does not +-- Use tabs instead of spaces in indentation. Changing the setting does not -- convert existing indentation. Use --- [`_M.textadept.editing.convert_indentation()`][] to do so. +-- [`textadept.editing.convert_indentation()`][] to do so. -- The default value is `true`. -- @field v_scroll_bar (bool) -- Display the vertical scroll bar. @@ -845,18 +846,16 @@ -- -- The default value is `buffer.SCVS_NONE`. -- @field whitespace_chars (string) --- The set of characters considered to be whitespace characters when moving --- or selecting text by word. +-- The string set of characters recognized as whitespace characters. -- Set this only after setting [`buffer.word_chars`](#word_chars). -- The default value is a string containing all non-newline characters less -- than ASCII value 33. -- @field whitespace_size (number) --- The pixel size of the dots in pixels used to represent space characters --- when whitespace is visible. +-- The pixel size of the dots representing space characters when whitespace is +-- visible. -- The default value is `1`. -- @field word_chars (string) --- The set of characters considered to be word characters when moving or --- selecting text by word. +-- The string set of characters recognized as word characters. -- The default value is a string containing alphanumeric characters, an -- underscore, and all characters greater than ASCII value 127. -- @field wrap_indent_mode (number) @@ -919,15 +918,14 @@ -- Negative values are allowed. -- The default value is `0`. -- --- [`_M.textadept.editing.convert_indentation()`]: _M.textadept.editing.html#convert_indentation +-- [`textadept.editing.convert_indentation()`]: textadept.editing.html#convert_indentation module('buffer') --- --- Selects the change of text from *start_pos* to *end_pos* as the main --- selection, retaining all other selections as additional selections. --- Even if no text is selected, the current position counts as an empty --- selection. Use `buffer:set_selection()` first when setting a list of --- selections. +-- Selects the range of text between positions *start_pos* to *end_pos* as the +-- main selection, retaining all other selections as additional selections. +-- Since an empty selection still counts as a selection, use +-- `buffer:set_selection()` first when setting a list of selections. -- @param buffer The global buffer. -- @param end_pos The caret position of the range of text to select in *buffer*. -- @param start_pos The anchor position of the range of text to select in @@ -935,8 +933,8 @@ module('buffer') function add_selection(buffer, end_pos, start_pos) end --- --- Adds string *text* to the buffer at the caret and moves the caret to the end --- of the added text, but does not scroll it into view. +-- Adds string *text* to the buffer at the caret position and moves the caret to +-- the end of the added text without scrolling it into view. -- @param buffer The global buffer. -- @param text The text to add. function add_text(buffer, text) end @@ -958,14 +956,14 @@ function allocate_extended_styles(buffer, num_styles) end function annotation_clear_all(buffer) end --- --- Appends string *text* to the end of the buffer without changing the selected --- text or scrolling the text into view. +-- Appends string *text* to the end of the buffer without modifying any existing +-- selections or scrolling the text into view. -- @param buffer The global buffer. -- @param text The text to append. function append_text(buffer, text) end --- --- Returns whether or not an autocompletion list is visible. +-- Returns whether or not the autocompletion list is visible. -- @param buffer The global buffer. -- @return bool function auto_c_active(buffer) end @@ -976,7 +974,7 @@ function auto_c_active(buffer) end function auto_c_cancel(buffer) end --- --- Autocompletes the selected word in the list. +-- Autocompletes the selected word in the autocompletion list. -- @param buffer The global buffer. function auto_c_complete(buffer) end @@ -988,16 +986,16 @@ function auto_c_pos_start(buffer) end --- -- Selects the first item in the autocompletion list that starts with *string*, --- considering case sensitiveness depending on `buffer.auto_c_ignore_case`. +-- considering case sensitiveness based on `buffer.auto_c_ignore_case`. -- @param buffer The global buffer. -- @param string The item in the list to select. function auto_c_select(buffer, string) end --- --- Displays an autocompletion list from *item_list*, a sorted string whose items --- are delimited by `buffer.auto_c_separator` characters, using *len_entered* --- number of characters behind the caret as the prefix of the word to --- autocomplete. +-- Displays an autocompletion list constructed from string *item_list*, whose +-- items are delimited by `buffer.auto_c_separator` characters, using +-- *len_entered* number of characters behind the caret as the prefix of the word +-- to autocomplete. -- The sorted order of *item_list*, `buffer.auto_c_order`, must have already -- been defined. -- @param buffer The global buffer. @@ -1008,8 +1006,8 @@ function auto_c_select(buffer, string) end function auto_c_show(buffer, len_entered, item_list) end --- --- Defines *chars* as the set of characters that cancel autocompletion when --- typed. +-- Defines string *chars* as the set of characters that cancel autocompletion +-- when typed. -- The default set is an empty string. -- @param buffer The global buffer. -- @param chars The string of characters that cancel autocompletion. This string @@ -1017,7 +1015,7 @@ function auto_c_show(buffer, len_entered, item_list) end function auto_c_stops(buffer, chars) end --- --- Dedents the selected lines. +-- Un-indents the text on the selected lines. -- @param buffer The global buffer. function back_tab(buffer) end @@ -1075,7 +1073,7 @@ function brace_highlight_indicator(buffer, use_indicator, indic_num) end function brace_match(buffer, pos) end --- --- Returns whether or not a call tip is visible. +-- Returns whether or not the call tip is visible. -- @param buffer The global buffer. -- @return bool function call_tip_active(buffer) end @@ -1092,8 +1090,8 @@ function call_tip_cancel(buffer) end function call_tip_pos_start(buffer) end --- --- Highlights call tip text from *start_pos*, starting from zero, to *end_pos* --- with the color `buffer.call_tip_fore_hlt`. +-- Highlights the call tip text between positions *start_pos*, starting from +-- zero, to *end_pos* with the color `buffer.call_tip_fore_hlt`. -- @param buffer The global buffer. -- @param start_pos The start position in the call tip text to highlight. -- @param end_pos The end position in the call tip text to highlight. @@ -1134,7 +1132,7 @@ function can_undo(buffer) end function cancel(buffer) end --- --- Tells the lexer to re-process the range of text from *start_pos* to +-- Tells the lexer to re-process the range of text between *start_pos* and -- *end_pos*. -- @param buffer The global buffer. -- @param start_pos The start position of the range of text in *buffer* to @@ -1161,7 +1159,7 @@ function char_left_extend(buffer) end function char_left_rect_extend(buffer) end --- --- Returns the character position closest to view coordinates *x* and *y*. +-- Returns the position closest to view coordinates *x* and *y*. -- @param buffer The global buffer. -- @param x The x-coordinate in the view to use. -- @param y The y-coordinate in the view to use. @@ -1169,8 +1167,8 @@ function char_left_rect_extend(buffer) end function char_position_from_point(buffer, x, y) end --- --- Returns the character position closest to view coordinates *x* and *y*, or --- `-1` if the point is outside the window or not close to any text. +-- Returns the position closest to view coordinates *x* and *y*, or `-1` if the +-- point is outside the window or not close to any text. -- @param buffer The global buffer. -- @param x The x-coordinate in the view to use. -- @param y The y-coordinate in the view to use. @@ -1228,7 +1226,7 @@ function clear_registered_images(buffer) end function clear_selections(buffer) end --- --- Tells the lexer to style and fold the range of text from *start_pos* to +-- Tells the lexer to style and fold the range of text between *start_pos* and -- *end_pos*. -- If *end_pos* is `-1`, styles and folds to the end of the buffer. -- @param buffer The global buffer. @@ -1269,7 +1267,8 @@ function copy(buffer) end function copy_allow_line(buffer) end --- --- Copies the range of text from *start_pos* to *end_pos* to the clipboard. +-- Copies the range of text between positions *start_pos* and *end_pos* to the +-- clipboard. -- @param buffer The global buffer. -- @param start_pos The start position of the range of text in *buffer* to copy. -- @param end_pos The end position of the range of text in *buffer* to copy. @@ -1282,7 +1281,7 @@ function copy_range(buffer, start_pos, end_pos) end function copy_text(buffer, text) end --- --- Returns the number of whole characters in-between positions *start_pos* and +-- Returns the number of whole characters between positions *start_pos* and -- *end_pos*. -- @param buffer The global buffer. -- @param start_pos The start position of the range of text in *buffer* to start @@ -1343,7 +1342,8 @@ function delete_back(buffer) end function delete_back_not_line(buffer) end --- --- Deletes the range of text from *pos* to *pos* + *length* in the buffer. +-- Deletes the range of text from position *pos* to *pos* + *length* in the +-- buffer. -- @param buffer The global buffer. -- @param pos The start position of the range of text in *buffer* to delete. -- @param length The number of characters in the range of text to delete. @@ -1466,7 +1466,7 @@ function fold_children(buffer, line, action) end function fold_line(buffer, line, action) end --- --- Inserts a Form Feed ("\f") character at the caret. +-- Inserts a Form Feed ("\f") character at the caret position. -- @param buffer The global buffer. function form_feed(buffer) end @@ -1478,13 +1478,13 @@ function form_feed(buffer) end function get_cur_line(buffer) end --- --- Returns the numeric background color for active hotspots. +-- Returns the numeric background color of active hotspots. -- @param buffer The global buffer. -- @return number function get_hotspot_active_back(buffer) end --- --- Returns the numeric foreground color for active hotspots. +-- Returns the numeric foreground color of active hotspots. -- @param buffer The global buffer. -- @return number function get_hotspot_active_fore(buffer) end @@ -1499,8 +1499,7 @@ function get_hotspot_active_fore(buffer) end function get_last_child(buffer, start_line, level) end --- --- Returns the text on line number *line*, including end of line characters, and --- the length of the line. +-- Returns the text on line number *line*, including end of line characters. -- @param buffer The global buffer. -- @param line The line number in *buffer* to use. -- @return string, number @@ -1521,7 +1520,7 @@ function get_line_sel_end_position(buffer, line) end function get_line_sel_start_position(buffer, line) end --- --- Returns the selected text and its length. +-- Returns the selected text. -- Multiple selections are included in order with no delimiters. Rectangular -- selections are included from top to bottom with line ending delimiters. -- Virtual space is not included. @@ -1530,19 +1529,19 @@ function get_line_sel_start_position(buffer, line) end function get_sel_text(buffer) end --- --- Returns all of the text in the buffer and its length. +-- Returns all of the text in the buffer. -- @param buffer The global buffer. function get_text(buffer) end --- --- Places the caret an anchor at the beginning of line number *line* and scrolls --- them into view. +-- Moves the caret to the beginning of line number *line* and scrolls it into +-- view. -- @param buffer The global buffer. -- @param line The line number in *buffer* to go to. function goto_line(buffer, line) end --- --- Places the caret and anchor at position *pos* and scrolls them into view. +-- Moves the caret to position *pos* and scrolls it into view. -- @param buffer The global buffer. -- @param pos The position in *buffer* to go to. function goto_pos(buffer, pos) end @@ -1557,10 +1556,10 @@ function goto_pos(buffer, pos) end function hide_lines(buffer, start_line, end_line) end --- --- Do not highlight selected text if *normal* is `true`. +-- Do not highlight selected text if *hide* is `true`. -- @param buffer The global buffer. --- @param normal Whether or not to draw the normal selection. -function hide_selection(buffer, normal) end +-- @param hide Whether or not to hide the selection. +function hide_selection(buffer, hide) end --- -- Moves the caret to the beginning of the current line. @@ -1610,8 +1609,8 @@ function home_wrap_extend(buffer) end function indicator_all_on_for(buffer, pos) end --- --- Clears indicator `buffer.indicator_current` over the range of text from *pos* --- to *pos* + *clear_length*. +-- Clears indicator `buffer.indicator_current` over the range of text from +-- position *pos* to *pos* + *clear_length*. -- @param buffer The global buffer. -- @param pos The start position of the range of text in *buffer* to clear -- indicators over. @@ -1628,8 +1627,8 @@ function indicator_clear_range(buffer, pos, clear_length) end function indicator_end(buffer, indicator, pos) end --- --- Sets indicator `buffer.indicator_current` over the range of text from *pos* --- to *pos* + *fill_length*. +-- Sets indicator number `buffer.indicator_current` over the range of text from +-- position *pos* to *pos* + *fill_length*. -- @param buffer The global buffer. -- @param pos The start position of the range of text in *buffer* to set -- indicators over. @@ -1646,7 +1645,8 @@ function indicator_fill_range(buffer, pos, fill_length) end function indicator_start(buffer, indicator, pos) end --- --- Inserts string *text* at position *pos* or the caret if *pos* is `-1`. +-- Inserts string *text* at position *pos* or the caret position if *pos* is +-- `-1`. -- If the caret is after the *pos*, it is moved appropriately, but not scrolled -- into view. -- @param buffer The global buffer. @@ -1688,7 +1688,7 @@ function line_down_extend(buffer) end function line_down_rect_extend(buffer) end --- --- Duplicates the current line below the line. +-- Duplicates the current line on a new line below. -- @param buffer The global buffer. function line_duplicate(buffer) end @@ -1770,7 +1770,7 @@ function line_scroll_down(buffer) end function line_scroll_up(buffer) end --- --- Switch the current line with the previous one. +-- Switches the current line with the previous one. -- @param buffer The global buffer. function line_transpose(buffer) end @@ -1791,17 +1791,17 @@ function line_up_extend(buffer) end function line_up_rect_extend(buffer) end --- --- Joins the lines in the target range, inserting spaces in-between joined --- words. +-- Joins the lines in the target range, inserting spaces between joined +-- words at line boundaries. -- @param buffer The global buffer. function lines_join(buffer) end --- --- Splits the lines in the target range into lines of width at most --- *pixel_width* or the width of the view if *pixel_width* is `0`. +-- Splits the lines in the target range into lines at most *width* pixels wide, +-- or if *width* is `0`, lines as wide as the view. -- @param buffer The global buffer. --- @param pixel_width The pixel width to split lines at. When `0`, uses the --- width of the view. +-- @param width The pixel width to split lines at. When `0`, uses the width of +-- the view. function lines_split(buffer, pixel_width) end --- @@ -1964,8 +1964,7 @@ function marker_previous(buffer, start_line, marker_mask) end function marker_symbol_defined(buffer, marker_num) end --- --- Moves the caret to be visible inside the view if it is not already, removing --- any selections. +-- Moves the caret into view if it is not already, removing any selections. -- @param buffer The global buffer. function move_caret_inside_view(buffer) end @@ -1980,8 +1979,8 @@ function move_selected_lines_down(buffer) end function move_selected_lines_up(buffer) end --- --- Inserts a new line character(s) at the caret depending on the end of line --- mode. +-- Inserts a new line at the caret position based on +-- [`buffer.eol_mode`](#eol_mode). -- @param buffer The global buffer. function new_line(buffer) end @@ -2045,7 +2044,7 @@ function para_up(buffer) end function para_up_extend(buffer) end --- --- Pastes the contents of the clipboard into the buffer, replacing the selected +-- Pastes the contents of the clipboard into the buffer, replacing any selected -- text depending on `buffer.multi_paste`. -- @param buffer The global buffer. function paste(buffer) end @@ -2087,25 +2086,6 @@ function position_before(buffer, pos) end -- @return number function position_from_line(buffer, line) end ---- --- Returns the position closest to view coordinates *x* and *y*, which may be --- in-between multi-byte characters. --- @param buffer The global buffer. --- @param x The x-coordinate in the view to use. --- @param y The y-coordinate in the view to use. --- @return number -function position_from_point(buffer, x, y) end - ---- --- Returns the position closest to view coordinates *x* and *y*, which may be --- in-between multi-byte characters, or `-1` if the point is outside the window --- or not close to any text. --- @param buffer The global buffer. --- @param x The x-coordinate in the view to use. --- @param y The y-coordinate in the view to use. --- @return number -function position_from_point_close(buffer, x, y) end - --- -- Redoes the next undone action. -- @param buffer The global buffer. @@ -2145,8 +2125,7 @@ function release_all_extended_styles(buffer) end function replace_sel(buffer, text) end --- --- Replaces the text in the target range with string *text*, returning the --- length of *text*. +-- Replaces the text in the target range with string *text*. -- The recommended way to delete text in the buffer is to set the target to the -- text to be removed, and to call this function with an empty string. -- @param buffer The global buffer. @@ -2155,10 +2134,10 @@ function replace_sel(buffer, text) end function replace_target(buffer, text) end --- --- Replaces the text in the target range with string *text* after replacing any --- "\d" sequences, where `d` is a number in the range of `1` to `9`, with the --- tag match values from the regular expression or the entire match for "\0", --- returning the length of the replacement text. +-- Replaces the text in the target range with string *text* but first replaces +-- any "\d" sequences with the value of tag match number *d* from the regular +-- expression (or the entire match for *d* = 0), and then returns the length of +-- the replacement text. -- @param buffer The global buffer. -- @param text The text to replace the target range with. -- @return number @@ -2178,8 +2157,8 @@ function rotate_selection(buffer) end function scroll_caret(buffer) end --- --- Scrolls the range between *primary_pos* and *secondary_pos* into view, with --- priority given to *primary_pos*. +-- Scrolls the range of text between positions *primary_pos* and *secondary_pos* +-- into view, with priority given to *primary_pos*. -- Similar to `buffer:scroll_caret()`, but with *primary_pos* instead of -- `buffer.current_pos`. -- This is useful for scrolling search results into view. @@ -2199,8 +2178,8 @@ function scroll_to_end(buffer) end function scroll_to_start(buffer) end --- --- Sets the current position to anchor subsequent searches with --- `buffer:search_next()` and `buffer:search_prev()`. +-- Sets the position `buffer:search_next()` and `buffer:search_prev()` begin at +-- to the caret position. -- @param buffer The global buffer. function search_anchor(buffer) end @@ -2244,13 +2223,14 @@ function search_prev(buffer, flags, text) end function select_all(buffer) end --- --- Duplicates the selected text or the current line. +-- Duplicates the selected text to its right or the current line on a new line +-- below. -- @param buffer The global buffer. function selection_duplicate(buffer) end --- --- Resets the set of word, whitespace, and punctuation characters to their --- defaults. +-- Resets `buffer.word_chars`, `buffer.whitespace_chars`, and +-- `buffer.punctuation_chars` to their respective defaults. -- @param buffer The global buffer. -- @see word_chars -- @see whitespace_chars @@ -2258,8 +2238,8 @@ function selection_duplicate(buffer) end function set_chars_default(buffer) end --- --- Sets the current position to position *pos* without scrolling the view, --- removing any selections. +-- Moves the caret to position *pos* without scrolling the view and removes any +-- selections. -- @param buffer The buffer -- @param pos The position in *buffer* to move to. function set_empty_selection(buffer, pos) end @@ -2302,8 +2282,8 @@ function set_hotspot_active_fore(buffer, use_setting, color) end function set_save_point(buffer) end --- --- Selects the range of text from *start_pos* to *end_pos* in the buffer, --- scrolling the selected text into view. +-- Selects the range of text between positions *start_pos* and *end_pos* in the +-- buffer, scrolling the selected text into view. -- @param buffer The global buffer. -- @param start_pos The start position of the range of text in *buffer* to -- select. If negative, it means the end of the buffer. @@ -2313,7 +2293,7 @@ function set_save_point(buffer) end function set_sel(buffer, start_pos, end_pos) end --- --- Overrides the default background color of all selected text with *color*, in +-- Overrides the default background color of the selection with *color*, in -- "0xBBGGRR" format, if *use_setting* is `true`. -- @param buffer The global buffer. -- @param use_setting Whether or not to use *color*. @@ -2321,7 +2301,7 @@ function set_sel(buffer, start_pos, end_pos) end function set_sel_back(buffer, use_setting, color) end --- --- Overrides the default foreground color of all selected text with *color*, in +-- Overrides the default foreground color of the selection with *color*, in -- "0xBBGGRR" format, if *use_setting* is `true`. -- @param buffer The global buffer. -- @param use_setting Whether or not to use *color*. @@ -2329,8 +2309,8 @@ function set_sel_back(buffer, use_setting, color) end function set_sel_fore(buffer, use_setting, color) end --- --- Selects the range of text from *start_pos* to *end_pos* in the buffer, --- removing all other selections. +-- Selects the range of text between positions *start_pos* to *end_pos* in the +-- buffer, removing all other selections. -- @param buffer The global buffer. -- @param end_pos The caret position of the range of text to select in *buffer*. -- @param start_pos The anchor position of the range of text to select in @@ -2451,13 +2431,13 @@ function style_clear_all(buffer) end function style_reset_default(buffer) end --- --- Swaps the anchor and caret positions of the main selection. +-- Swaps the beginning and end positions of the main selection. -- @param buffer The global buffer. function swap_main_anchor_caret(buffer) end --- --- Indents the selected lines, replaces the selected text on a line with a Tab --- character ("\t"), or inserts a Tab character at the caret. +-- Indents the text on the selected lines or inserts a Tab character ("\t") at +-- the caret position. -- @param buffer The global buffer. function tab(buffer) end @@ -2468,14 +2448,14 @@ function tab(buffer) end function target_from_selection(buffer) end --- --- Returns the height in pixels of line number *line*. +-- Returns the pixel height of line number *line*. -- @param buffer The global buffer. -- @param line The line number in *buffer* to get the pixel height of. -- @return number function text_height(buffer, line) end --- --- Returns the width in pixels of string *text* styled with style number +-- Returns the pixel width of string *text* styled with style number -- *style_num*, in the range of `0` to `255`. -- @param buffer The global buffer. -- @param style_num The style number between `0` and `255` to use. @@ -2509,10 +2489,12 @@ function undo(buffer) end function upper_case(buffer) end --- --- Displays a list from *item_list*, a sorted string whose items are delimited --- by `buffer.auto_c_separator` characters, using the list identifier number --- *list_type* which is greater than zero and sent in a `USER_LIST_SELECTION` --- event after the user selects an item. +-- Displays a list constructed from string *item_list*, whose items are +-- delimited by `buffer.auto_c_separator` characters, using the list identifier +-- number *list_type* which is greater than zero and sent in a +-- `USER_LIST_SELECTION` event after the user selects an item. +-- The sorted order of *item_list*, `buffer.auto_c_order`, must have already +-- been defined. -- @param buffer The global buffer. -- @param list_type The list identifier number greater than zero to use. -- @param item_list The sorted string of words to show, separated by @@ -2597,8 +2579,8 @@ function word_end_position(buffer, pos, only_word_chars) end function word_left(buffer) end --- --- Moves the caret left one word, positioning the caret at the end of the --- previous word. +-- Moves the caret left one word, positioning it at the end of the previous +-- word. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_left_end(buffer) end @@ -2617,29 +2599,29 @@ function word_left_end_extend(buffer) end function word_left_extend(buffer) end --- --- Moves to the previous underscore or change in capitalization within the --- current word. +-- Moves the caret to the previous underscore or change in capitalization within +-- the current word. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_part_left(buffer) end --- --- Moves to the previous underscore or change in capitalization within the --- current word, extending the selected text to the new position. +-- Moves the caret to the previous underscore or change in capitalization within +-- the current word, extending the selected text to the new position. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_part_left_extend(buffer) end --- --- Moves to the next underscore or change in capitalization within the current --- word. +-- Moves the caret to the next underscore or change in capitalization within the +-- current word. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_part_right(buffer) end --- --- Moves to the next underscore or change in capitalization within the current --- word, extending the selected text to the new position. +-- Moves the caret to the next underscore or change in capitalization within the +-- current word, extending the selected text to the new position. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_part_right_extend(buffer) end @@ -2651,8 +2633,8 @@ function word_part_right_extend(buffer) end function word_right(buffer) end --- --- Moves the caret right one word, positioning the cursor at the end of the --- current word. +-- Moves the caret right one word, positioning it at the end of the current +-- word. -- `buffer.word_chars` contains word characters. -- @param buffer The global buffer. function word_right_end(buffer) end @@ -2729,7 +2711,8 @@ function delete(buffer) end function new() end --- --- Returns the range of text from *start_pos* to *end_pos* in the buffer. +-- Returns the range of text between positions *start_pos* and *end_pos* in the +-- buffer. -- @param buffer The global buffer. -- @param start_pos The start position of the range of text to get in *buffer*. -- @param end_pos The end position of the range of text to get in *buffer*. @@ -2867,6 +2850,8 @@ function get_style_name(buffer, style_num) end -- * indicator_value_at -- * load_lexer_library -- * null +-- * position_from_point +-- * position_from_point_close -- * private_lexer_call -- * property_names -- * property_type diff --git a/core/init.lua b/core/init.lua index 0049bc7a..522fae00 100644 --- a/core/init.lua +++ b/core/init.lua @@ -13,7 +13,7 @@ require('lfs_ext') require('ui') keys = require('keys') -_M = {} -- modules table +_M = {} -- language modules table -- LuaJIT compatibility. if jit then module, package.searchers, bit32 = nil, package.loaders, bit end diff --git a/core/keys.lua b/core/keys.lua index 59c92f51..338c54e9 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -60,7 +60,7 @@ local M = {} -- -- keys['cn'] = buffer.new -- keys['cs'] = buffer.save --- keys['a('] = {_M.textadept.editing.enclose, '(', ')'} +-- keys['a('] = {textadept.editing.enclose, '(', ')'} -- keys['cu'] = function() io.snapopen(_USERHOME) end -- -- Textadept handles [`buffer`][] references properly in static contexts. diff --git a/core/ui.lua b/core/ui.lua index 392b961f..d4743a44 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -10,7 +10,7 @@ local ui = ui -- @field context_menu -- The editor's context menu, a [`ui.menu()`](#menu). -- This is a low-level field. You probably want to use the higher-level --- `_M.textadept.menu.set_contextmenu()`. +-- `textadept.menu.set_contextmenu()`. -- @field clipboard_text (string, Read-only) -- The text on the clipboard. -- @field statusbar_text (string, Write-only) @@ -377,7 +377,7 @@ events_connect(events.ERROR, ui.print) --- -- A table of menus defining a menubar. (Write-only) --- @see _M.textadept.menu.set_menubar +-- @see textadept.menu.set_menubar -- @class table -- @name menubar local menubar @@ -436,9 +436,9 @@ local goto_view --- -- Low-level function for creating a menu from table *menu_table* and returning -- the userdata. --- You probably want to use the higher-level `_M.textadept.menu.set_menubar()` --- or `_M.textadept.menu.set_contextmenu()` functions. Emits a `MENU_CLICKED` --- event when a menu item is selected. +-- You probably want to use the higher-level `textadept.menu.set_menubar()` +-- or `textadept.menu.set_contextmenu()` functions. Emits a `MENU_CLICKED` event +-- when a menu item is selected. -- @param menu_table A table defining the menu. It is an ordered list of tables -- with a string menu item, integer menu ID, and optional GDK keycode and -- modifier mask. The latter two are used to display key shortcuts in the @@ -448,8 +448,8 @@ local goto_view -- @usage ui.menu{{'_New', 1}, {'_Open', 2}, {''}, {'_Quit', 4}} -- @usage ui.menu{{'_New', 1, string.byte('n'), 4}} -- 'Ctrl+N' -- @see events.MENU_CLICKED --- @see _M.textadept.menu.set_menubar --- @see _M.textadept.menu.set_contextmenu +-- @see textadept.menu.set_menubar +-- @see textadept.menu.set_contextmenu -- @class function -- @name menu local menu diff --git a/doc/03_UserInterface.md b/doc/03_UserInterface.md index 0556f266..d51101ef 100644 --- a/doc/03_UserInterface.md +++ b/doc/03_UserInterface.md @@ -18,7 +18,7 @@ key bindings. [command selection]: 10_Advanced.html#Command.Selection [key preferences]: 08_Preferences.html#Key.Bindings -[complete list]: api/_M.textadept.keys.html#Key.Bindings +[complete list]: api/textadept.keys.html#Key.Bindings ## Editor View diff --git a/doc/05_FileNavigation.md b/doc/05_FileNavigation.md index bd3084f3..47f65618 100644 --- a/doc/05_FileNavigation.md +++ b/doc/05_FileNavigation.md @@ -10,7 +10,7 @@ by pages, etc. Mac OSX and curses also handle some Bash-style bindings like `^B`, `^F`, `^P`, `^N`, `^A`, and `^E`. The "Movement" section of the [key bindings list][] lists all movement bindings. -[key bindings list]: api/_M.textadept.keys.html#Key.Bindings +[key bindings list]: api/textadept.keys.html#Key.Bindings ## Brace Match diff --git a/doc/06_AdeptEditing.md b/doc/06_AdeptEditing.md index 7c885cce..6e26f6c9 100644 --- a/doc/06_AdeptEditing.md +++ b/doc/06_AdeptEditing.md @@ -261,7 +261,7 @@ defined. [Language modules][] usually [define Adeptsenses][]. All of the ![Adeptsense Doc](images/adeptsense_doc.png) [Language modules]: 07_Modules.html#Language.Modules -[Adeptsense]: api/_M.textadept.adeptsense.html +[Adeptsense]: api/textadept.adeptsense.html [define Adeptsenses]: api/_M.html#Adeptsense [official]: http://foicica.com/hg diff --git a/doc/07_Modules.md b/doc/07_Modules.md index 10f086ef..9af18ab5 100644 --- a/doc/07_Modules.md +++ b/doc/07_Modules.md @@ -10,7 +10,7 @@ Textadept also recognizes a special kind of module: a language module. Language modules provide functionality specific to their respective programming languages. -[textadept module]: api/_M.textadept.html +[textadept module]: api/textadept.html [preferences]: 08_Preferences.html#Loading.Modules ## Language Modules diff --git a/doc/08_Preferences.md b/doc/08_Preferences.md index ba4ea399..46db35a3 100644 --- a/doc/08_Preferences.md +++ b/doc/08_Preferences.md @@ -33,9 +33,9 @@ Many of Textadept's generic modules have configurable settings changeable from with typeover and stripping trailing whitespace on save, add the following to your *~/.textadept/init.lua*: - _M.textadept.editing.AUTOPAIR = false - _M.textadept.editing.TYPEOVER_CHARS = false - _M.textadept.editing.STRIP_TRAILING_SPACES = false + textadept.editing.AUTOPAIR = false + textadept.editing.TYPEOVER_CHARS = false + textadept.editing.STRIP_TRAILING_SPACES = false Now suppose you want to load all of Textadept's default modules except for the menu. You cannot do this after-the-fact from *~/.textadept/init.lua*. Instead @@ -81,7 +81,7 @@ commands, load more [Adeptsense tags][], and add additional [key bindings](#Key.Bindings) and [snippets](#Snippets) (instead of in *~/.textadept/init.lua*). For example: - _M.textadept.run.run_command.lua = 'lua5.2' + textadept.run.run_command.lua = 'lua5.2' _M.lua.sense:load_ctags('/path/to/my/projects/tags') keys.lua['c\n'] = function() buffer:line_end() buffer:add_text('end') buffer:new_line() @@ -89,7 +89,7 @@ commands, load more [Adeptsense tags][], and add additional snippets.lua['ver'] = '%<_VERSION>' [compile and run]: 07_Modules.html#Compile.and.Run -[Adeptsense tags]: api/_M.textadept.adeptsense.html#load_ctags +[Adeptsense tags]: api/textadept.adeptsense.html#load_ctags ### Loading Modules @@ -97,7 +97,7 @@ After creating or downloading a generic module called `foo` that you want to load along with the default modules, simply add the following to your *~/.textadept/init.lua*: - _M.foo = require('foo') + foo = require('foo') Textadept automatically loads language modules when opening a source file of that language, so simply installing the language module is sufficient. @@ -129,25 +129,25 @@ So typing `file` or `path` and then pressing `Tab` (`⇥` on Mac OSX | `Tab` in curses) inserts the snippet, regardless of the current programming language. Learn more about snippet syntax in the [snippets LuaDoc][]. -[snippets LuaDoc]: api/_M.textadept.snippets.html +[snippets LuaDoc]: api/textadept.snippets.html ### File Types Textadept recognizes a wide range of programming language files either by file extension, by a keyword in the shebang ("#!/path/to/exe") line, or by a [Lua pattern][] that matches the text of the first line. The editor does this by -consulting a set of tables in [`_M.textadept.file_types`][] that are modifiable +consulting a set of tables in [`textadept.file_types`][] that are modifiable from *~/.textadept/init.lua*. For example: -- Recognize .luadoc files as Lua code. - _M.textadept.file_types.extensions.luadoc = 'lua' + textadept.file_types.extensions.luadoc = 'lua' -- Change .html files to be recognized as XML files. - _M.textadept.file_types.extensions.html = 'xml' + textadept.file_types.extensions.html = 'xml' -- Recognize a shebang line like "#!/usr/bin/zsh" as shell code. - _M.textadept.file_types.shebangs.zsh = 'bash' + textadept.file_types.shebangs.zsh = 'bash' [Lua pattern]: 14_Appendix.html#Lua.Patterns -[`_M.textadept.file_types`]: api/_M.textadept.file_types.html +[`textadept.file_types`]: api/textadept.file_types.html ## Buffer Properties diff --git a/doc/14_Appendix.md b/doc/14_Appendix.md index 23c7312a..c1c18669 100644 --- a/doc/14_Appendix.md +++ b/doc/14_Appendix.md @@ -154,7 +154,7 @@ Old API |Change |New API **_G** | | RESETTING |Removed |N/A\* buffer\_new() |Renamed |\_G.[buffer.new()][] -**_M.textadept** | | +**_M.textadept** |Renamed |[textadept][] filter\_through |Removed |N/A filter\_through.filter\_through() |Renamed |editing.[filter\_through()][] mime\_types |Renamed |[file\_types][] @@ -191,14 +191,15 @@ try\_encodings |Renamed |[encodings][] Changed arguments too. [buffer.new()]: api/buffer.html#new -[filter\_through()]: api/_M.textadept.editing.html#filter_through -[file\_types]: api/_M.textadept.file_types.html -[goto\_mark()]: api/_M.textadept.bookmarks.html#goto_mark -[BOOKMARK\_COLOR]: api/_M.textadept.bookmarks.html#BOOKMARK_COLOR -[HIGHLIGHT\_COLOR]: api/_M.textadept.editing.html#HIGHLIGHT_COLOR -[autocomplete\_word]: api/_M.textadept.editing.html#autocomplete_word -[select\_enclosed()]: api/_M.textadept.editing.html#select_enclosed -[ERROR\_COLOR]: api/_M.textadept.run.html#ERROR_COLOR +[textadept]: api/textadept.html +[filter\_through()]: api/textadept.editing.html#filter_through +[file\_types]: api/textadept.file_types.html +[goto\_mark()]: api/textadept.bookmarks.html#goto_mark +[BOOKMARK\_COLOR]: api/textadept.bookmarks.html#BOOKMARK_COLOR +[HIGHLIGHT\_COLOR]: api/textadept.editing.html#HIGHLIGHT_COLOR +[autocomplete\_word]: api/textadept.editing.html#autocomplete_word +[select\_enclosed()]: api/textadept.editing.html#select_enclosed +[ERROR\_COLOR]: api/textadept.run.html#ERROR_COLOR [io.snapopen()]: api/io.html#snapopen [ui]: api/ui.html [maximized]: api/ui.html#maximized @@ -345,14 +346,14 @@ prompt\_load() |Replaced|[load()][] prompt\_save() |Replaced|[save()][] [menu()]: api/ui.html#menu -[complete()]: api/_M.textadept.adeptsense.html#complete -[show\_apidoc()]: api/_M.textadept.adeptsense.html#show_apidoc -[toggle()]: api/_M.textadept.bookmarks.html#toggle -[set\_menubar()]: api/_M.textadept.menu.html#set_menubar -[run()]: api/_M.textadept.run.html#run -[compile()]: api/_M.textadept.run.html#compile -[load()]: api/_M.textadept.session.html#load -[save()]: api/_M.textadept.session.html#save +[complete()]: api/textadept.adeptsense.html#complete +[show\_apidoc()]: api/textadept.adeptsense.html#show_apidoc +[toggle()]: api/textadept.bookmarks.html#toggle +[set\_menubar()]: api/textadept.menu.html#set_menubar +[run()]: api/textadept.run.html#run +[compile()]: api/textadept.run.html#compile +[load()]: api/textadept.session.html#load +[save()]: api/textadept.session.html#save ### Textadept 4 to 5 @@ -400,7 +401,7 @@ your own: end [\_M]: api/_M.html -[select\_word()]: api/_M.textadept.editing.html#select_word +[select\_word()]: api/textadept.editing.html#select_word [\_L]: api/_L.html #### Module Changes @@ -579,7 +580,7 @@ views |Renamed|\_G.[\_VIEWS][] [\_SCINTILLA]: api/_SCINTILLA.html [events]: api/events.html [gui]: api/ui.html -[_m.textadept.snippets]: api/_M.textadept.snippets.html +[_m.textadept.snippets]: api/textadept.snippets.html [gui.\_print()]: api/ui.html#_print [\_SCINTILLA.functions]: api/_SCINTILLA.html#functions [\_SCINTILLA.properties]: api/_SCINTILLA.html#properties diff --git a/init.lua b/init.lua index aebf0344..329080f4 100644 --- a/init.lua +++ b/init.lua @@ -9,7 +9,7 @@ package.path = table.concat({ local so = not WIN32 and '/?.so;' or '/?.dll;' package.cpath = _USERHOME..so.._USERHOME..'/modules'..so..package.cpath -_M.textadept = require('textadept') +textadept = require('textadept') local ok, err = pcall(dofile, _USERHOME..'/init.lua') if not ok and lfs.attributes(_USERHOME..'/init.lua') then ui.print(err) end diff --git a/modules/cpp/init.lua b/modules/cpp/init.lua index 646ca218..bfd8670c 100644 --- a/modules/cpp/init.lua +++ b/modules/cpp/init.lua @@ -18,27 +18,27 @@ local M = {} -- + `Shift+Enter` (`⇧↩` | `S-Enter`) -- Add ';' to the end of the current line and insert a newline. -- @field sense --- The C/C++ [Adeptsense](_M.textadept.adeptsense.html). +-- The C/C++ [Adeptsense](textadept.adeptsense.html). -- It loads user tags from *`_USERHOME`/modules/cpp/tags* and user apidocs -- from *`_USERHOME`/modules/cpp/api*. module('_M.cpp')]] -- Compile and Run command tables use file extensions. -_M.textadept.run.compile_command.c = +textadept.run.compile_command.c = 'gcc -pedantic -Os -o "%(filename_noext)" %(filename)' -_M.textadept.run.compile_command.cpp = +textadept.run.compile_command.cpp = 'g++ -pedantic -Os -o "%(filename_noext)" %(filename)' -_M.textadept.run.run_command.c = '%(filedir)%(filename_noext)' -_M.textadept.run.run_command.cpp = '%(filedir)%(filename_noext)' -_M.textadept.run.error_detail.c = { +textadept.run.run_command.c = '%(filedir)%(filename_noext)' +textadept.run.run_command.cpp = '%(filedir)%(filename_noext)' +textadept.run.error_detail.c = { pattern = '^(.-):(%d+): (.+)$', filename = 1, line = 2, message = 3 } -- Adeptsense. -M.sense = _M.textadept.adeptsense.new('cpp') -local as = _M.textadept.adeptsense +M.sense = textadept.adeptsense.new('cpp') +local as = textadept.adeptsense M.sense.ctags_kinds = { c = as.CLASS, d = as.FUNCTION, e = as.FIELD, f = as.FUNCTION, g = as.CLASS, m = as.FIELD, s = as.CLASS, t = as.CLASS diff --git a/modules/lua/init.lua b/modules/lua/init.lua index 90dbf0a6..d970e2c5 100644 --- a/modules/lua/init.lua +++ b/modules/lua/init.lua @@ -19,28 +19,28 @@ local M = {} -- Autocomplete an `if`, `while`, `for`, etc. control structure with the `end` -- keyword. -- @field sense --- The Lua [Adeptsense](_M.textadept.adeptsense.html). +-- The Lua [Adeptsense](textadept.adeptsense.html). -- It loads user tags from *`_USERHOME`/modules/lua/tags* and user apidocs -- from *`_USERHOME`/modules/lua/api*. module('_M.lua')]] -- Compile and Run command tables use file extensions. -_M.textadept.run.compile_command.lua = 'luac %(filename)' -_M.textadept.run.run_command.lua = 'lua %(filename)' -_M.textadept.run.error_detail.lua = { +textadept.run.compile_command.lua = 'luac %(filename)' +textadept.run.run_command.lua = 'lua %(filename)' +textadept.run.error_detail.lua = { pattern = '^lua: (.-):(%d+): (.+)$', filename = 1, line = 2, message = 3 } -- Adeptsense. -M.sense = _M.textadept.adeptsense.new('lua') +M.sense = textadept.adeptsense.new('lua') M.sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)' M.sense.syntax.symbol_chars = '[%w_%.:]' M.sense.syntax.type_declarations = {} M.sense.syntax.type_assignments = { ['^[\'"]'] = 'string', -- foo = 'bar' or foo = "bar" - ['^([%w_%.]+)%s*$'] = '%1', -- foo = _M.textadept.adeptsense + ['^([%w_%.]+)%s*$'] = '%1', -- foo = textadept.adeptsense ['^(_M%.textadept%.adeptsense)%.new'] = '%1', ['require%s*%(?%s*(["\'])([%w_%.]+)%1%)?'] = '%2', ['^io%.p?open%s*%b()%s*$'] = 'file' @@ -50,7 +50,7 @@ M.sense:add_trigger('.') M.sense:add_trigger(':', false, true) -- script/update_doc generates a fake set of ctags used for autocompletion. -local as = _M.textadept.adeptsense +local as = textadept.adeptsense M.sense.ctags_kinds = { f = as.FUNCTION, F = as.FIELD, m = as.CLASS, t = as.FIELD } diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua index dd98c052..8f4bdacd 100644 --- a/modules/textadept/adeptsense.lua +++ b/modules/textadept/adeptsense.lua @@ -46,7 +46,7 @@ local M = {} -- Creating a new instance of an Adeptsense from within a language module is -- easy. Just replace the '?' with the name of your language: -- --- M.sense = _M.textadept.adeptsense.new('?') +-- M.sense = textadept.adeptsense.new('?') -- -- ### Terminology -- @@ -89,7 +89,7 @@ local M = {} -- M.sense.syntax.type_declarations = {} -- M.sense.syntax.type_assignments = { -- ['^[\'"]'] = 'string', -- foo = 'bar' or foo = "bar" --- ['^([%w_%.]+)%s*$'] = '%1', -- foo = _M.textadept.adeptsense +-- ['^([%w_%.]+)%s*$'] = '%1', -- foo = textadept.adeptsense -- ['^io%.p?open%s*%b()%s*$'] = 'file' -- f = io.open('foo') -- } -- @@ -142,7 +142,7 @@ local M = {} -- -- **C/C++** -- --- local as = _M.textadept.adeptsense +-- local as = textadept.adeptsense -- M.sense.ctags_kinds = { -- c = as.CLASS, d = as.FUNCTION, e = as.FIELD, f = as.FUNCTION, -- g = as.CLASS, m = as.FIELD, s = as.CLASS, t = as.CLASS @@ -157,10 +157,10 @@ local M = {} -- table keys as `'t'`. -- -- M.sense.ctags_kinds = { --- f = _M.textadept.adeptsense.FUNCTION, --- F = _M.textadept.adeptsense.FIELD, --- m = _M.textadept.adeptsense.CLASS, --- t = _M.textadept.adeptsense.FIELD, +-- f = textadept.adeptsense.FUNCTION, +-- F = textadept.adeptsense.FIELD, +-- m = textadept.adeptsense.CLASS, +-- t = textadept.adeptsense.FIELD, -- } -- M.sense:load_ctags(_HOME..'/modules/lua/tags', true) -- @@ -382,7 +382,7 @@ local M = {} -- Ctags kind for Adeptsense functions. -- @field FIELD (string) -- Ctags kind for Adeptsense fields. -module('_M.textadept.adeptsense')]] +module('textadept.adeptsense')]] local senses = {} @@ -831,7 +831,7 @@ function M.goto_ctag(sense, kind, title) buffer:goto_pos(buffer.target_start) end else - _M.textadept.editing.goto_line(tonumber(line)) + textadept.editing.goto_line(tonumber(line)) end end @@ -874,7 +874,7 @@ function M.handle_clear(sense) end -- Only one sense can exist per language. -- @param lang The lexer language name to create an Adeptsense for. -- @return adeptsense --- @usage local lua_sense = _M.textadept.adeptsense.new('lua') +-- @usage local lua_sense = textadept.adeptsense.new('lua') -- @name new function M.new(lang) local sense = senses[lang] @@ -899,13 +899,13 @@ function M.new(lang) -- simply containers for functions and fields so Lua modules would count as -- classes. Any other kinds will be passed to `handle_ctag()` for user-defined -- handling. --- @usage luasense.ctags_kinds = {f = _M.textadept.adeptsense.FUNCTION} --- @usage csense.ctags_kinds = {m = _M.textadept.adeptsense.FIELD, --- f = _M.textadept.adeptsense.FUNCTION, c = _M.textadept.adeptsense.CLASS, --- s = _M.textadept.adeptsense.CLASS} --- @usage javasense.ctags_kinds = {f = _M.textadept.adeptsense.FIELD, --- m = _M.textadept.adeptsense.FUNCTION, c = _M.textadept.adeptsense.CLASS, --- i = _M.textadept.adeptsense.CLASS} +-- @usage luasense.ctags_kinds = {f = textadept.adeptsense.FUNCTION} +-- @usage csense.ctags_kinds = {m = textadept.adeptsense.FIELD, +-- f = textadept.adeptsense.FUNCTION, c = textadept.adeptsense.CLASS, +-- s = textadept.adeptsense.CLASS} +-- @usage javasense.ctags_kinds = {f = textadept.adeptsense.FIELD, +-- m = textadept.adeptsense.FUNCTION, c = textadept.adeptsense.CLASS, +-- i = textadept.adeptsense.CLASS} -- @class table -- @name ctags_kinds -- @see handle_ctag diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index e0031610..852c0df9 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -7,7 +7,7 @@ local M = {} -- Bookmarks for Textadept. -- @field BOOKMARK_COLOR (string) -- The name of the color in the current theme to mark a bookmarked line with. -module('_M.textadept.bookmarks')]] +module('textadept.bookmarks')]] M.BOOKMARK_COLOR = not CURSES and 'color.dark_blue' or 'color.blue' @@ -55,7 +55,7 @@ function M.goto_mark(next) line = buffer:marker_next(line + 1, 2^MARK_BOOKMARK) until line < 0 local line = ui.filteredlist(_L['Select Bookmark'], _L['Bookmark'], marks) - if line then _M.textadept.editing.goto_line(line:match('^%d+')) end + if line then textadept.editing.goto_line(line:match('^%d+')) end else local f = next and buffer.marker_next or buffer.marker_previous local current_line = buffer:line_from_position(buffer.current_pos) @@ -63,7 +63,7 @@ function M.goto_mark(next) if line == -1 then line = f(buffer, (next and 0 or buffer.line_count), 2^MARK_BOOKMARK) end - if line >= 0 then _M.textadept.editing.goto_line(line + 1) end + if line >= 0 then textadept.editing.goto_line(line + 1) end end end diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 897384c2..670eecec 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -30,7 +30,7 @@ local M = {} -- @field HIGHLIGHT_COLOR (string) -- The name of the color in the current theme to -- [highlight words](#highlight_word) with. -module('_M.textadept.editing')]] +module('textadept.editing')]] M.AUTOPAIR = true M.HIGHLIGHT_BRACES = true @@ -58,7 +58,7 @@ M.comment_string = {actionscript='//',ada='--',antlr='//',adpl='!',applescript=' -- "{}", "''", and """". -- @class table -- @name char_matches --- @usage _M.textadept.editing.char_matches.hypertext = {..., [60] = '>'} +-- @usage textadept.editing.char_matches.hypertext = {..., [60] = '>'} -- @see AUTOPAIR M.char_matches = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'} @@ -69,7 +69,7 @@ M.char_matches = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'} -- values. The default brace characters are '(', ')', '[', ']', '{', and '}'. -- @class table -- @name braces --- @usage _M.textadept.editing.braces.hypertext = {..., [60] = 1, [62] = 1} +-- @usage textadept.editing.braces.hypertext = {..., [60] = 1, [62] = 1} -- @see HIGHLIGHT_BRACES M.braces = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1} @@ -80,7 +80,7 @@ M.braces = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1} -- The default characters are ')', ']', '}', ''', and '"'. -- @class table -- @name typeover_chars --- @usage _M.textadept.editing.typeover_chars.hypertext = {..., [62] = 1} +-- @usage textadept.editing.typeover_chars.hypertext = {..., [62] = 1} -- @see TYPEOVER_CHARS M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1} diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua index 1d57070b..f28e9d29 100644 --- a/modules/textadept/file_types.lua +++ b/modules/textadept/file_types.lua @@ -12,7 +12,7 @@ local M = {} -- Arguments: -- -- * *`lang`*: The language lexer name. -module('_M.textadept.file_types')]] +module('textadept.file_types')]] -- Events. events.LEXER_LOADED = 'lexer_loaded' diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index d4422963..f83c626c 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -373,9 +373,9 @@ function M.goto_file_found(line, next) -- Goto the source of the search result. local file, line_num = buffer:get_cur_line():match('^(.+):(%d+):.+$') if not file then if CURSES then view:goto_buffer(cur_buf) end return end - _M.textadept.editing.select_line() + textadept.editing.select_line() ui.goto_file(file, true, preferred_view) - _M.textadept.editing.goto_line(line_num) + textadept.editing.goto_line(line_num) end events.connect(events.DOUBLE_CLICK, function(pos, line) if is_ff_buf(buffer) then M.goto_file_found(line) end diff --git a/modules/textadept/init.lua b/modules/textadept/init.lua index e97d6b10..9dd072b7 100644 --- a/modules/textadept/init.lua +++ b/modules/textadept/init.lua @@ -1,13 +1,13 @@ -- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. local M = {} -_M.textadept = M +textadept = M --[[ This comment is for LuaDoc. --- -- The textadept module. -- It provides utilities for editing text in Textadept. -module('_M.textadept')]] +module('textadept')]] M.adeptsense = require('textadept.adeptsense') M.bookmarks = require('textadept.bookmarks') diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index 0e1f4206..95f182ab 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -7,7 +7,7 @@ local M = {} -- Defines key commands for Textadept. -- This set of key commands is pretty standard among other text editors. If -- applicable, load this module second to last in your *~/.textadept/init.lua*, --- before `_M.textadept.menu`. +-- before `textadept.menu`. -- -- ## Key Bindings -- @@ -215,16 +215,16 @@ local M = {} -- N/A |N/A|F4 |Toggle "Find in Files" -- -- †: Ctrl+Enter in Win32 curses. -module('_M.textadept.keys')]] +module('textadept.keys')]] -- Utility functions. M.utils = { delete_word = function() - _M.textadept.editing.select_word() + textadept.editing.select_word() buffer:delete_back() end, enclose_as_xml_tags = function() - _M.textadept.editing.enclose('<', '>') + textadept.editing.enclose('<', '>') local pos = buffer.current_pos while buffer.char_at[pos - 1] ~= 60 do pos = pos - 1 end -- '<' buffer:insert_text(-1, '', '<'} + or 'm<'] = {editing.select_enclosed, '>', '<'} if not CURSES then - keys[not OSX and 'c>' or 'm>'] = {m_editing.select_enclosed, '<', '>'} + keys[not OSX and 'c>' or 'm>'] = {editing.select_enclosed, '<', '>'} end keys[not OSX and not CURSES and "c'" - or "m'"] = {m_editing.select_enclosed, "'", "'"} + or "m'"] = {editing.select_enclosed, "'", "'"} keys[not OSX and not CURSES and 'c"' - or 'm"'] = {m_editing.select_enclosed, '"', '"'} + or 'm"'] = {editing.select_enclosed, '"', '"'} keys[not OSX and not CURSES and 'c(' - or 'm('] = {m_editing.select_enclosed, '(', ')'} + or 'm('] = {editing.select_enclosed, '(', ')'} keys[not OSX and not CURSES and 'c[' - or 'm['] = {m_editing.select_enclosed, '[', ']'} + or 'm['] = {editing.select_enclosed, '[', ']'} keys[not OSX and not CURSES and 'c{' - or 'm{'] = {m_editing.select_enclosed, '{', '}'} -keys[not OSX and (not CURSES and 'cD' or 'mW') or 'mD'] = m_editing.select_word -keys[not OSX and not CURSES and 'cN' or 'mN'] = m_editing.select_line -keys[not OSX and not CURSES and 'cP' or 'mP'] = m_editing.select_paragraph -keys[not OSX and not CURSES and 'cI' or 'mI'] = m_editing.select_indented_block + or 'm{'] = {editing.select_enclosed, '{', '}'} +keys[not OSX and (not CURSES and 'cD' or 'mW') or 'mD'] = editing.select_word +keys[not OSX and not CURSES and 'cN' or 'mN'] = editing.select_line +keys[not OSX and not CURSES and 'cP' or 'mP'] = editing.select_paragraph +keys[not OSX and not CURSES and 'cI' or 'mI'] = editing.select_indented_block -- Selection. keys[not OSX and (not CURSES and 'cau' or 'cmu') or 'cu'] = buffer.upper_case keys[not OSX and (not CURSES and 'caU' or 'cml') or 'cU'] = buffer.lower_case keys[not OSX and (not CURSES and 'a<' or 'm>') or 'c<'] = utils.enclose_as_xml_tags if not CURSES then - keys[not OSX and 'a>' or 'c>'] = {m_editing.enclose, '<', ' />'} - keys[not OSX and "a'" or "c'"] = {m_editing.enclose, "'", "'"} - keys[not OSX and 'a"' or 'c"'] = {m_editing.enclose, '"', '"'} + keys[not OSX and 'a>' or 'c>'] = {editing.enclose, '<', ' />'} + keys[not OSX and "a'" or "c'"] = {editing.enclose, "'", "'"} + keys[not OSX and 'a"' or 'c"'] = {editing.enclose, '"', '"'} end keys[not OSX and (not CURSES and 'a(' or 'm)') - or 'c('] = {m_editing.enclose, '(', ')'} + or 'c('] = {editing.enclose, '(', ')'} keys[not OSX and (not CURSES and 'a[' or 'm]') - or 'c['] = {m_editing.enclose, '[', ']'} + or 'c['] = {editing.enclose, '[', ']'} keys[not OSX and (not CURSES and 'a{' or 'm}') - or 'c{'] = {m_editing.enclose, '{', '}'} + or 'c{'] = {editing.enclose, '{', '}'} keys.csup = buffer.move_selected_lines_up keys.csdown = buffer.move_selected_lines_down @@ -460,39 +460,38 @@ if not CURSES then keys[not OSX and 'cag' or 'cmg'] = {ui.find.goto_file_found, false, true} keys[not OSX and 'caG' or 'cmG'] = {ui.find.goto_file_found, false, false} end -keys[not OSX and 'cj' or 'mj'] = m_editing.goto_line +keys[not OSX and 'cj' or 'mj'] = editing.goto_line -- Tools. keys[not OSX and (not CURSES and 'ce' or 'mc') or 'me'] = {ui.command_entry.enter_mode, 'lua_command'} keys[not OSX and (not CURSES and 'cE' or 'mC') or 'mE'] = utils.select_command -keys[not OSX and 'cr' or 'mr'] = _M.textadept.run.run -keys[not OSX and (not CURSES and 'cR' or 'cmr') - or 'mR'] = _M.textadept.run.compile +keys[not OSX and 'cr' or 'mr'] = textadept.run.run +keys[not OSX and (not CURSES and 'cR' or 'cmr') or 'mR'] = textadept.run.compile keys[not OSX and (not CURSES and 'cae' or 'mx') - or 'cme'] = {_M.textadept.run.goto_error, false, true} + or 'cme'] = {textadept.run.goto_error, false, true} keys[not OSX and (not CURSES and 'caE' or 'mX') - or 'cmE'] = {_M.textadept.run.goto_error, false, false} + or 'cmE'] = {textadept.run.goto_error, false, false} -- Adeptsense. keys[not OSX and ((not CURSES or WIN32) and 'c ' or 'c@') - or 'aesc'] = _M.textadept.adeptsense.complete -keys[not CURSES and 'ch' or 'mh'] = _M.textadept.adeptsense.show_apidoc + or 'aesc'] = textadept.adeptsense.complete +keys[not CURSES and 'ch' or 'mh'] = textadept.adeptsense.show_apidoc if CURSES then keys.mH = keys.mh end -- in case mh is used by GUI terminals -- Snippets. keys[not OSX and (not CURSES and 'ck' or 'mk') - or 'a\t'] = _M.textadept.snippets._select -keys['\t'] = _M.textadept.snippets._insert -keys['s\t'] = _M.textadept.snippets._previous + or 'a\t'] = textadept.snippets._select +keys['\t'] = textadept.snippets._insert +keys['s\t'] = textadept.snippets._previous keys[not OSX and (not CURSES and 'cK' or 'mK') - or 'as\t'] = _M.textadept.snippets._cancel_current + or 'as\t'] = textadept.snippets._cancel_current -- Bookmark. keys[not OSX and (not CURSES and 'cf2' or 'f1') - or 'mf2'] = _M.textadept.bookmarks.toggle + or 'mf2'] = textadept.bookmarks.toggle keys[not OSX and (not CURSES and 'csf2' or 'f6') - or 'msf2'] = _M.textadept.bookmarks.clear -keys.f2 = {_M.textadept.bookmarks.goto_mark, true} -keys[not CURSES and 'sf2' or 'f3'] = {_M.textadept.bookmarks.goto_mark, false} -keys[not CURSES and 'af2' or 'f4'] = _M.textadept.bookmarks.goto_mark + or 'msf2'] = textadept.bookmarks.clear +keys.f2 = {textadept.bookmarks.goto_mark, true} +keys[not CURSES and 'sf2' or 'f3'] = {textadept.bookmarks.goto_mark, false} +keys[not CURSES and 'af2' or 'f4'] = textadept.bookmarks.goto_mark -- Snapopen. keys[not OSX and 'cu' or 'mu'] = {io.snapopen, _USERHOME} -- TODO: {io.snapopen, _HOME} @@ -514,7 +513,7 @@ keys[not OSX and (not CURSES and 'caT' or 'mt') or 'cT'] = {utils.toggle_property, 'use_tabs'} if CURSES then keys.mT = keys.mt end -- in case mt is used by GUI terminals keys[not OSX and (not CURSES and 'cai' or 'mi') - or 'ci'] = m_editing.convert_indentation + or 'ci'] = editing.convert_indentation -- EOL Mode. -- TODO: {utils.set_eol_mode, buffer.SC_EOL_CRLF} -- TODO: {utils.set_eol_mode, buffer.SC_EOL_CR} @@ -526,7 +525,7 @@ keys[not OSX and (not CURSES and 'cai' or 'mi') -- TODO: {utils.set_encoding, 'MacRoman'} -- TODO: {utils.set_encoding, 'UTF-16LE'} keys[not OSX and not CURSES and 'cL' - or 'mL'] = _M.textadept.file_types.select_lexer + or 'mL'] = textadept.file_types.select_lexer keys.f5 = {buffer.colourise, buffer, 0, -1} if CURSES then keys.cl = keys.f5 end @@ -600,7 +599,7 @@ keys.lua_command = { ['\n'] = {ui.command_entry.finish_mode, ui.command_entry.execute_lua} } keys.filter_through = { - ['\n'] = {ui.command_entry.finish_mode, m_editing.filter_through}, + ['\n'] = {ui.command_entry.finish_mode, editing.filter_through}, } keys.find_incremental = { ['\n'] = function() diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 3997375b..b67f8916 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -7,12 +7,12 @@ local M = {} --- -- Defines the menus used by Textadept. -- If applicable, load this module last in your *~/.textadept/init.lua*, after --- `_M.textadept.keys` since it looks up defined key commands to show them in +-- `textadept.keys` since it looks up defined key commands to show them in -- menus. -module('_M.textadept.menu')]] +module('textadept.menu')]] -local _L, _M, buffer, view = _L, _M, buffer, view -local m_editing, utils = _M.textadept.editing, _M.textadept.keys.utils +local _L, buffer, view = _L, buffer, view +local editing, utils = textadept.editing, textadept.keys.utils local SEPARATOR = {''} -- The default main menubar. @@ -28,8 +28,8 @@ local menubar = { {_L['_Close'], buffer.close}, {_L['Close All'], io.close_all}, SEPARATOR, - {_L['Loa_d Session...'], _M.textadept.session.load}, - {_L['Sav_e Session...'], _M.textadept.session.save}, + {_L['Loa_d Session...'], textadept.session.load}, + {_L['Sav_e Session...'], textadept.session.save}, SEPARATOR, {_L['_Quit'], quit}, }, @@ -45,38 +45,38 @@ local menubar = { {_L['D_elete Word'], utils.delete_word}, {_L['Select _All'], buffer.select_all}, SEPARATOR, - {_L['_Match Brace'], m_editing.match_brace}, - {_L['Complete _Word'], m_editing.autocomplete_word}, - {_L['_Highlight Word'], m_editing.highlight_word}, - {_L['Toggle _Block Comment'], m_editing.block_comment}, - {_L['T_ranspose Characters'], m_editing.transpose_chars}, - {_L['_Join Lines'], m_editing.join_lines}, + {_L['_Match Brace'], editing.match_brace}, + {_L['Complete _Word'], editing.autocomplete_word}, + {_L['_Highlight Word'], editing.highlight_word}, + {_L['Toggle _Block Comment'], editing.block_comment}, + {_L['T_ranspose Characters'], editing.transpose_chars}, + {_L['_Join Lines'], editing.join_lines}, {_L['_Filter Through'], {ui.command_entry.enter_mode, 'filter_through'}}, { title = _L['_Select'], - {_L['Select to _Matching Brace'], {m_editing.match_brace, 'select'}}, - {_L['Select between _XML Tags'], {m_editing.select_enclosed, '>', '<'}}, - {_L['Select in XML _Tag'], {m_editing.select_enclosed, '<', '>'}}, - {_L['Select in _Single Quotes'], {m_editing.select_enclosed, "'", "'"}}, - {_L['Select in _Double Quotes'], {m_editing.select_enclosed, '"', '"'}}, - {_L['Select in _Parentheses'], {m_editing.select_enclosed, '(', ')'}}, - {_L['Select in _Brackets'], {m_editing.select_enclosed, '[', ']'}}, - {_L['Select in B_races'], {m_editing.select_enclosed, '{', '}'}}, - {_L['Select _Word'], m_editing.select_word}, - {_L['Select _Line'], m_editing.select_line}, - {_L['Select Para_graph'], m_editing.select_paragraph}, - {_L['Select _Indented Block'], m_editing.select_indented_block}, + {_L['Select to _Matching Brace'], {editing.match_brace, 'select'}}, + {_L['Select between _XML Tags'], {editing.select_enclosed, '>', '<'}}, + {_L['Select in XML _Tag'], {editing.select_enclosed, '<', '>'}}, + {_L['Select in _Single Quotes'], {editing.select_enclosed, "'", "'"}}, + {_L['Select in _Double Quotes'], {editing.select_enclosed, '"', '"'}}, + {_L['Select in _Parentheses'], {editing.select_enclosed, '(', ')'}}, + {_L['Select in _Brackets'], {editing.select_enclosed, '[', ']'}}, + {_L['Select in B_races'], {editing.select_enclosed, '{', '}'}}, + {_L['Select _Word'], editing.select_word}, + {_L['Select _Line'], editing.select_line}, + {_L['Select Para_graph'], editing.select_paragraph}, + {_L['Select _Indented Block'], editing.select_indented_block}, }, { title = _L['Selectio_n'], {_L['_Upper Case Selection'], buffer.upper_case}, {_L['_Lower Case Selection'], buffer.lower_case}, SEPARATOR, {_L['Enclose as _XML Tags'], utils.enclose_as_xml_tags}, - {_L['Enclose as Single XML _Tag'], {m_editing.enclose, '<', ' />'}}, - {_L['Enclose in Single _Quotes'], {m_editing.enclose, "'", "'"}}, - {_L['Enclose in _Double Quotes'], {m_editing.enclose, '"', '"'}}, - {_L['Enclose in _Parentheses'], {m_editing.enclose, '(', ')'}}, - {_L['Enclose in _Brackets'], {m_editing.enclose, '[', ']'}}, - {_L['Enclose in B_races'], {m_editing.enclose, '{', '}'}}, + {_L['Enclose as Single XML _Tag'], {editing.enclose, '<', ' />'}}, + {_L['Enclose in Single _Quotes'], {editing.enclose, "'", "'"}}, + {_L['Enclose in _Double Quotes'], {editing.enclose, '"', '"'}}, + {_L['Enclose in _Parentheses'], {editing.enclose, '(', ')'}}, + {_L['Enclose in _Brackets'], {editing.enclose, '[', ']'}}, + {_L['Enclose in B_races'], {editing.enclose, '{', '}'}}, SEPARATOR, {_L['_Move Selected Lines Up'], buffer.move_selected_lines_up}, {_L['Move Selected Lines Do_wn'], buffer.move_selected_lines_down}, @@ -94,27 +94,27 @@ local menubar = { {_L['Goto Nex_t File Found'], {ui.find.goto_file_found, false, true}}, {_L['Goto Previou_s File Found'], {ui.find.goto_file_found, false, false}}, SEPARATOR, - {_L['_Jump to'], m_editing.goto_line}, + {_L['_Jump to'], editing.goto_line}, }, { title = _L['_Tools'], {_L['Command _Entry'], {ui.command_entry.enter_mode, 'lua_command'}}, {_L['Select Co_mmand'], utils.select_command}, SEPARATOR, - {_L['_Run'], _M.textadept.run.run}, - {_L['_Compile'], _M.textadept.run.compile}, - {_L['_Next Error'], {_M.textadept.run.goto_error, false, true}}, - {_L['_Previous Error'], {_M.textadept.run.goto_error, false, false}}, + {_L['_Run'], textadept.run.run}, + {_L['_Compile'], textadept.run.compile}, + {_L['_Next Error'], {textadept.run.goto_error, false, true}}, + {_L['_Previous Error'], {textadept.run.goto_error, false, false}}, SEPARATOR, { title = _L['_Adeptsense'], - {_L['_Complete Symbol'], _M.textadept.adeptsense.complete}, - {_L['Show _Documentation'], _M.textadept.adeptsense.show_apidoc}, + {_L['_Complete Symbol'], textadept.adeptsense.complete}, + {_L['Show _Documentation'], textadept.adeptsense.show_apidoc}, }, { title = _L['_Bookmark'], - {_L['_Toggle Bookmark'], _M.textadept.bookmarks.toggle}, - {_L['_Clear Bookmarks'], _M.textadept.bookmarks.clear}, - {_L['_Next Bookmark'], {_M.textadept.bookmarks.goto_mark, true}}, - {_L['_Previous Bookmark'], {_M.textadept.bookmarks.goto_mark, false}}, - {_L['_Goto Bookmark...'], _M.textadept.bookmarks.goto_mark}, + {_L['_Toggle Bookmark'], textadept.bookmarks.toggle}, + {_L['_Clear Bookmarks'], textadept.bookmarks.clear}, + {_L['_Next Bookmark'], {textadept.bookmarks.goto_mark, true}}, + {_L['_Previous Bookmark'], {textadept.bookmarks.goto_mark, false}}, + {_L['_Goto Bookmark...'], textadept.bookmarks.goto_mark}, }, { title = _L['Snap_open'], {_L['Snapopen _User Home'], {io.snapopen, _USERHOME}}, @@ -122,10 +122,10 @@ local menubar = { {_L['Snapopen _Current Directory'], utils.snapopen_filedir}, }, { title = _L['_Snippets'], - {_L['_Insert Snippet...'], _M.textadept.snippets._select}, - {_L['_Expand Snippet/Next Placeholder'], _M.textadept.snippets._insert}, - {_L['_Previous Snippet Placeholder'], _M.textadept.snippets._previous}, - {_L['_Cancel Snippet'], _M.textadept.snippets._cancel_current}, + {_L['_Insert Snippet...'], textadept.snippets._select}, + {_L['_Expand Snippet/Next Placeholder'], textadept.snippets._insert}, + {_L['_Previous Snippet Placeholder'], textadept.snippets._previous}, + {_L['_Cancel Snippet'], textadept.snippets._cancel_current}, }, SEPARATOR, {_L['Show St_yle'], utils.show_style}, @@ -142,7 +142,7 @@ local menubar = { {_L['Tab width: _8'], {utils.set_indentation, 8}}, SEPARATOR, {_L['_Toggle Use Tabs'], {utils.toggle_property, 'use_tabs'}}, - {_L['_Convert Indentation'], m_editing.convert_indentation}, + {_L['_Convert Indentation'], editing.convert_indentation}, }, { title = _L['_EOL Mode'], {_L['CRLF'], {utils.set_eol_mode, buffer.SC_EOL_CRLF}}, @@ -157,7 +157,7 @@ local menubar = { {_L['UTF-1_6 Encoding'], {utils.set_encoding, 'UTF-16LE'}}, }, SEPARATOR, - {_L['Select _Lexer...'], _M.textadept.file_types.select_lexer}, + {_L['Select _Lexer...'], textadept.file_types.select_lexer}, {_L['_Refresh Syntax Highlighting'], {buffer.colourise, buffer, 0, -1}}, }, { title = _L['_View'], diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 38a5e0f4..6a66e8d3 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -33,7 +33,7 @@ local M = {} -- -- * `lexer`: The lexer language name. -- * `output`: The string output from the command. -module('_M.textadept.run')]] +module('textadept.run')]] M.ERROR_COLOR = not CURSES and 'color.light_red' or 'color.red' @@ -231,7 +231,7 @@ function M.goto_error(line, next) -- Goto the error and show an annotation. local err = get_error_details(buffer:get_line(line)) if not err then if CURSES then view:goto_buffer(cur_buf) end return end - _M.textadept.editing.select_line() + textadept.editing.select_line() ui.goto_file(M.cwd..err.filename, true, preferred_view, true) local line, message = err.line, err.message buffer:goto_line(line - 1) diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index 3aca6453..f31a944e 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -22,7 +22,7 @@ local M = {} -- The default value is `10`. -- -- [`io.recent_files`]: io.html#recent_files -module('_M.textadept.session')]] +module('textadept.session')]] M.DEFAULT_SESSION = _USERHOME..(not CURSES and '/session' or '/session_term') M.SAVE_ON_QUIT = true @@ -36,7 +36,7 @@ M.MAX_RECENT_FILES = 10 -- @param filename Optional absolute path to the session file to load. If `nil`, -- the user is prompted for one. -- @return `true` if the session file was opened and read; `false` otherwise. --- @usage _M.textadept.session.load(filename) +-- @usage textadept.session.load(filename) -- @see DEFAULT_SESSION -- @name load function M.load(filename) @@ -123,7 +123,7 @@ end) -- Saves split views, opened buffers, cursor information, and recent files. -- @param filename Optional absolute path to the session file to save. If `nil`, -- the user is prompted for one. --- @usage _M.textadept.session.save(filename) +-- @usage textadept.session.save(filename) -- @see DEFAULT_SESSION -- @name save function M.save(filename) diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua index aa2933f8..76c36223 100644 --- a/modules/textadept/snippets.lua +++ b/modules/textadept/snippets.lua @@ -74,7 +74,7 @@ local M = {} -- A single set of line ending delimiters based on the user's end of line mode. -- -- [`io.popen()`]: http://www.lua.org/manual/5.2/manual.html#pdf-io.popen -module('_M.textadept.snippets')]=] +module('textadept.snippets')]=] -- The stack of currently running snippets. local snippet_stack = {} @@ -376,7 +376,7 @@ events.connect(events.VIEW_NEW, --- -- Map of snippet triggers with their snippet text, with language-specific -- snippets tables assigned to a lexer name key. --- This table also contains the `_M.textadept.snippets` module. +-- This table also contains the `textadept.snippets` module. -- @class table -- @name _G.snippets _G.snippets = M -- cgit v1.2.3