Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.59 KB

README.md

File metadata and controls

56 lines (35 loc) · 1.59 KB

code-explain

This plugin sends selected text to the OpenAI API and retrieves a summary, which is then displayed in a new Neovim window.
This allows you to easily create summaries of code or documentation.

2023-09-13.4.03.03.mov

Prerequisites

  • Neovim 0.5.0 or later
  • curl command-line tool installed

Installation

  1. Add the following line to your init.vim or init.lua to install the plugin.
-- For packer.nvim
use 'ouchi2501/code-explain'
  1. Open Neovim and run or :PackerInstall to install the plugin.

  2. Set your API key and Language.

require("code-explain").setup({token = 'your_api_key',language = 'English'}) -- or Japanese
  1. Set your keymap.
vim.api.nvim_set_keymap('v', '<leader>a', ':lua require("code-explain").print_summary()<CR>', {noremap = true, silent = true})

Usage

To use the code-explain plugin, follow these steps:

  1. In Neovim, enter Visual mode by pressing v, V, or <C-v>.
  2. Select the text you want to send to the API.
  3. Press <leader>s to send the selected text to the API. The result will be displayed in a new window.

Note: If you want to use a different key mapping, replace <leader>s in the init.vim configuration with your preferred key combination. If you have any issues or need further assistance, feel free to ask.

Supported Languages

Currently, the following languages are supported:

  • English (en)
  • Japanese (ja)

License

This project is licensed under the MIT License. See the LICENSE file for more information.