logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

digraph.lua (617B)


  1. -- insert digraphs using vis-digraph(1)
  2. vis:map(vis.modes.INSERT, "<C-k>", function(keys)
  3. if #keys < 2 then
  4. return -1 -- need more input
  5. end
  6. local file = io.popen(string.format("vis-digraph '%s' 2>&1", keys:gsub("'", "'\\''")))
  7. local output = file:read('*all')
  8. local success, msg, status = file:close()
  9. if success then
  10. if vis.mode == vis.modes.INSERT then
  11. vis:insert(output)
  12. elseif vis.mode == vis.modes.REPLACE then
  13. vis:replace(output)
  14. end
  15. elseif msg == 'exit' then
  16. if status == 2 then
  17. return -1 -- prefix need more input
  18. end
  19. vis:info(output)
  20. end
  21. return #keys
  22. end, "Insert digraph")