Skip to content

This plugin sends selected text to the OpenAI API and retrieves a summary, which is then displayed in a new Neovim window.

License

Notifications You must be signed in to change notification settings

ouchi2501/code-explain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

This plugin sends selected text to the OpenAI API and retrieves a summary, which is then displayed in a new Neovim window.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages