|
1 |
| -# Code Explain |
| 1 | +# codeexplain.nvim |
2 | 2 |
|
3 |
| -## Python dependencies |
4 |
| -```bash |
5 |
| -pip install pynvim langchain pygpt4all llama-cpp-python pygments |
6 |
| -``` |
| 3 | +codeexplain.nvim is a NeoVim plugin that uses the powerful [GPT4ALL](https://gpt4all.io/) language model to provide on-the-fly, line-by-line explanations and potential security vulnerabilities for selected code directly in your NeoVim editor. It's like having your personal code assistant right inside your editor without leaking your codebase to any company. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Features |
| 8 | +- No internet necessary |
| 9 | +- Automatic language detection for explaining code. |
| 10 | +- Supports a wide range of programming languages. |
| 11 | +- Powered by [GPT4ALL](https://gpt4all.io/) for code explanation. |
| 12 | +- Identification of potential security vulnerabilities. |
| 13 | +- Creates a new NeoVim window to display the explanations. |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +### Download the GPT4ALL model |
| 18 | + |
| 19 | +Before installing the plugin, download the GPT4ALL model and save it in your home directory: |
7 | 20 |
|
8 |
| -## Model |
9 | 21 | ```bash
|
10 | 22 | mkdir -p "$HOME/.codeexplain/"
|
11 | 23 | curl -o "$HOME/.codeexplain/model.bin" https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin
|
12 | 24 | ```
|
13 | 25 |
|
14 |
| -## Packer |
15 |
| -``` |
16 |
| - use { 'mthbernardes/codeexplain.nvim', run = ':UpdateRemotePlugins' } |
| 26 | +### vim-plug |
| 27 | + |
| 28 | +Add the following line to your `init.vim`: |
| 29 | + |
| 30 | +```vim |
| 31 | +Plug 'mthbernardes/codeexplain.nvim' |
17 | 32 | ```
|
18 | 33 |
|
19 |
| -## vim-plug |
20 |
| -``` |
21 |
| - Plug 'mthbernardes/codeexplain.nvim', { 'do': ':UpdateRemotePlugins' } |
| 34 | +Then run the following commands in your NeoVim editor: |
| 35 | + |
| 36 | +```vim |
| 37 | +:source % |
| 38 | +:PlugInstall |
22 | 39 | ```
|
23 | 40 |
|
| 41 | +### packer.nvim |
| 42 | + |
| 43 | +Add the following to your `plugins.lua` file: |
| 44 | + |
| 45 | +```lua |
| 46 | +use 'mthbernardes/codeexplain.nvim' |
| 47 | +``` |
| 48 | + |
| 49 | +Then run `PackerSync` in your NeoVim editor. |
| 50 | + |
| 51 | +### Other package managers |
| 52 | + |
| 53 | +Please refer to your package manager's documentation for installation instructions. The general process involves adding a line to your `init.vim` (or equivalent configuration file) and running an installation command. |
| 54 | + |
24 | 55 | ## Usage
|
25 |
| -Select the piece of code and invoke the command `CodeExplain` |
| 56 | + |
| 57 | +Once installed, you can use the plugin by selecting a piece of code in Visual mode and running the `CodeExplain` command: |
| 58 | + |
| 59 | +```vim |
| 60 | +:CodeExplain |
| 61 | +``` |
| 62 | + |
| 63 | +A new window will be opened in your NeoVim editor, displaying line-by-line explanations of the selected code and potential security vulnerabilities. |
| 64 | + |
| 65 | +## Requirements |
| 66 | + |
| 67 | +- NeoVim |
| 68 | +- Python3 |
| 69 | +- pynvim |
| 70 | +- langchain |
| 71 | +- pygments |
| 72 | + |
| 73 | +## Contributions |
| 74 | + |
| 75 | +Contributions are welcome! Please feel free to submit a pull request. |
| 76 | + |
| 77 | +## License |
| 78 | + |
| 79 | +codeexplain.nvim is open-source software licensed under the [MIT license](LICENSE). |
| 80 | + |
| 81 | +## Disclaimer |
| 82 | + |
| 83 | +This plugin uses GPT-4all to provide line-by-line explanations and to point out potential security vulnerabilities in your code. While it strives to be helpful, it's not a replacement for understanding your code or manually checking for security vulnerabilities. Always verify the information provided by this plugin. |
0 commit comments