aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-07-25 23:34:13 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-07-25 23:34:13 -0400
commit033416a15fe60fe10387119e0e63bb9ed9e8aedd (patch)
tree31bc4d91e15b484c336eadf25c0008f7bd17facc /modules/textadept/editing.lua
parentb9e5e58446c95344b550c0a6ab91aa57ee9468ef (diff)
downloadtextadept-033416a15fe60fe10387119e0e63bb9ed9e8aedd.tar.gz
textadept-033416a15fe60fe10387119e0e63bb9ed9e8aedd.zip
Documentation overhaul.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index d1d2c4a2..97ac9baa 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -7,6 +7,25 @@ local locale = _G.locale
-- Editing commands for the textadept module.
module('_m.textadept.editing', package.seeall)
+-- Markdown:
+-- ## Settings
+--
+-- * `AUTOPAIR`: Flag indicating whether or not when an opening `(`, `[`, `[`,
+-- `"`, or `'` is typed, its closing complement character is automatically
+-- inserted.
+-- * `HIGHLIGHT_BRACES`: Flag indicating whether or not when the caret is over a
+-- brace character (any of the following: `()[]{}<>`), its matching complement
+-- brace is highlighted.
+-- * `AUTOINDENT`: Flag indicating whether or not when the enter key is pressed,
+-- the inserted line has is indented to match the level of indentation of the
+-- previous line.
+
+-- settings
+AUTOPAIR = true
+HIGHLIGHT_BRACES = true
+AUTOINDENT = true
+-- end settings
+
-- The kill-ring.
-- @field maxn The maximum size of the kill-ring.
local kill_ring = { pos = 1, maxn = 10 }
@@ -53,11 +72,14 @@ local comment_strings = {
ruby = '#~',
}
+if AUTOPAIR then
textadept.events.add_handler('char_added',
function(c) -- matches characters specified in char_matches
if char_matches[c] then buffer:insert_text(-1, char_matches[c]) end
end)
+end
+if HIGHLIGHT_BRACES then
textadept.events.add_handler('update_ui',
function() -- highlights matching braces
local buffer = buffer
@@ -74,7 +96,9 @@ textadept.events.add_handler('update_ui',
buffer:brace_bad_light(-1)
end
end)
+end
+if AUTOINDENT then
textadept.events.add_handler('char_added',
function(char) -- auto-indent on return
if char ~= 10 then return end
@@ -101,6 +125,7 @@ textadept.events.add_handler('char_added',
buffer:set_sel(anchor, caret)
end
end)
+end
-- local functions
local insert_into_kill_ring, scroll_kill_ring