llvim

This repository can be cloned via wget:

wget -rnp -nd -Ratom.xml -erobots=off 404.hjk.pw/s/llvim/

llvim is a neovim plugin for LLM integration with LSP support. It provides a chat window, visual mode pasting towards the LLM, and infill for insert mode.

Setup

You’ll need curl to talk to the following (llama-server) endpoints:

Include the plugin in your init.vim:

lua llm = require('user.llm')

Call the setup to configure your server and auth token:

setup("http://localhost:8080", "my_secret_token")

Binding keys

You’ll have to set up a few key binds to make use of the plugin.

abort or input will prompt you for a query at the bottom. After hitting enter, a new buffer will open above into which the LLM will stream its markdown answer.

This plugin doesn’t try to be too smart about context. I find that less context generally leads to more focused results. The different functions provide different context to the LLM:

Function LSP Findings Visual Selection Entire file
infill no no yes
visual yes yes no
input yes no no

Your key binds may look like this:

inoremap <C-o> <cmd>lua llm.infill()<cr>
vnoremap <Leader>h :<C-u>lua llm.visual()<cr>
nnoremap <Leader>h :lua llm.input()<cr>

Files