pantran.nvim icon indicating copy to clipboard operation
pantran.nvim copied to clipboard

[ask] how to setup plugin using lazy

Open muhfaris opened this issue 10 months ago • 9 comments

hi @potamides can you explain to me how to setup this plugin using lazy.nvim my config below, is not work properly.

return {
  "potamides/pantran.nvim",
  keys = {
    { "<leader>ttx", desc = "translate text" },
  },
  config = function()
    require("pantran").setup {
      -- Default engine to use for translation. To list valid engine names run
      -- `:lua =vim.tbl_keys(require("pantran.engines"))`.
      default_engine = "google",
      -- Configuration for individual engines goes here.
      engines = {
        yandex = {
          -- Default languages can be defined on a per engine basis. In this case
          -- `:lua require("pantran.async").run(function()
          -- vim.pretty_print(require("pantran.engines").yandex:languages()) end)`
          -- can be used to list available language identifiers.
          default_source = "auto",
          default_target = "en",
        },
      },
      controls = {
        mappings = {
          edit = {
            n = {
              -- Use this table to add additional mappings for the normal mode in
              -- the translation window. Either strings or function references are
              -- supported.
              ["j"] = "gj",
              ["k"] = "gk",
            },
            i = {
              -- Similar table but for insert mode. Using 'false' disables
              -- existing keybindings.
              ["<C-y>"] = true,
              ["<C-a>"] = require("pantran.ui.actions").yank_close_translation,
            },
          },
          -- Keybindings here are used in the selection window.
          select = {
            n = {
              -- ...
            },
          },
        },
      },
    }
  end,
}

thanks

muhfaris avatar Aug 15 '23 16:08 muhfaris