From adf389c08355590da96ecdb638f2bd31f9bf7a65 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 18 Aug 2013 12:48:31 +0000 Subject: [PATCH] Added example init.lua file --- editors/textadept/README.md | 14 ++------- editors/textadept/modules/dmd/init.lua | 39 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 editors/textadept/modules/dmd/init.lua diff --git a/editors/textadept/README.md b/editors/textadept/README.md index ae28843..02cc4d3 100644 --- a/editors/textadept/README.md +++ b/editors/textadept/README.md @@ -1,15 +1,5 @@ #Textadept Integration ###Installation -1. Copy the dcd.lua file into your ~/.textadept/modules/dmd/ folder -2. Modify your ~/.textadept/modules/dmd/init.lua file: - - 1. Require the dcd module - - _M.dcd = require "dmd.dcd" - - 2. Register the autocomplete function - - events.connect(events.CHAR_ADDED, function(ch) - _M.dcd.autocomplete(ch) - end) +* Copy the dcd.lua and init.lua file into your ~/.textadept/modules/dmd/ folder. +* Start the dcd-server program. diff --git a/editors/textadept/modules/dmd/init.lua b/editors/textadept/modules/dmd/init.lua new file mode 100644 index 0000000..cda5f90 --- /dev/null +++ b/editors/textadept/modules/dmd/init.lua @@ -0,0 +1,39 @@ +local M = {} + +_M.dcd = require "dmd.dcd" + +if type(_G.snippets) == 'table' then + _G.snippets.dmd = {} +end + +if type(_G.keys) == 'table' then + _G.keys.dmd = {} +end + +events.connect(events.CHAR_ADDED, function(ch) + _M.dcd.autocomplete(ch) +end) + +local function autocomplete() + _M.dcd.registerImages() + _M.dcd.autocomplete(string.byte('.')) + if not buffer:auto_c_active() then + _M.textadept.editing.autocomplete_word(keywords) + end +end + +-- D-specific key commands. +keys.dmd = { + [keys.LANGUAGE_MODULE_PREFIX] = { + m = { io.open_file, + (_USERHOME..'/modules/dmd/init.lua'):iconv('UTF-8', _CHARSET) }, + }, + ['c\n'] = {autocomplete}, + ['down'] = {_M.dcd.cycleCalltips, 1}, + ['up'] = {_M.dcd.cycleCalltips, -1}, +} + +function M.set_buffer_properties() +end + +return M