Text converting operator via OpenAI API.
vim.fn["dein#add"]("vim-denops/denops.vim") -- required
vim.fn["dein#add"]("gw31415/denops-aioperator.nvim")
-- Configuration
vim.api.nvim_set_var('aioperator_opts', {
-- ↓This arg will be passed to LangChain's `ChatOpenAI` constructor.
openai = {
apiKey = "sk-********-****-****-****-************",
-- If `apiKey` not specified explicitly, the environment variable `OPENAI_API_KEY` is used.
-- More options: https://api.js.langchain.com/classes/langchain_openai.ChatOpenAI.html
},
-- scroll = false, -- Automatically scroll the window to the bottom. Default: true
})
-- Key mapping
vim.keymap.set({ "n", "x" }, "gG", function(arg)
return require 'aioperator'.opfunc(arg)
end, { expr = true })
This plugin provides only the operator function require 'aioperator'.opfunc
. See :help operator
for more information on how to use the operator.
- Press the operator key you set and select the textobj you want to convert.
- or, you can use the visual mode to select the text before pressing the operator key.
- Input the instruction about the conversion you want to make.
- Press Enter then the conversion result will be inserted.