forked from martanne/vis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lua: move digraph handling to separate 'plugin'
Load a standard plugins directly from vis-std.lua.
- Loading branch information
Showing
3 changed files
with
27 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- insert digraphs using vis-digraph(1) | ||
|
||
vis:map(vis.modes.INSERT, "<C-k>", 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters