diff options
author | 2010-04-10 08:27:25 -0400 | |
---|---|---|
committer | 2010-04-10 08:27:25 -0400 | |
commit | 7f4f30035c8459288666deec9e74f1bc7c41c34f (patch) | |
tree | 18c8ad1f30dfe55015b3a824d91fff749b4a77f0 /modules | |
parent | f5c492e1f1de148af95accb85e958c3ccdffca5c (diff) | |
download | textadept-7f4f30035c8459288666deec9e74f1bc7c41c34f.tar.gz textadept-7f4f30035c8459288666deec9e74f1bc7c41c34f.zip |
Moved block comment strings to language-specific modules.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cpp/commands.lua | 26 | ||||
-rw-r--r-- | modules/lua/commands.lua | 18 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 20 |
3 files changed, 32 insertions, 32 deletions
diff --git a/modules/cpp/commands.lua b/modules/cpp/commands.lua index f01561c4..263b6819 100644 --- a/modules/cpp/commands.lua +++ b/modules/cpp/commands.lua @@ -6,22 +6,24 @@ local textadept = _G.textadept -- Commands for the cpp module. module('_m.cpp.commands', package.seeall) -local run = _m.textadept.run -if run then - run.compile_command.c = 'gcc -pedantic -Os -o "%(filename_noext)" %(filename)' - run.compile_command.cpp = 'g++ -pedantic -Os -o "%(filename_noext)" %(filename)' - run.run_command.c = '%(filedir)%(filename_noext)' - run.run_command.cpp = '%(filedir)%(filename_noext)' - run.error_detail.c = { - pattern = '^(.-):(%d+): (.+)$', - filename = 1, line = 2, message = 3 - } -end +local m_editing, m_run = _m.textadept.editing, _m.textadept.run +-- Comment string tables use lexer names. +m_editing.comment_string.cpp = '//' +-- Compile and Run command tables use file extensions. +m_run.compile_command.c = + 'gcc -pedantic -Os -o "%(filename_noext)" %(filename)' +m_run.compile_command.cpp = + 'g++ -pedantic -Os -o "%(filename_noext)" %(filename)' +m_run.run_command.c = '%(filedir)%(filename_noext)' +m_run.run_command.cpp = '%(filedir)%(filename_noext)' +m_run.error_detail.c = { + pattern = '^(.-):(%d+): (.+)$', + filename = 1, line = 2, message = 3 +} -- C++-specific key commands. local keys = _G.keys if type(keys) == 'table' then - local m_editing = _m.textadept.editing keys.cpp = { al = { m = { textadept.io.open, diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua index b55e2f76..ac68ab84 100644 --- a/modules/lua/commands.lua +++ b/modules/lua/commands.lua @@ -6,14 +6,15 @@ local textadept = _G.textadept -- Commands for the lua module. module('_m.lua.commands', package.seeall) -local run = _m.textadept.run -if run then - run.run_command.lua = 'lua %(filename)' - run.error_detail.lua = { - pattern = '^lua: (.-):(%d+): (.+)$', - filename = 1, line = 2, message = 3 - } -end +local m_editing, m_run = _m.textadept.editing, _m.textadept.run +-- Comment string tables use lexer names. +m_editing.comment_string.lua = '--' +-- Compile and Run command tables use file extensions. +m_run.run_command.lua = 'lua %(filename)' +m_run.error_detail.lua = { + pattern = '^lua: (.-):(%d+): (.+)$', + filename = 1, line = 2, message = 3 +} --- -- Patterns for auto 'end' completion for control structures. @@ -77,7 +78,6 @@ end -- Lua-specific key commands. local keys = _G.keys if type(keys) == 'table' then - local m_editing = _m.textadept.editing keys.lua = { al = { m = { textadept.io.open, diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index cc9dcc25..a27a565b 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -26,6 +26,14 @@ 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. +-- @class table +-- @name comment_string +-- @see block_comment +comment_string = {} + -- Character matching. -- Used for auto-matching parentheses, brackets, braces, and quotes. local char_matches = { @@ -58,16 +66,6 @@ local enclosure = { single_tag = { left = '<', right = ' />' } } --- Comment strings for various lexer languages. --- Used for the block_comment function. --- @see block_comment -local comment_strings = { - cpp = '//~', - lua = '--~', - python = '#~', - ruby = '#~', -} - 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 @@ -189,7 +187,7 @@ end function block_comment(comment) local buffer = buffer if not comment then - comment = comment_strings[buffer:get_lexer_language()] + comment = comment_string[buffer:get_lexer_language()] if not comment then return end end local caret, anchor = buffer.current_pos, buffer.anchor |