Wrapper for Diagon directly inside neovim. Rewrite of the vim-diagon plugin using lua and plenary to communicate with the diagon CLI.
Diagon CLI is necessary. It can be installed from the Snap Store.
sudo snap install diagon
Using lazy.nvim:
{
'h8rtv/diagon.nvim',
cmd = 'Diagon', -- Load only when the Diagon command gets called
lazy = true,
opts = {},
dependencies = {
{ 'nvim-lua/plenary.nvim' },
},
},
Write your Diagon input and visually select it. Then run the command :Diagon <translator>
. It will write the output in the current buffer.
You can select inside a comment block and the output will be commented too.
Screencast.from.20-12-2023.18.54.44.webm
These are the default configuration options. You can pass it to the require('diagon.nvim').setup(...)
function. In lazy, you can use the opts
property.
local defaults = {
pos = 'substitute', -- 'above' | 'below' | 'substitute' -- You can select the result will substitute de input, be written above or bellow.
translators = { -- You can select the allowed translators.
'Math',
'Sequence',
'Tree',
'Table',
'Grammar',
'Frame',
'GraphDAG',
'GraphPlanar',
'Flowchart',
},
}