Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,45 @@ A Neovim plugin for interacting with the Groq API.

If you don't have it already, install Packer with this command

```
```sh
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
```

With that installed, we can now add our packer setup to our '~/.config/nvim/init.lua'
With that installed, we can now add our packer setup to our `~/.config/nvim/init.lua`

### Lazy Setup

```lua
---@type LazySpec
return {
"cdreetz/groq-nvim",
enabled = true,

dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("groq-nvim").setup({
api_key = "your_groq_api_key",
model = "llama3-70b-8192",
})
end,
}
```

### Packer Setup

```lua
-- packer setup
vim.cmd [[packadd packer.nvim]]

require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'nvim-lua/plenary.nvim'

-- Add groq-nvim plugin from GitHub
use {
'cdreetz/groq-nvim',
requires = {'nvim-lua/plenary.nvim'},
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('groq-nvim').setup({
api_key = "your_groq_api_key",
Expand All @@ -34,43 +55,44 @@ require('packer').startup(function(use)
end)
```


## Commands

These are the current available commands

```
```vim
- :GroqGenerate

- :GroqGenerateWithContext

- :GroqEdit
```

To use GroqGenerate, all you do is :GroqGenerate your prompt and the code will be generated at the place of the cursor
To use `GroqGenerate`, all you do is `:GroqGenerate` your prompt and the code will be generated at the place of the cursor

To use GroqGenerateWithContext, you start with :GroqGenerateWithContext your prompt /path/to/context/file.py
To use `GroqGenerateWithContext`, you start with `:GroqGenerateWithContext` your prompt `/path/to/context/file.py`

To use GroqEdit, you begin by selecting some text, typically in visual mode, and then using :GroqEdit your prompt the selected code will be rewritten based on your prompt
To use `GroqEdit`, you begin by selecting some text, typically in visual mode, and then using `:GroqEdit` your prompt the selected code will be rewritten based on your prompt

## Examples

### Groq Generate
```

```vim
:GroqGenerate write a python function that prints hello world
```

![](https://github.com/cdreetz/groq-nvim/blob/master/public/GroqGenerateGif.gif)

![Groq Generate Demo](https://github.com/cdreetz/groq-nvim/blob/master/public/GroqGenerateGif.gif)

### Groq Edit

```
```vim
:GroqEdit rewrite this method while adding debug lines to it
```
![](https://github.com/cdreetz/groq-nvim/blob/master/public/GroqEditGif.gif)

![Groq Edit Demo](https://github.com/cdreetz/groq-nvim/blob/master/public/GroqEditGif.gif)

### Groq Generate With Context
```

```vim
:GroqGenerateWithContext write a new version of the method found in this file ./file.py
```