Closed TornaxO7 closed 1 year ago
Hi! You need to use an <expr>
mapping or it won't work. Also, ops
in the argument list is probably a typo and should be opts
. The following should work:
local pantran = require("pantran")
local opts = {noremap = true, silent = true, expr = true}
vim.keymap.set("n", "mt", pantran.motion_translate, opts)
vim.keymap.set("x", "mt", pantran.motion_translate, opts)
Oh, I just realized that the example mappings in the README do not contain the <expr>
flag. Thanks for bringing this to my attention!
Also, ops in the argument list is probably a typo and should be opts.
Ah yes, you're right!
You need to use an
mapping or it won't work.
Oh ok
Oh, I just realized that the example mappings in the README do not contain the
flag. Thanks for bringing this to my attention!
Good that it's added now ^^
Hm.... Now I'm getting another issue. This is my setup call:
pantran.setup({
default_engine = "google",
engines = {
google = {
default_source = "en",
default_target = "de",
},
}
})
now if I execute my keybinding, the ui opens as follows:
I expected to have de
as the target language. Am I doing something wrong?
Ah yes, that might be a bit tricky. Did you set up a Bearer token or API key for Google somewhere? If not Pantran uses a fallback API. Since the options and language identifiers can be different for that configuration is done in the fallback
table. So your config should look like this:
pantran.setup({
default_engine = "google",
engines = {
google = {
fallback = {
default_source = "en",
default_target = "de",
}
}
}
})
Yay, it's fully working now as expected! Thank you :)
Ah yes, that might be a bit tricky. Did you set up a Bearer token or API key for Google somewhere? If not Pantran uses a fallback API. Since the options and language identifiers can be different for that configuration is done in the
fallback
table. So your config should look like this:pantran.setup({ default_engine = "google", engines = { google = { fallback = { default_source = "en", default_target = "de", } } } })
I think this should be written somewhere in the README.
Hi! I have the following keybindings at the moment:
When I do
nvim /tmp/test.txt
and pressmt
nothing happens. But if I useinstead, pressing
mt
works in normal mode but not in visual mode.