Closed abenz1267 closed 2 years ago
Hi,
thanks for reporting this! The way the docs describe it should be the way to configure it, the readme (and the implementation) are wrong here. I'll fix that soon. That being said, your snippet should actually work. This minimal configuration works for me, where exactly do you experience issues?
require('pantran').setup{
engines = {
default_engine = 'deepl'
}
}
Hi,
i tested this both on neovim stable and nightly. I can select deepl via ge
just fine. But the default engine setting doesn't work. I'm on Arch Linux if that matters.
Regards
Very strange. Could you share your config with me?
I think this happens because you make pantran.nvim an optional package which only gets loaded when you invoke :Pantran
.
Because of this the guard has("pantran")
fails as this hasn't happened yet and your setup code isn't called. When you replace
table.insert(PKGS, { 'potamides/pantran.nvim', cmd = 'Pantran' })
with
table.insert(PKGS, { 'potamides/pantran.nvim' })
does it work?
If i make it a non-optional package, i get this error:
Error detected while processing /home/andrej/.local/share/nvim/site/pack/packer/start/pantran.nvim/plugin/pantran.vim:
line 18:
E174: Command already exists: add ! to replace it: Pantran lua require("pantran.command").parse(<line1>, <count>, unpack{<f-args>})
If i make it a non-optional package, i get this error:
This means that something defines the :Pantran
command before the plugin itself is loaded.
In the end it wouldn't make much sense if it did, because WHEN the package gets loaded should be irrelevant for the default engine.
Yes that is true but I think the problem is not when it is loaded but that the setup code is not called because it is run when the plugin is not yet on the path and thus has('pantran')
fails. When you make it optional could you run :lua =has("pantran")
, then :Pantran
, and then again :lua =has("pantran")
? If I am not mistaken it should print false
and then true
If i make it a non-optional package, i get this error:
This means that something defines the
:Pantran
command before the plugin itself is loaded.In the end it wouldn't make much sense if it did, because WHEN the package gets loaded should be irrelevant for the default engine.
Yes that is true but I think the problem is not when it is loaded but that the setup code is not called because it is run when the plugin is not yet on the path and thus
has('pantran')
fails. When you make it optional could you run:lua =has("pantran")
, then:Pantran
, and then again:lua =has("pantran")
? If I am not mistaken it should printfalse
and thentrue
Thank you a lot man, that's a general flaw in my config. I removed the plugin folder and deleted the packer one, re-installed everything and it works.
btw, shouldn't lazy loading pantran work? I mean, it's not something you use often, so it'd be a perfect candidate for lazy loading, wouldn't it be? I have this now:
table.insert(PKGS, { 'potamides/pantran.nvim', opt = true, cmd = { 'Pantran' }, config = function()
require('pantran').setup {
engines = {
default_engine = 'deepl',
deepl = {
free_api = true
}
}
}
end })
Pantran loads, default_engine not.
Hm, i just made it a non optional package, lua =has("pantran")
reports true on initial start, default engine is wrong. i don't understand XD
Edit: i realized you updated the initialization of the default engine. fixed.
i realized you updated the initialization of the default engine. fixed.
Okay perfect! Btw, free_api = true
is the default so you don't necessarily need to specify it explicitly.
Hi,
i realized that setting the default_engine is not working anymore.
Regards