diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cpp/init.lua | 16 | ||||
-rw-r--r-- | modules/lua/init.lua | 14 | ||||
-rw-r--r-- | modules/textadept/adeptsense.lua | 34 | ||||
-rw-r--r-- | modules/textadept/bookmarks.lua | 6 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 8 | ||||
-rw-r--r-- | modules/textadept/file_types.lua | 2 | ||||
-rw-r--r-- | modules/textadept/find.lua | 4 | ||||
-rw-r--r-- | modules/textadept/init.lua | 4 | ||||
-rw-r--r-- | modules/textadept/keys.lua | 105 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 96 | ||||
-rw-r--r-- | modules/textadept/run.lua | 4 | ||||
-rw-r--r-- | modules/textadept/session.lua | 6 | ||||
-rw-r--r-- | modules/textadept/snippets.lua | 4 |
13 files changed, 151 insertions, 152 deletions
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, '</'..buffer:text_range(pos, buffer.current_pos)) @@ -233,7 +233,7 @@ M.utils = { ui.find.in_files = true ui.find.focus() end, - select_command = function() _M.textadept.menu.select_command() end, + select_command = function() textadept.menu.select_command() end, snapopen_filedir = function() if buffer.filename then io.snapopen(buffer.filename:match('^(.+)[/\\]')) end end, @@ -303,8 +303,8 @@ end events.connect(events.BUFFER_NEW, constantize_menu_buffer_functions) constantize_menu_buffer_functions() -- for the first buffer -local _M, keys, buffer, view = _M, keys, buffer, view -local m_editing, utils = _M.textadept.editing, M.utils +local keys, buffer, view = keys, buffer, view +local editing, utils = textadept.editing, M.utils local OSX, CURSES = OSX, CURSES -- Windows and Linux key bindings. @@ -372,8 +372,8 @@ keys[not OSX and 'cs' or 'ms'] = buffer.save keys[not OSX and (not CURSES and 'cS' or 'cms') or 'mS'] = buffer.save_as keys[not OSX and 'cw' or 'mw'] = buffer.close keys[not OSX and (not CURSES and 'cW' or 'cmw') or 'mW'] = io.close_all --- TODO: _M.textadept.sessions.load --- TODO: _M.textadept.sessions.save +-- TODO: textadept.sessions.load +-- TODO: textadept.sessions.save keys[not OSX and 'cq' or 'mq'] = quit -- Edit. @@ -388,55 +388,55 @@ keys.del = buffer.clear keys[not OSX and (not CURSES and 'adel' or 'mdel') or 'cdel'] = utils.delete_word keys[not OSX and not CURSES and 'ca' or 'ma'] = buffer.select_all -keys[not CURSES and 'cm' or 'mm'] = m_editing.match_brace +keys[not CURSES and 'cm' or 'mm'] = editing.match_brace keys[not OSX and (not CURSES and 'c\n' or 'cmj') - or 'cesc'] = m_editing.autocomplete_word + or 'cesc'] = editing.autocomplete_word if CURSES and WIN32 then keys['c\r'] = keys['cmj'] end if not CURSES then - keys[not OSX and 'caH' or 'mH'] = m_editing.highlight_word + keys[not OSX and 'caH' or 'mH'] = editing.highlight_word end -keys[not OSX and not CURSES and 'c/' or 'm/'] = m_editing.block_comment -keys.ct = m_editing.transpose_chars -keys[not OSX and (not CURSES and 'cJ' or 'mj') or 'cj'] = m_editing.join_lines +keys[not OSX and not CURSES and 'c/' or 'm/'] = editing.block_comment +keys.ct = editing.transpose_chars +keys[not OSX and (not CURSES and 'cJ' or 'mj') or 'cj'] = editing.join_lines keys[not OSX and (not CURSES and 'c|' or 'c\\') or 'm|'] = {ui.command_entry.enter_mode, 'filter_through'} -- Select. -keys[not CURSES and 'cM' or 'mM'] = {m_editing.match_brace, 'select'} +keys[not CURSES and 'cM' or 'mM'] = {editing.match_brace, 'select'} keys[not OSX and not CURSES and 'c<' - or 'm<'] = {m_editing.select_enclosed, '>', '<'} + 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 |