potamides / pantran.nvim

Use your favorite machine translation engines without having to leave your favorite editor.
MIT License
289 stars 2 forks source link

`:'<,'>Pantran` can only translate the whole line #8

Closed Chilly-Blaze closed 1 year ago

Chilly-Blaze commented 1 year ago

I want to be able to translate what is selected in visual mode, so I try:'<,'>Pantranbut it doesn't work.Pantran always translates the whole line word. What should I do?

potamides commented 1 year ago

Commands in Vim are line-based, so even if your selection is within a line, the command still takes the whole line into account (this also holds for :substitute, for example). To get your desired behavior, you can use the recommended keybindings in the README. They are based on Vims map-operator feature, which supports what you want to do.

Chilly-Blaze commented 1 year ago

thx.I will try to solve it.

doongjohn commented 1 year ago

I found an alternative solution:

vim.keymap.set('v', 'your mapping', 'y<cmd>Pantran<cr>p')

btw thank you for creating this plugin! 👍