chatter.nvim is a Neovim plugin that provides a chat interface powered by AI models. It allows users to interact with AI models seamlessly within Neovim, featuring a sidebar for chat history, code block highlighting, and more.
- AI Chat Interface: Start a chat with AI models directly in Neovim.
- Sidebar Display: View chat history in a dedicated sidebar.
- Code Block Highlighting: Automatically highlights code blocks using Treesitter.
- [WIP] Clipboard Support: Easily copy code blocks to the clipboard.
- Customizable Keymaps: Configure key mappings to suit your workflow.
- Lazy Loading Support: Integrates with
lazy.nvim
for efficient loading.
ollama
installed on your os.fzf-lua
for selection of local LLMs.
To install chatter.nvim with lazy.nvim
, add the following to your Neovim configuration:
{
"Dan7h3x/chatter.nvim",
event = "VeryLazy",
dependencies = {
'nvim-lua/plenary.nvim',
"ibhagwan/fzf-lua",
},
keys = { {
"<leader>cc", "<Cmd>ChatterStart<CR>", desc = "Chatter Start"
}, },
config = function()
require('chatter').setup({
offline_api_url = os.getenv("OLLAMA_HOST") or "http://localhost:8888",
sidebar_width = 60,
sidebar_height = vim.o.lines - 12,
models = {},
highlight = {
title = "Title",
user = "Comment",
assistant = "String",
system = "Type",
error = "ErrorMsg",
loading = "WarningMsg",
}
})
end,
}
If you prefer to install manually, clone the repository into your Neovim plugins directory:
git clone https://github.com/Dan7h3x/chatter.nvim.git ~/.config/nvim/lua/chatter
Then, add the following to your init.lua
or init.vim
:
require("chatter").setup()
- Open the Chat Interface: Use the command
:ChatterToggle
to open or close the chat sidebar. - Start a Chat: Use the command
:ChatterStart
to initiate a chat session. - Send Messages: Press
i
to enter your message and hit Enter to send. - [WIP] Copy Code Blocks: Navigate to a code block and press
yc
to copy it to the clipboard. - Clear Chat: Use the command
:ChatterClear
to clear the chat history.
The following key mappings are available by default:
i
: Enter message input- [WIP]
yc
: Copy the current code block to clipboard q
: Close the chat sidebar automatically<C-c>
: Clear the chat.<C-r>
: Reload thechatter.nvim
for selecting another model.
Available commands are ChatterStart
,ChatterToggle
,ChatterClear
,ChatterRestart
,ChatterSend
.
Contributions are welcome! Please feel free to submit issues or pull requests. Make sure to follow the contribution guidelines.
This project is licensed under the MIT License. See the LICENSE file for details.
- Neovim - The extensible Vim-based text editor.
- Treesitter - For syntax highlighting.
- Lazy.nvim - For efficient plugin loading.