Most simplistic way of interacting with LLM in neovim.
This plugin is a simple wrapper around tgpt CLI utility. In the most basic sense we achieve interaction with CLI application by using neovim's buffers, this gives us full power of neovim motions alongside full functionality of CLI application.
return {
'DavidTelenko/texel.nvim',
keys = {
{ '<leader>ab', desc = 'Ask with buffer', mode = { 'n' } },
{ '<leader>as', desc = 'Open scratch markdown tab', mode = { 'n' } },
{ '<leader>a', desc = 'Ask with selection', mode = { 'v' } },
},
--- @module "texel"
--- @type texel.Config
opts = {},
config = function(_, opts)
local texel = require 'texel'
texel.setup(opts)
vim.keymap.set('v', '<leader>a', function()
texel.chat.ask.selection()
end, { desc = 'Ask with selection' })
vim.keymap.set('n', '<leader>ab', function()
texel.chat.ask.buffer()
end, { desc = 'Ask with buffer' })
vim.keymap.set('n', '<leader>as', function()
vim.cmd 'tabnew'
vim.cmd 'set filetype=markdown'
end, { desc = 'Open scratch markdown tab buffer' })
end,
}require('texel').setup {
chat = {
-- Spacers between the "question" and "answer"
separators = {
first = { '', '---', '' },
last = { '---', '' },
},
notify = true,
-- Sign to display in sign column near the line where output will be
-- inserted. One character - static sign, multiple characters - animation,
-- `nil` - disable the feature.
signs = {
thinking = { '|', '/', '-', '\\' },
},
},
tgpt = {
code = nil,
key = nil,
max_length = nil,
model = nil,
preprompt = nil,
provider = nil,
quiet = true,
shell = nil,
url = nil,
whole = nil,
},
}Note
Please see tgpt help to understand what tgpt related options do
Note
If you're confused which type of a flag we're using check your lsp completion, or see here
- Implement functionality of the tgpt in lua natively.
- Stream results line-wise or word-wise instead of the whole response.
- Use Treesitter to stream text to particular node in AST.