aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/adeptsense.lua44
-rw-r--r--modules/textadept/command_entry.lua4
-rw-r--r--modules/textadept/editing.lua8
-rw-r--r--modules/textadept/find.lua6
-rw-r--r--modules/textadept/keys.lua128
-rw-r--r--modules/textadept/menu.lua280
-rw-r--r--modules/textadept/run.lua2
-rw-r--r--modules/textadept/session.lua6
-rw-r--r--modules/textadept/snapopen.lua10
-rw-r--r--modules/textadept/snippets.lua14
10 files changed, 247 insertions, 255 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 0f8f15a3..6f19163e 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -121,8 +121,8 @@ local M = {}
--
-- sense.completions = {
-- ['class1'] = {
--- functions = { 'fun1', 'fun2', ...},
--- fields = { 'f1', 'f2', ... }
+-- functions = {'fun1', 'fun2', ...},
+-- fields = {'f1', 'f2', ...}
-- },
-- ['class2'] = ...,
-- ...
@@ -165,7 +165,7 @@ local M = {}
-- [`api_files`](#api_files) table. See the previous link for documentation on
-- how the API file should be structured.
--
--- sense.api_files = { _HOME..'/modules/lua/api' }
+-- sense.api_files = {_HOME..'/modules/lua/api'}
--
-- ### Triggers
--
@@ -450,7 +450,7 @@ function M.get_class(sense, symbol)
s, e, assignment = line:find(assignment_patt)
if assignment then
for patt, type in pairs(type_assignments) do
- local captures = { assignment:match(patt) }
+ local captures = {assignment:match(patt)}
if #captures > 0 then
class = type:gsub('%%(%d+)', function(n)
return captures[tonumber(n)]
@@ -626,7 +626,7 @@ end
-- @name get_apidoc
function M.get_apidoc(sense, symbol)
if not symbol then return nil end
- local apidocs = { pos = 1 }
+ local apidocs = {pos = 1}
local word_chars = sense.syntax.word_chars
local patt = string.format('^(.-)[^%s]*([%s]+)$', word_chars, word_chars)
local entity, func = symbol:match(patt)
@@ -728,18 +728,18 @@ function M.load_ctags(sense, tag_file, nolocations)
if kind == M.FUNCTION or kind == M.FIELD then
-- Update completions.
-- If no class structure is found, the global namespace is used.
- for _, key in ipairs{ 'class', 'interface', 'struct', 'union', '' } do
+ for _, key in ipairs{'class', 'interface', 'struct', 'union', ''} do
local class = (key == '') and '' or ext_fields:match(key..':(%S+)')
if class then
if not completions[class] then
- completions[class] = { fields = {}, functions = {} }
+ completions[class] = {fields = {}, functions = {}}
end
local t = completions[class][kind]
t[#t + 1] = tag_name..(kind == M.FIELD and '?1' or '?2')
-- Update locations.
if not nolocations then
if not locations[k] then locations[k] = {} end
- locations[k][class..'#'..tag_name] = { file_name, ex_cmd }
+ locations[k][class..'#'..tag_name] = {file_name, ex_cmd}
end
break
end
@@ -757,21 +757,21 @@ function M.load_ctags(sense, tag_file, nolocations)
-- an empty completions table needs to be added to it so
-- get_completions() does not return prematurely.
if not completions[tag_name] then
- completions[tag_name] = { fields = {}, functions = {} }
+ completions[tag_name] = {fields = {}, functions = {}}
end
end
end
-- Update completions.
-- Add the class to the global namespace.
if not completions[''] then
- completions[''] = { fields = {}, functions = {} }
+ completions[''] = {fields = {}, functions = {}}
end
local t = completions[''].fields
t[#t + 1] = tag_name..'?1'
-- Update locations.
if not nolocations then
if not locations[k] then locations[k] = {} end
- locations[k][tag_name] = { file_name, ex_cmd }
+ locations[k][tag_name] = {file_name, ex_cmd}
end
else
sense:handle_ctag(tag_name, file_name, ex_cmd, ext_fields)
@@ -803,7 +803,7 @@ function M.goto_ctag(sense, k, title)
end
items[#items + 1] = v[1]..':'..v[2]
end
- local columns = { 'Name', 'Location' }
+ local columns = {'Name', 'Location'}
if kind == M.FUNCTION or kind == M.FIELD then
table.insert(columns, 2, 'Class')
end
@@ -888,13 +888,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,
+-- @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,
+-- 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 }
+-- i = _M.textadept.adeptsense.CLASS}
-- @class table
-- @name ctags_kinds
-- @see handle_ctag
@@ -958,8 +958,8 @@ api_files = {},
-- The default value is `'(%u[%w_%.]+)%s+%_'`.
-- @field type_declarations_exclude A table of types to exclude, even if they
-- match a type_declaration pattern. Each excluded type is a table key and has
--- a `true` boolean value. For example, `{ Foo = true }` excludes any type
--- whose name is `Foo`.
+-- a `true` boolean value. For example, `{Foo = true}` excludes any type whose
+-- name is `Foo`.
-- The default value is `{}`.
-- @field type_assignments A map of Lua patterns to class types for variable
-- assignments. This is typically used for dynamically typed languages. For
@@ -974,13 +974,13 @@ syntax = {
class_definition = 'class%s+([%w_]+)',
word_chars = '%w_',
symbol_chars = '[%w_%.]',
- type_declarations = { '(%u[%w_%.]+)%s+%_' }, -- Foo bar
+ type_declarations = {'(%u[%w_%.]+)%s+%_'}, -- Foo bar
type_declarations_exclude = {},
type_assignments = {}
},
- super = setmetatable({}, { __index = M })
- }, { __index = M })
+ super = setmetatable({}, {__index = M})
+ }, {__index = M})
senses[lang] = sense
return sense
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index c1673217..6226ff6c 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -22,7 +22,7 @@ local env = setmetatable({}, {
return f
end,
__newindex = function(t, k, v)
- for _, t2 in ipairs{ buffer, view, gui } do
+ for _, t2 in ipairs{buffer, view, gui} do
if t2[k] ~= nil then t2[k] = v return end
end
rawset(t, k, v)
@@ -51,7 +51,7 @@ events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
local cmpls = {}
prefix = '^'..prefix
if not ok then -- shorthand notation
- for _, t in ipairs{ buffer, view, gui, _G } do
+ for _, t in ipairs{buffer, view, gui, _G} do
for k in pairs(t) do
if type(k) == 'string' and k:find(prefix) then
cmpls[#cmpls + 1] = k
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index b5887555..c7f7b755 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -64,9 +64,9 @@ M.comment_string = {}
-- This table can be populated by language-specific modules.
-- @class table
-- @name char_matches
--- @usage _M.textadept.editing.char_matches.hypertext = { ..., [60] = '>' }
+-- @usage _M.textadept.editing.char_matches.hypertext = {..., [60] = '>'}
-- @see AUTOPAIR
-M.char_matches = { [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' }
+M.char_matches = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'}
---
-- Highlighted brace characters.
@@ -76,9 +76,9 @@ M.char_matches = { [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' }
-- This table can be populated by language-specific modules.
-- @class table
-- @name braces
--- @usage _M.textadept.editing.braces.hypertext = { ..., [60] = 1, [62] = 1 }
+-- @usage _M.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 }
+M.braces = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1}
-- The current call tip.
-- Used for displaying call tips.
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index dee2244b..63faf80c 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -109,7 +109,7 @@ function find.find_in_files(utf8_dir)
if not find.match_case then text = text:lower() end
if find.whole_word then text = '%f[%w_]'..text..'%f[^%w_]' end
local match_case, whole_word = find.match_case, find.whole_word
- local matches = { 'Find: '..text }
+ local matches = {'Find: '..text}
function search_file(file)
local line_num = 1
for line in io.lines(file) do
@@ -189,9 +189,9 @@ local function find_(text, next, flags, nowrap, wrapped)
elseif flags < 16 then -- lua pattern search (forward search only)
text = text:gsub('\\[abfnrtv\\]', escapes)
local buffer_text = buffer:get_text(buffer.length)
- local results = { buffer_text:find(text, buffer.anchor + increment + 1) }
+ local results = {buffer_text:find(text, buffer.anchor + increment + 1)}
if #results > 0 then
- find.captures = { table.unpack(results, 3) }
+ find.captures = {table.unpack(results, 3)}
buffer:set_sel(results[2], results[1] - 1)
end
result = results[1] or -1
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 394c7a9a..c6263f16 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -393,7 +393,7 @@ keys[not OSX and (not NCURSES and 'adel' or 'mdel')
keys[not OSX and not NCURSES and 'ca' or 'ma'] = buffer.select_all
keys[not NCURSES and 'cm' or 'mm'] = m_editing.match_brace
keys[not OSX and (not NCURSES and 'c\n' or 'cmj')
- or 'cesc'] = { m_editing.autocomplete_word, '%w_' }
+ or 'cesc'] = {m_editing.autocomplete_word, '%w_'}
if not NCURSES then
keys[not OSX and 'caH' or 'mH'] = m_editing.highlight_word
end
@@ -401,22 +401,22 @@ keys[not OSX and not NCURSES and 'c/' or 'm/'] = m_editing.block_comment
keys.ct = m_editing.transpose_chars
keys[not OSX and (not NCURSES and 'cJ' or 'mj') or 'cj'] = m_editing.join_lines
-- Select.
-keys[not NCURSES and 'cM' or 'mM'] = { m_editing.match_brace, 'select' }
+keys[not NCURSES and 'cM' or 'mM'] = {m_editing.match_brace, 'select'}
keys[not OSX and not NCURSES and 'c<'
- or 'm<'] = { m_editing.select_enclosed, '>', '<' }
+ or 'm<'] = {m_editing.select_enclosed, '>', '<'}
if not NCURSES then
- keys[not OSX and 'c>' or 'm>'] = { m_editing.select_enclosed, '<', '>' }
+ keys[not OSX and 'c>' or 'm>'] = {m_editing.select_enclosed, '<', '>'}
end
keys[not OSX and not NCURSES and "c'"
- or "m'"] = { m_editing.select_enclosed, "'", "'" }
+ or "m'"] = {m_editing.select_enclosed, "'", "'"}
keys[not OSX and not NCURSES and 'c"'
- or 'm"'] = { m_editing.select_enclosed, '"', '"' }
+ or 'm"'] = {m_editing.select_enclosed, '"', '"'}
keys[not OSX and not NCURSES and 'c('
- or 'm('] = { m_editing.select_enclosed, '(', ')' }
+ or 'm('] = {m_editing.select_enclosed, '(', ')'}
keys[not OSX and not NCURSES and 'c['
- or 'm['] = { m_editing.select_enclosed, '[', ']' }
+ or 'm['] = {m_editing.select_enclosed, '[', ']'}
keys[not OSX and not NCURSES and 'c{'
- or 'm{'] = { m_editing.select_enclosed, '{', '}' }
+ or 'm{'] = {m_editing.select_enclosed, '{', '}'}
keys[not OSX and (not NCURSES and 'cD' or 'mW') or 'mD'] = m_editing.select_word
keys[not OSX and not NCURSES and 'cN' or 'mN'] = m_editing.select_line
keys[not OSX and not NCURSES and 'cP' or 'mP'] = m_editing.select_paragraph
@@ -427,19 +427,18 @@ keys[not OSX and (not NCURSES and 'caU' or 'cml') or 'cU'] = buffer.lower_case
keys[not OSX and (not NCURSES and 'a<' or 'm>')
or 'c<'] = utils.enclose_as_xml_tags
if not NCURSES 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>'] = {m_editing.enclose, '<', ' />'}
+ keys[not OSX and "a'" or "c'"] = {m_editing.enclose, "'", "'"}
+ keys[not OSX and 'a"' or 'c"'] = {m_editing.enclose, '"', '"'}
end
keys[not OSX and (not NCURSES and 'a(' or 'm)')
- or 'c('] = { m_editing.enclose, '(', ')' }
+ or 'c('] = {m_editing.enclose, '(', ')'}
keys[not OSX and (not NCURSES and 'a[' or 'm]')
- or 'c['] = { m_editing.enclose, '[', ']' }
+ or 'c['] = {m_editing.enclose, '[', ']'}
keys[not OSX and (not NCURSES and 'a{' or 'm}')
- or 'c{'] = { m_editing.enclose, '{', '}' }
-keys[not OSX and not NCURSES and 'c+' or 'm+'] = { m_editing.grow_selection, 1 }
-keys[not OSX and not NCURSES and 'c_'
- or 'm_'] = { m_editing.grow_selection, -1 }
+ or 'c{'] = {m_editing.enclose, '{', '}'}
+keys[not OSX and not NCURSES and 'c+' or 'm+'] = {m_editing.grow_selection, 1}
+keys[not OSX and not NCURSES and 'c_' or 'm_'] = {m_editing.grow_selection, -1}
keys.csup = buffer.move_selected_lines_up
keys.csdown = buffer.move_selected_lines_down
@@ -460,8 +459,8 @@ keys[not OSX and not NCURSES and 'caf' or 'cmf'] = gui_find.find_incremental
if not NCURSES then keys[not OSX and 'cF' or 'mF'] = utils.find_in_files end
-- Find in Files is ai when find pane is focused in GUI.
if not NCURSES then
- keys[not OSX and 'cag' or 'cmg'] = { gui_find.goto_file_in_list, true }
- keys[not OSX and 'caG' or 'cmG'] = { gui_find.goto_file_in_list, false }
+ keys[not OSX and 'cag' or 'cmg'] = {gui_find.goto_file_in_list, true}
+ keys[not OSX and 'caG' or 'cmG'] = {gui_find.goto_file_in_list, false}
end
keys[not OSX and 'cj' or 'mj'] = m_editing.goto_line
@@ -493,65 +492,65 @@ keys.f2 = m_bookmarks.goto_next
keys[not NCURSES and 'sf2' or 'f3'] = m_bookmarks.goto_prev
keys[not NCURSES and 'af2' or 'f4'] = m_bookmarks.goto_bookmark
-- Snapopen.
-keys[not OSX and 'cu' or 'mu'] = { m_textadept.snapopen.open, _USERHOME }
--- TODO: { m_textadept.snapopen.open, _HOME }
+keys[not OSX and 'cu' or 'mu'] = {m_textadept.snapopen.open, _USERHOME}
+-- TODO: {m_textadept.snapopen.open, _HOME}
keys[not OSX and (not NCURSES and 'caO' or 'mO')
or 'cmO'] = utils.snapopen_filedir
if not NCURSES then keys[not OSX and 'ci' or 'mi'] = utils.show_style end
-- Buffer.
-keys[not NCURSES and 'c\t' or 'mn'] = { view.goto_buffer, view, 1, true }
-keys[not NCURSES and 'cs\t' or 'mp'] = { view.goto_buffer, view, -1, true }
+keys[not NCURSES and 'c\t' or 'mn'] = {view.goto_buffer, view, 1, true}
+keys[not NCURSES and 'cs\t' or 'mp'] = {view.goto_buffer, view, -1, true}
keys[not OSX and not NCURSES and 'cb' or 'mb'] = gui.switch_buffer
if NCURSES then keys.mB = keys.mb end -- in case mb is used by GUI terminals
-- Indentation.
--- TODO: { utils.set_indentation, 2 }
--- TODO: { utils.set_indentation, 3 }
--- TODO: { utils.set_indentation, 4 }
--- TODO: { utils.set_indentation, 8 }
+-- TODO: {utils.set_indentation, 2}
+-- TODO: {utils.set_indentation, 3}
+-- TODO: {utils.set_indentation, 4}
+-- TODO: {utils.set_indentation, 8}
keys[not OSX and (not NCURSES and 'caT' or 'mt')
- or 'cT'] = { utils.toggle_property, 'use_tabs' }
+ or 'cT'] = {utils.toggle_property, 'use_tabs'}
if NCURSES then keys.mT = keys.mt end -- in case mt is used by GUI terminals
keys[not OSX and (not NCURSES and 'cai' or 'mi')
or 'ci'] = m_editing.convert_indentation
-- EOL Mode.
--- TODO: { utils.set_eol_mode, c.SC_EOL_CRLF }
--- TODO: { utils.set_eol_mode, c.SC_EOL_CR }
--- TODO: { utils.set_eol_mode, c.SC_EOL_LF }
+-- TODO: {utils.set_eol_mode, c.SC_EOL_CRLF}
+-- TODO: {utils.set_eol_mode, c.SC_EOL_CR}
+-- TODO: {utils.set_eol_mode, c.SC_EOL_LF}
-- Encoding.
--- TODO: { utils.set_encoding, 'UTF-8' }
--- TODO: { utils.set_encoding, 'ASCII' }
--- TODO: { utils.set_encoding, 'ISO-8859-1' }
--- TODO: { utils.set_encoding, 'MacRoman' }
--- TODO: { utils.set_encoding, 'UTF-16LE' }
+-- TODO: {utils.set_encoding, 'UTF-8'}
+-- TODO: {utils.set_encoding, 'ASCII'}
+-- TODO: {utils.set_encoding, 'ISO-8859-1'}
+-- TODO: {utils.set_encoding, 'MacRoman'}
+-- TODO: {utils.set_encoding, 'UTF-16LE'}
keys[not OSX and not NCURSES and 'cL'
or 'mL'] = m_textadept.mime_types.select_lexer
-keys.f5 = { buffer.colourise, buffer, 0, -1 }
+keys.f5 = {buffer.colourise, buffer, 0, -1}
if NCURSES then keys.cl = keys.f5 end
-- View.
if not NCURSES then
- keys[not OSX and 'can' or 'ca\t'] = { gui.goto_view, 1, true }
- keys[not OSX and 'cap' or 'cas\t'] = { gui.goto_view, -1, true }
- keys[not OSX and 'cas' or 'cs'] = { view.split, view }
+ keys[not OSX and 'can' or 'ca\t'] = {gui.goto_view, 1, true}
+ keys[not OSX and 'cap' or 'cas\t'] = {gui.goto_view, -1, true}
+ keys[not OSX and 'cas' or 'cs'] = {view.split, view}
if not OSX then keys.cah = keys.cas end
- keys[not OSX and 'cav' or 'cv'] = { view.split, view, true }
- keys[not OSX and 'caw' or 'cw'] = { view.unsplit, view }
+ keys[not OSX and 'cav' or 'cv'] = {view.split, view, true}
+ keys[not OSX and 'caw' or 'cw'] = {view.unsplit, view}
keys[not OSX and 'caW' or 'cW'] = utils.unsplit_all
- keys[not OSX and 'ca+' or 'c+'] = { utils.grow, 10 }
- keys[not OSX and 'ca=' or 'c='] = { utils.grow, 10 }
- keys[not OSX and 'ca-' or 'c-'] = { utils.shrink, 10 }
+ keys[not OSX and 'ca+' or 'c+'] = {utils.grow, 10}
+ keys[not OSX and 'ca=' or 'c='] = {utils.grow, 10}
+ keys[not OSX and 'ca-' or 'c-'] = {utils.shrink, 10}
end
keys[not OSX and not NCURSES and 'c*' or 'm*'] = utils.toggle_current_fold
if not NCURSES then
- keys[not OSX and 'ca\n' or 'c\n'] = { utils.toggle_property, 'view_eol' }
+ keys[not OSX and 'ca\n' or 'c\n'] = {utils.toggle_property, 'view_eol'}
if not OSX then keys['ca\n\r'] = keys['ca\n'] end
- keys[not OSX and 'ca\\' or 'c\\'] = { utils.toggle_property, 'wrap_mode' }
+ keys[not OSX and 'ca\\' or 'c\\'] = {utils.toggle_property, 'wrap_mode'}
keys[not OSX and 'caI' or 'cI'] =
- { utils.toggle_property, 'indentation_guides' }
- keys[not OSX and 'caS' or 'cS'] = { utils.toggle_property, 'view_ws' }
+ {utils.toggle_property, 'indentation_guides'}
+ keys[not OSX and 'caS' or 'cS'] = {utils.toggle_property, 'view_ws'}
keys[not OSX and 'caV' or 'cV'] =
- { utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE }
+ {utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE}
end
keys[not OSX and not NCURSES and 'c=' or 'm='] = buffer.zoom_in
keys[not OSX and not NCURSES and 'c-' or 'm-'] = buffer.zoom_out
@@ -560,12 +559,11 @@ if not NCURSES then keys[not OSX and 'cT' or 'mT'] = gui.select_theme end
-- Help.
if not NCURSES then
- keys.f1 = { utils.open_webpage, _HOME..'/doc/01_Introduction.html' }
- keys.sf1 = { utils.open_webpage, _HOME..'/doc/api/index.html' }
+ keys.f1 = {utils.open_webpage, _HOME..'/doc/01_Introduction.html'}
+ keys.sf1 = {utils.open_webpage, _HOME..'/doc/api/index.html'}
end
--- TODO: { gui.dialog, 'ok-msgbox', '--title', 'Textadept'
--- '--informative-text', _RELEASE, '--button1', _L['_OK'],
--- '--no-cancel' }
+-- TODO: {gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text',
+-- _RELEASE, '--button1', _L['_OK'], '--no-cancel'}
-- Movement commands.
if OSX then
@@ -590,18 +588,18 @@ elseif NCURSES then
keys['c^'] = function() mark_mode = not mark_mode end
keys['c]'] = buffer.swap_main_anchor_caret
- keys.cf, keys.cb = { move, 'char_right' }, { move, 'char_left' }
- keys.cn, keys.cp = { move, 'line_down' }, { move, 'line_up' }
- keys.ca, keys.ce = { move, 'vc_home' }, { move, 'line_end' }
+ keys.cf, keys.cb = {move, 'char_right'}, {move, 'char_left'}
+ keys.cn, keys.cp = {move, 'line_down'}, {move, 'line_up'}
+ keys.ca, keys.ce = {move, 'vc_home'}, {move, 'line_end'}
keys.mA, keys.mE = buffer.vc_home_extend, buffer.line_end_extend
- keys.right, keys.cright = keys.cf, { move, 'word_right' }
- keys.left, keys.cleft = keys.cb, { move, 'word_left' }
+ keys.right, keys.cright = keys.cf, {move, 'word_right'}
+ keys.left, keys.cleft = keys.cb, {move, 'word_left'}
keys.down, keys.up = keys.cn, keys.cp
keys.home, keys['end'] = keys.ca, keys.ce
- keys.pgup, keys.mU = { move, 'page_up' }, buffer.page_up_extend
- keys.pgdn, keys.mD = { move, 'page_down' }, buffer.page_down_extend
- keys.cma = { move, 'document_start' }
- keys.cme = { move, 'document_end' }
+ keys.pgup, keys.mU = {move, 'page_up'}, buffer.page_up_extend
+ keys.pgdn, keys.mD = {move, 'page_down'}, buffer.page_down_extend
+ keys.cma = {move, 'document_start'}
+ keys.cme = {move, 'document_end'}
keys.cd, keys.md = buffer.clear, utils.delete_word
keys.ck = utils.cut_to_eol
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index f29919fb..f02c27a2 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -27,7 +27,7 @@ local _L, io, gui, gui_find, buffer, view = _L, io, gui, gui.find, buffer, view
local m_textadept, m_editing = _M.textadept, _M.textadept.editing
local m_bookmarks, Msnippets = m_textadept.bookmarks, m_textadept.snippets
local utils = m_textadept.keys.utils
-local SEPARATOR, c = { '' }, _SCINTILLA.constants
+local SEPARATOR, c = {''}, _SCINTILLA.constants
---
-- Contains the main menubar.
@@ -36,190 +36,184 @@ local SEPARATOR, c = { '' }, _SCINTILLA.constants
-- @name menubar
M.menubar = {
{ title = _L['_File'],
- { _L['_New'], new_buffer },
- { _L['_Open'], io.open_file },
- { _L['Open _Recent...'], io.open_recent_file },
- { _L['Re_load'], buffer.reload },
- { _L['_Save'], buffer.save },
- { _L['Save _As'], buffer.save_as },
+ {_L['_New'], new_buffer},
+ {_L['_Open'], io.open_file},
+ {_L['Open _Recent...'], io.open_recent_file},
+ {_L['Re_load'], buffer.reload},
+ {_L['_Save'], buffer.save},
+ {_L['Save _As'], buffer.save_as},
SEPARATOR,
- { _L['_Close'], buffer.close },
- { _L['Close All'], io.close_all },
+ {_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...'], m_textadept.session.load},
+ {_L['Sav_e Session...'], m_textadept.session.save},
SEPARATOR,
- { _L['_Quit'], quit },
+ {_L['_Quit'], quit},
},
{ title = _L['_Edit'],
- { _L['_Undo'], buffer.undo },
- { _L['_Redo'], buffer.redo },
+ {_L['_Undo'], buffer.undo},
+ {_L['_Redo'], buffer.redo},
SEPARATOR,
- { _L['Cu_t'], buffer.cut },
- { _L['_Copy'], buffer.copy },
- { _L['_Paste'], buffer.paste },
- { _L['Duplicate _Line'], buffer.line_duplicate },
- { _L['_Delete'], buffer.clear },
- { _L['D_elete Word'], utils.delete_word },
- { _L['Select _All'], buffer.select_all },
+ {_L['Cu_t'], buffer.cut},
+ {_L['_Copy'], buffer.copy},
+ {_L['_Paste'], buffer.paste},
+ {_L['Duplicate _Line'], buffer.line_duplicate},
+ {_L['_Delete'], buffer.clear},
+ {_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, '%w_' } },
- { _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'], m_editing.match_brace},
+ {_L['Complete _Word'], {m_editing.autocomplete_word, '%w_'}},
+ {_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},
{ 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'], {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},
},
{ title = _L['Selectio_n'],
- { _L['_Upper Case Selection'], buffer.upper_case },
- { _L['_Lower Case Selection'], buffer.lower_case },
+ {_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 _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, '{', '}'}},
SEPARATOR,
- { _L['_Grow Selection'], { m_editing.grow_selection, 1 } },
- { _L['_Shrink Selection'], { m_editing.grow_selection, -1 } },
+ {_L['_Grow Selection'], {m_editing.grow_selection, 1}},
+ {_L['_Shrink Selection'], {m_editing.grow_selection, -1}},
SEPARATOR,
- { _L['_Move Selected Lines Up'], buffer.move_selected_lines_up },
- { _L['Move Selected Lines Do_wn'], buffer.move_selected_lines_down },
+ {_L['_Move Selected Lines Up'], buffer.move_selected_lines_up},
+ {_L['Move Selected Lines Do_wn'], buffer.move_selected_lines_down},
},
},
{ title = _L['_Search'],
- { _L['_Find'], gui_find.focus },
- { _L['Find _Next'], gui_find.find_next },
- { _L['Find _Previous'], gui_find.find_prev },
- { _L['_Replace'], gui_find.replace },
- { _L['Replace _All'], gui_find.replace_all },
- { _L['Find _Incremental'], gui_find.find_incremental },
+ {_L['_Find'], gui_find.focus},
+ {_L['Find _Next'], gui_find.find_next},
+ {_L['Find _Previous'], gui_find.find_prev},
+ {_L['_Replace'], gui_find.replace},
+ {_L['Replace _All'], gui_find.replace_all},
+ {_L['Find _Incremental'], gui_find.find_incremental},
SEPARATOR,
- { _L['Find in Fi_les'], utils.find_in_files },
- { _L['Goto Nex_t File Found'], { gui_find.goto_file_in_list, true } },
- { _L['Goto Previou_s File Found'], { gui_find.goto_file_in_list, false } },
+ {_L['Find in Fi_les'], utils.find_in_files},
+ {_L['Goto Nex_t File Found'], {gui_find.goto_file_in_list, true}},
+ {_L['Goto Previou_s File Found'], {gui_find.goto_file_in_list, false}},
SEPARATOR,
- { _L['_Jump to'], m_editing.goto_line },
+ {_L['_Jump to'], m_editing.goto_line},
},
{ title = _L['_Tools'],
- { _L['Command _Entry'], gui.command_entry.focus },
- { _L['Select Co_mmand'], utils.select_command },
+ {_L['Command _Entry'], gui.command_entry.focus},
+ {_L['Select Co_mmand'], utils.select_command},
SEPARATOR,
- { _L['_Run'], m_textadept.run.run },
- { _L['_Compile'], m_textadept.run.compile },
- { _L['_Filter Through'], _M.textadept.filter_through.filter_through },
+ {_L['_Run'], m_textadept.run.run},
+ {_L['_Compile'], m_textadept.run.compile},
+ {_L['_Filter Through'], _M.textadept.filter_through.filter_through},
SEPARATOR,
{ title = _L['_Adeptsense'],
- { _L['_Complete Symbol'], m_textadept.adeptsense.complete },
- { _L['Show _Documentation'], m_textadept.adeptsense.show_apidoc },
+ {_L['_Complete Symbol'], m_textadept.adeptsense.complete},
+ {_L['Show _Documentation'], m_textadept.adeptsense.show_apidoc},
},
{ title = _L['_Bookmark'],
- { _L['_Toggle Bookmark'], m_bookmarks.toggle },
- { _L['_Clear Bookmarks'], m_bookmarks.clear },
- { _L['_Next Bookmark'], m_bookmarks.goto_next },
- { _L['_Previous Bookmark'], m_bookmarks.goto_prev },
- { _L['_Goto Bookmark...'], m_bookmarks.goto_bookmark },
+ {_L['_Toggle Bookmark'], m_bookmarks.toggle},
+ {_L['_Clear Bookmarks'], m_bookmarks.clear},
+ {_L['_Next Bookmark'], m_bookmarks.goto_next},
+ {_L['_Previous Bookmark'], m_bookmarks.goto_prev},
+ {_L['_Goto Bookmark...'], m_bookmarks.goto_bookmark},
},
{ title = _L['Snap_open'],
- { _L['Snapopen _User Home'], { m_textadept.snapopen.open, _USERHOME } },
- { _L['Snapopen _Textadept Home'], { m_textadept.snapopen.open, _HOME } },
- { _L['Snapopen _Current Directory'], utils.snapopen_filedir },
+ {_L['Snapopen _User Home'], {m_textadept.snapopen.open, _USERHOME}},
+ {_L['Snapopen _Textadept Home'], {m_textadept.snapopen.open, _HOME}},
+ {_L['Snapopen _Current Directory'], utils.snapopen_filedir},
},
{ title = _L['_Snippets'],
- { _L['_Insert Snippet...'], Msnippets._select },
- { _L['_Expand Snippet/Next Placeholder'], Msnippets._insert },
- { _L['_Previous Snippet Placeholder'], Msnippets._previous },
- { _L['_Cancel Snippet'], Msnippets._cancel_current },
+ {_L['_Insert Snippet...'], Msnippets._select},
+ {_L['_Expand Snippet/Next Placeholder'], Msnippets._insert},
+ {_L['_Previous Snippet Placeholder'], Msnippets._previous},
+ {_L['_Cancel Snippet'], Msnippets._cancel_current},
},
SEPARATOR,
- { _L['Show St_yle'], utils.show_style },
+ {_L['Show St_yle'], utils.show_style},
},
{ title = _L['_Buffer'],
- { _L['_Next Buffer'], { view.goto_buffer, view, 1, true } },
- { _L['_Previous Buffer'], { view.goto_buffer, view, -1, true } },
- { _L['_Switch to Buffer...'], gui.switch_buffer },
+ {_L['_Next Buffer'], {view.goto_buffer, view, 1, true}},
+ {_L['_Previous Buffer'], {view.goto_buffer, view, -1, true}},
+ {_L['_Switch to Buffer...'], gui.switch_buffer},
SEPARATOR,
{ title = _L['_Indentation'],
- { _L['Tab width: _2'], { utils.set_indentation, 2 } },
- { _L['Tab width: _3'], { utils.set_indentation, 3 } },
- { _L['Tab width: _4'], { utils.set_indentation, 4 } },
- { _L['Tab width: _8'], { utils.set_indentation, 8 } },
+ {_L['Tab width: _2'], {utils.set_indentation, 2}},
+ {_L['Tab width: _3'], {utils.set_indentation, 3}},
+ {_L['Tab width: _4'], {utils.set_indentation, 4}},
+ {_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['_Toggle Use Tabs'], {utils.toggle_property, 'use_tabs'}},
+ {_L['_Convert Indentation'], m_editing.convert_indentation},
},
{ title = _L['_EOL Mode'],
- { _L['CRLF'], { utils.set_eol_mode, c.SC_EOL_CRLF } },
- { _L['CR'], { utils.set_eol_mode, c.SC_EOL_CR } },
- { _L['LF'], { utils.set_eol_mode, c.SC_EOL_LF } },
+ {_L['CRLF'], {utils.set_eol_mode, c.SC_EOL_CRLF}},
+ {_L['CR'], {utils.set_eol_mode, c.SC_EOL_CR}},
+ {_L['LF'], {utils.set_eol_mode, c.SC_EOL_LF}},
},
{ title = _L['E_ncoding'],
- { _L['_UTF-8 Encoding'], { utils.set_encoding, 'UTF-8' } },
- { _L['_ASCII Encoding'], { utils.set_encoding, 'ASCII' } },
- { _L['_ISO-8859-1 Encoding'], { utils.set_encoding, 'ISO-8859-1' } },
- { _L['_MacRoman Encoding'], { utils.set_encoding, 'MacRoman' } },
- { _L['UTF-1_6 Encoding'], { utils.set_encoding, 'UTF-16LE' } },
+ {_L['_UTF-8 Encoding'], {utils.set_encoding, 'UTF-8'}},
+ {_L['_ASCII Encoding'], {utils.set_encoding, 'ASCII'}},
+ {_L['_ISO-8859-1 Encoding'], {utils.set_encoding, 'ISO-8859-1'}},
+ {_L['_MacRoman Encoding'], {utils.set_encoding, 'MacRoman'}},
+ {_L['UTF-1_6 Encoding'], {utils.set_encoding, 'UTF-16LE'}},
},
SEPARATOR,
- { _L['Select _Lexer...'], m_textadept.mime_types.select_lexer },
- { _L['_Refresh Syntax Highlighting'],
- { buffer.colourise, buffer, 0, -1 } },
+ {_L['Select _Lexer...'], m_textadept.mime_types.select_lexer},
+ {_L['_Refresh Syntax Highlighting'], {buffer.colourise, buffer, 0, -1}},
},
{ title = _L['_View'],
- { _L['_Next View'], { gui.goto_view, 1, true } },
- { _L['_Previous View'], { gui.goto_view, -1, true } },
+ {_L['_Next View'], {gui.goto_view, 1, true}},
+ {_L['_Previous View'], {gui.goto_view, -1, true}},
SEPARATOR,
- { _L['Split View _Horizontal'], { view.split, view } },
- { _L['Split View _Vertical'], { view.split, view, true } },
- { _L['_Unsplit View'], { view.unsplit, view } },
- { _L['Unsplit _All Views'], utils.unsplit_all },
- { _L['_Grow View'], { utils.grow, 10 } },
- { _L['Shrin_k View'], { utils.shrink, 10 } },
+ {_L['Split View _Horizontal'], {view.split, view}},
+ {_L['Split View _Vertical'], {view.split, view, true}},
+ {_L['_Unsplit View'], {view.unsplit, view}},
+ {_L['Unsplit _All Views'], utils.unsplit_all},
+ {_L['_Grow View'], {utils.grow, 10}},
+ {_L['Shrin_k View'], {utils.shrink, 10}},
SEPARATOR,
- { _L['Toggle Current _Fold'], utils.toggle_current_fold },
+ {_L['Toggle Current _Fold'], utils.toggle_current_fold},
SEPARATOR,
- { _L['Toggle View _EOL'], { utils.toggle_property, 'view_eol' } },
- { _L['Toggle _Wrap Mode'], { utils.toggle_property, 'wrap_mode' } },
- { _L['Toggle Show In_dent Guides'],
- { utils.toggle_property, 'indentation_guides' } },
- { _L['Toggle View White_space'], { utils.toggle_property, 'view_ws' } },
- { _L['Toggle _Virtual Space'],
- { utils.toggle_property, 'virtual_space_options',
- c.SCVS_USERACCESSIBLE } },
+ {_L['Toggle View _EOL'], {utils.toggle_property, 'view_eol'}},
+ {_L['Toggle _Wrap Mode'], {utils.toggle_property, 'wrap_mode'}},
+ {_L['Toggle Show In_dent Guides'],
+ {utils.toggle_property, 'indentation_guides'}},
+ {_L['Toggle View White_space'], {utils.toggle_property, 'view_ws'}},
+ {_L['Toggle _Virtual Space'],
+ {utils.toggle_property, 'virtual_space_options', c.SCVS_USERACCESSIBLE}},
SEPARATOR,
- { _L['Zoom _In'], buffer.zoom_in },
- { _L['Zoom _Out'], buffer.zoom_out },
- { _L['_Reset Zoom'], utils.reset_zoom },
+ {_L['Zoom _In'], buffer.zoom_in},
+ {_L['Zoom _Out'], buffer.zoom_out},
+ {_L['_Reset Zoom'], utils.reset_zoom},
SEPARATOR,
- { _L['Select _Theme...'], gui.select_theme },
+ {_L['Select _Theme...'], gui.select_theme},
},
{ title = _L['_Help'],
- { _L['Show _Manual'],
- { utils.open_webpage, _HOME..'/doc/01_Introduction.html' } },
- { _L['Show _LuaDoc'],
- { utils.open_webpage, _HOME..'/doc/api/index.html' } },
+ {_L['Show _Manual'],
+ {utils.open_webpage, _HOME..'/doc/01_Introduction.html'}},
+ {_L['Show _LuaDoc'], {utils.open_webpage, _HOME..'/doc/api/index.html'}},
SEPARATOR,
- { _L['_About'],
- { gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text',
- _RELEASE, '--button1', _L['_OK'], '--no-cancel' } },
+ {_L['_About'],
+ {gui.dialog, 'ok-msgbox', '--title', 'Textadept', '--informative-text',
+ _RELEASE, '--button1', _L['_OK'], '--no-cancel'}},
},
}
@@ -229,15 +223,15 @@ M.menubar = {
-- @class table
-- @name context_menu
M.context_menu = {
- { _L['_Undo'], buffer.undo },
- { _L['_Redo'], buffer.redo },
+ {_L['_Undo'], buffer.undo},
+ {_L['_Redo'], buffer.redo},
SEPARATOR,
- { _L['Cu_t'], buffer.cut },
- { _L['_Copy'], buffer.copy },
- { _L['_Paste'], buffer.paste },
- { _L['_Delete'], buffer.clear },
+ {_L['Cu_t'], buffer.cut},
+ {_L['_Copy'], buffer.copy},
+ {_L['_Paste'], buffer.paste},
+ {_L['_Delete'], buffer.clear},
SEPARATOR,
- { _L['Select _All'], buffer.select_all }
+ {_L['Select _All'], buffer.select_all}
}
local key_shortcuts = {}
@@ -261,7 +255,7 @@ local function read_menu_table(menu, contextmenu)
local menu_id = not contextmenu and #menu_actions + 1 or
#contextmenu_actions + 1000 + 1
local key, mods = keys.get_gdk_key(key_shortcuts[get_id(f)])
- gtkmenu[#gtkmenu + 1] = { label, menu_id, key, mods }
+ gtkmenu[#gtkmenu + 1] = {label, menu_id, key, mods}
if f then
local actions = not contextmenu and menu_actions or contextmenu_actions
actions[menu_id < 1000 and menu_id or menu_id - 1000] = f
@@ -332,13 +326,13 @@ function M.set_contextmenu(menu_table)
end
if not NCURSES then M.set_contextmenu(M.context_menu) end
-local columns = { _L['Command'], _L['Key Command'] }
+local columns = {_L['Command'], _L['Key Command']}
---
-- Prompts the user with a filtered list dialog to run menu commands.
-- @name select_command
function M.select_command()
local i = gui.filteredlist(_L['Run Command'], columns, items, true,
- NCURSES and { '--width', gui.size[1] - 2 } or '')
+ NCURSES and {'--width', gui.size[1] - 2} or '')
if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end
end
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 7c089547..149c6738 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -79,7 +79,7 @@ end
-- @see error_detail
local function get_error_details(message)
for _, error_detail in pairs(M.error_detail) do
- local captures = { message:match(error_detail.pattern) }
+ local captures = {message:match(error_detail.pattern)}
if #captures > 0 then
local details = {}
for detail, i in pairs(error_detail) do details[detail] = captures[i] end
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 49c49568..80122183 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -51,7 +51,7 @@ function M.load(filename)
local not_found = {}
local f = io.open(filename, 'rb')
if not f then io.close_all() return false end
- local current_view, splits = 1, { [0] = {} }
+ local current_view, splits = 1, {[0] = {}}
local lfs_attributes = lfs.attributes
for line in f:lines() do
if line:find('^buffer:') then
@@ -80,7 +80,7 @@ function M.load(filename)
elseif line:find('^%s*split%d:') then
local level, num, type, size = line:match('^(%s*)split(%d): (%S+) (%d+)')
local view = splits[#level] and splits[#level][tonumber(num)] or view
- splits[#level + 1] = { view:split(type == 'true') }
+ splits[#level + 1] = {view:split(type == 'true')}
splits[#level + 1][1].size = tonumber(size) -- could be 1 or 2
elseif line:find('^%s*view%d:') then
local level, num, buf_idx = line:match('^(%s*)view(%d): (%d+)$')
@@ -92,7 +92,7 @@ function M.load(filename)
current_view = tonumber(line:match('^current_view: (%d+)')) or 1
elseif line:find('^size:') then
local width, height = line:match('^size: (%d+) (%d+)$')
- if width and height then gui.size = { width, height } end
+ if width and height then gui.size = {width, height} end
elseif line:find('^recent:') then
local filename = line:match('^recent: (.+)$')
local recent, exists = io.recent_files, false
diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua
index 268ee3b2..0e91966b 100644
--- a/modules/textadept/snapopen.lua
+++ b/modules/textadept/snapopen.lua
@@ -28,7 +28,7 @@ M.FILTER = {
'a', 'bmp', 'bz2', 'class', 'dll', 'exe', 'gif', 'gz', 'jar', 'jpeg', 'jpg',
'o', 'png', 'so', 'tar', 'tgz', 'tif', 'tiff', 'zip'
},
- folders = { '%.bzr$', '%.git$', '%.hg$', '%.svn$', 'CVS$' }
+ folders = {'%.bzr$', '%.git$', '%.hg$', '%.svn$', 'CVS$'}
}
M.DEFAULT_DEPTH = 99
M.MAX = 1000
@@ -105,7 +105,7 @@ end
-- -- list all files in the current file's directory
-- @usage _M.textadept.snapopen.open(nil, '!%.lua$') -- list all Lua files in
-- PATHS
--- @usage _M.textadept.snapopen.open('/project', { folders = { 'secret' } },
+-- @usage _M.textadept.snapopen.open('/project', {folders = {'secret'}},
-- true) -- list all project files except those in a secret folder
-- @see PATHS
-- @see FILTER
@@ -115,10 +115,10 @@ end
function M.open(utf8_paths, filter, exclude_PATHS, exclude_FILTER, depth)
-- Convert utf8_paths to a table from nil or string arguments.
if not utf8_paths then utf8_paths = {} end
- if type(utf8_paths) == 'string' then utf8_paths = { utf8_paths } end
+ if type(utf8_paths) == 'string' then utf8_paths = {utf8_paths} end
-- Convert filter to a table from nil or string arguments.
if not filter then filter = {} end
- if type(filter) == 'string' then filter = { filter } end
+ if type(filter) == 'string' then filter = {filter} end
-- Add PATHS to utf8_paths unless specified otherwise.
if not exclude_PATHS then
for i = 1, #M.PATHS do utf8_paths[#utf8_paths + 1] = M.PATHS[i] end
@@ -149,7 +149,7 @@ function M.open(utf8_paths, filter, exclude_PATHS, exclude_FILTER, depth)
M.MAX),
'--button1', _L['_OK'])
end
- local width = NCURSES and { '--width', gui.size[1] - 2 } or ''
+ local width = NCURSES and {'--width', gui.size[1] - 2} or ''
local utf8_filenames = gui.filteredlist(_L['Open'], _L['File'], list, false,
'--select-multiple', width) or ''
for filename in utf8_filenames:gmatch('[^\n]+') do io.open_file(filename) end
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index c179a580..9654a7c2 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -83,7 +83,7 @@ local snippet_stack = {}
-- This table is used by `new_snippet()`.
-- @class table
-- @name newlines
-local newlines = { [0] = '\r\n', '\r', '\n' }
+local newlines = {[0] = '\r\n', '\r', '\n'}
local INDIC_SNIPPET = _SCINTILLA.next_indic_number()
@@ -96,12 +96,12 @@ local function new_snippet(text, trigger)
trigger = trigger,
original_sel_text = buffer:get_sel_text(),
snapshots = {}
- }, { __index = M._snippet_mt })
+ }, {__index = M._snippet_mt})
snippet_stack[#snippet_stack + 1] = snippet
-- Convert and match indentation.
local lines = {}
- local indent = { [true] = '\t', [false] = (' '):rep(buffer.tab_width) }
+ local indent = {[true] = '\t', [false] = (' '):rep(buffer.tab_width)}
local use_tabs = buffer.use_tabs
for line in (text..'\n'):gmatch('([^\r\n]*)\r?\n') do
lines[#lines + 1] = line:gsub('^(%s*)', function(indentation)
@@ -195,9 +195,9 @@ function M._select()
t[#t + 1], t[#t + 2], t[#t + 3] = list[i]:match('^(%Z+)%z(%Z+)%z(%Z+)$')
end
local i = gui.filteredlist(_L['Select Snippet'],
- { _L['Trigger'], _L['Scope'], _L['Snippet Text'] },
+ {_L['Trigger'], _L['Scope'], _L['Snippet Text']},
t, true, '--output-column', '2',
- NCURSES and { '--width', gui.size[1] - 2 } or '')
+ NCURSES and {'--width', gui.size[1] - 2} or '')
if i then M._insert(t[(i + 1) * 3]) end
end
@@ -268,8 +268,8 @@ M._snippet_mt = {
local escaped_text = snippet:get_escaped_text()
-- Lua code.
escaped_text = escaped_text:gsub('%%'..index..'<([^>]*)>', function(code)
- local env = setmetatable({ selected_text = snippet.original_sel_text },
- { __index = _G })
+ local env = setmetatable({selected_text = snippet.original_sel_text},
+ {__index = _G})
local f, result = load('return '..snippet.unescape_text(code, true), nil,
'bt', env)
if f then f, result = pcall(f) end