From 28fae462be95a0573113c76d9d2641e73dd1b44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 28 Feb 2017 09:54:32 +0100 Subject: lua: move digraph handling to separate 'plugin' Load a standard plugins directly from vis-std.lua. --- lua/vis-std.lua | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'lua/vis-std.lua') diff --git a/lua/vis-std.lua b/lua/vis-std.lua index 55d37d2..a4171bd 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -123,26 +123,8 @@ vis.events.subscribe(vis.events.WIN_STATUS, function(win) win:status(left, right); end) --- additional default keybindings +-- default plugins -vis:map(vis.modes.INSERT, "", function(keys) - if #keys < 2 then - return -1 -- need more input - end - local file = io.popen(string.format("vis-digraph '%s' 2>&1", keys:gsub("'", "'\\''"))) - local output = file:read('*all') - local success, msg, status = file:close() - if success then - if vis.mode == vis.modes.INSERT then - vis:insert(output) - elseif vis.mode == vis.modes.REPLACE then - vis:replace(output) - end - elseif msg == 'exit' then - if status == 2 then - return -1 -- prefix need more input - end - vis:info(output) - end - return #keys -end, "Insert digraph") +require('plugins/filetype') +require('plugins/textobject-lexer') +require('plugins/digraph') -- cgit v1.2.3