A dead-simple LLM interface for Neovim.
Palimpsest is an alternative way to interact with LLMs, dissolving the distinction between user and clanker that is presumed in the chat paradigm. Instead, it focuses on a shared material substrate, the text buffer. If not immediately apparent, this is influenced by the Plan9 Acme text editor.
- Built atop of
simonw/llm, allowing user to configure their own API keys or local models independently. - Replaces "chat" metaphor with a palimpsest—layers of writing on top of each other. No distinction between user input and machine output by sharing the same editable text buffer.
- Complete control over context. I'm often frustrated by a chat where editing
a query is harder than just appending a new one, leading to previous wrong
replies polluting the context, wasting tokens, and slowing down responses.
Optionally mark lines as relevant context with
<leader>cm. Then, select the query and send with<leader>cc. - Does a lot less than other tools (e.g. Cursor), but more than you'd expect with just ~150 loc. There's tons of functionality "for free" by being embedded in a powerful text editor.
- Allows for easy "folk tools" along the lines of the Acme text editor by toggling lines in and out of context with ease, akin to incantations.
- Simple patch review mode with inline diffs.
require('palimpsest').setup({
-- simonw/llm setup
model = "anthropic/claude-3-5-sonnet-latest",
system = "Be concise and direct in your responses. Respond without unnecessary explanation.",
-- Display of context and line-by-line diff markers
signs = {
context = "∙",
add = "+",
delete = "-",
accepted = "✓",
},
keymaps = {
-- Keymaps for core functionality
ask = "<leader>cc", -- ask selected question, append response
mark = "<leader>cm", -- add line to context
-- Keymaps for patch review using diffs
review = "<leader>cr", -- ask selected question, review response diff
accept = "<leader>ca", -- accept diff proposal
decline = "<leader>cd", -- decline diff proposal
finalize = "<leader>cf" -- finalize review
}
})highlight DiagnosticInfo cterm=none ctermfg=4 ctermbg=none
highlight DiffAdd cterm=none ctermfg=DarkGreen ctermbg=none
highlight DiffAddLine cterm=none ctermfg=none ctermbg=LightGreen
highlight DiffDelete cterm=none ctermfg=DarkRed ctermbg=none
highlight DiffDeleteLine cterm=none ctermfg=none ctermbg=LightRed- [bug] check for bug in indexing between patch.accepted and patch.lines
- [feature] make loading state more apparent, perhaps with sign
- [feature] support two models (fast vs quality) and figure out good key bindings for this
- [feature] add numbered macros/markers to support concurrent "tools" throughout the file
- [feature] stream in output for more immediate feedback
