aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua35
1 files changed, 21 insertions, 14 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index a27a565b..bb53b3ad 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -26,6 +26,7 @@ HIGHLIGHT_BRACES = true
AUTOINDENT = true
-- end settings
+---
-- Comment strings for various lexer languages.
-- Used for the block_comment function.
-- This table is typically populated by language-specific modules.
@@ -34,6 +35,26 @@ AUTOINDENT = true
-- @see block_comment
comment_string = {}
+---
+-- Enclosures for enclosing or selecting ranges of text.
+-- Note chars and tag enclosures are generated at runtime.
+-- You can add entries to the table in language-specific modules and use the
+-- 'enclose' function in key commands.
+-- @class table
+-- @name enclosure
+-- @see enclose
+enclosure = {
+ dbl_quotes = { left = '"', right = '"' },
+ sng_quotes = { left = "'", right = "'" },
+ parens = { left = '(', right = ')' },
+ brackets = { left = '[', right = ']' },
+ braces = { left = '{', right = '}' },
+ chars = { left = ' ', right = ' ' },
+ tags = { left = '>', right = '<' },
+ tag = { left = ' ', right = ' ' },
+ single_tag = { left = '<', right = ' />' }
+}
+
-- Character matching.
-- Used for auto-matching parentheses, brackets, braces, and quotes.
local char_matches = {
@@ -52,20 +73,6 @@ local braces = { -- () [] {} <>
-- Used for displaying call tips.
local current_call_tip = {}
--- Enclosures for enclosing or selecting ranges of text.
--- Note chars and tag enclosures are generated at runtime.
-local enclosure = {
- dbl_quotes = { left = '"', right = '"' },
- sng_quotes = { left = "'", right = "'" },
- parens = { left = '(', right = ')' },
- brackets = { left = '[', right = ']' },
- braces = { left = '{', right = '}' },
- chars = { left = ' ', right = ' ' },
- tags = { left = '>', right = '<' },
- tag = { left = ' ', right = ' ' },
- single_tag = { left = '<', right = ' />' }
-}
-
textadept.events.add_handler('char_added',
function(c) -- matches characters specified in char_matches
if AUTOPAIR and char_matches[c] and buffer.selections == 1 then