diff options
author | 2021-11-05 12:30:41 -0400 | |
---|---|---|
committer | 2021-11-05 12:30:41 -0400 | |
commit | d7b230840e6fbc493da8075218d55186d4dab4b6 (patch) | |
tree | aec28045b2b14c8cbed291cadafe5f070cb188f7 /modules/textadept | |
parent | 3a825add3b5c2919ea2f88e027e45c2172575e1f (diff) |
Added '`' to autopair and typeover.
Also, small code cleanup.
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/editing.lua | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index d115d1e1..f4f46f37 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -83,32 +83,37 @@ M.comment_string = {actionscript='//',ada='--',apdl='!',ansi_c='/*|*/',antlr='// --- -- Map of auto-paired characters like parentheses, brackets, braces, and quotes. -- The ASCII values of opening characters are assigned to strings that contain complement --- characters. The default auto-paired characters are "()", "[]", "{}", "''", and --- """". +-- characters. The default auto-paired characters are "()", "[]", "{}", "''", +-- """", and "``". -- @class table -- @name auto_pairs --- @usage textadept.editing.auto_pairs[60] = '>' -- pair '<' and '>' +-- @usage textadept.editing.auto_pairs[string.byte('<')] = '>' -- @usage textadept.editing.auto_pairs = nil -- disable completely -M.auto_pairs = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'} +M.auto_pairs = {} +for k, v in pairs{['('] = ')', ['['] = ']', ['{'] = '}', ["'"] = "'", ['"'] = '"', ['`'] = '`'} do + M.auto_pairs[string.byte(k)] = v +end --- -- Table of brace characters to highlight. --- The ASCII values of brace characters are keys and are assigned non-`nil` values. The default --- brace characters are '(', ')', '[', ']', '{', and '}'. +-- The ASCII values of brace characters are keys and are assigned `true`. The default brace +-- characters are '(', ')', '[', ']', '{', and '}'. -- @class table -- @name brace_matches --- @usage textadept.editing.brace_matches[60] = true -- '<' --- @usage textadept.editing.brace_matches[62] = true -- '>' -M.brace_matches = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1} +-- @usage textadept.editing.brace_matches[string.byte('<')] = true +-- @usage textadept.editing.brace_matches[string.byte('>')] = true +M.brace_matches = {} +for _, c in utf8.codes('()[]{}') do M.brace_matches[c] = true end --- -- Table of characters to move over when typed. --- The ASCII values of characters are keys and are assigned non-`nil` values. The default --- characters are ')', ']', '}', ''', and '"'. +-- The ASCII values of characters are keys and are assigned `true` values. The default characters +-- are ')', ']', '}', ''', '"', and '`'. -- @class table -- @name typeover_chars --- @usage textadept.editing.typeover_chars[62] = true -- '>' -M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1} +-- @usage textadept.editing.typeover_chars[string.byte('>')] = true +M.typeover_chars = {} +for _, c in utf8.codes([[)]}'"`]]) do M.typeover_chars[c] = true end --- -- Map of autocompleter names to autocompletion functions. |