A Neovim plugin for efficiently sharing your project's most relevant context with LLMs.
nvim-ctx-ingest
helps easily provide the relevant context to LLMs like Claude or ChatGPT without breaking your development workflow. It addresses the common burden of sharing relevant parts of your codebase with LLMs in a structured, efficient format.
The plugin allows you to:
- Select specific files and directories that are relevant to your current task
- Generate a well-formatted digest that includes your project tree
- Quickly share this context with your LLM or code assistant without breaking your workflow
By providing better context, you get more accurate and helpful responses while maintaining control over exactly what code you share. By not breaking you workflow, it allows you to be more productive.
Inspired by gitingest, but customizable and local.
- 🧠 Optimized output for LLMs
- 📁 Interactive file browser with directory tree visualization
- ✅ Select individual files or entire directories for inclusion
- 🔍 Pattern-based file filtering (include/exclude)
- 🚫 Respects
.gitignore
patterns - 📊 Generates formatted digest with directory structure and file contents
- 📋 Auto-copy results to clipboard for pasting into LLM interfaces
- 🔄 Auto-add output files to
.gitignore
(if enabled)
The generated digest includes:
- Summary information (directory, file count, total size)
- Directory tree
- List of selected files
- Full content of each selected file with clear separation
Example:
Directory: /path/to/your/project
Files analyzed: 2
Total size: 0.04 MB
Directory structure:
project
├── src
│ ├── main.lua
│ └── utils.lua
├── tests
│ └── test_main.lua
└── README.md
Selected files for content inclusion:
- src/main.lua
- README.md
================================================
File: src/main.lua
================================================
local function hello()
print("Hello, world!")
end
return {
hello = hello
}
================================================
File: README.md
================================================
# My Project
A simple demo project.
Using lazy.nvim
{
"0xrusowsky/nvim-ctx-ingest",
dependencies = {
"nvim-web-devicons", -- required for file icons
},
config = function()
require("nvim-ctx-ingest").setup({
-- your config options here
})
end,
}
Using packer.nvim
use {
"0xrusowsky/nvim-ctx-ingest",
requires = { "nvim-web-devicons" },
config = function()
require("nvim-ctx-ingest").setup({
-- your config options here
})
end
}
- Run
:CtxIngest
to open the file browser - Navigate the tree with
j
andk
- Expand/collapse directories with
l
andh
- Select files or directories with
Space
- Press
Enter
to generate the digest - Paste the generated context into your LLM chat
Key | Action |
---|---|
j /k |
Navigate up/down |
h /l |
Collapse/expand directories |
Space |
Toggle selection |
i |
Add include pattern |
e |
Add exclude pattern |
Enter |
Generate digest |
q /Esc |
Close window |
- Press
i
to add an include pattern (e.g.,%.md
to include only markdown files) - Press
e
to add an exclude pattern (e.g.,test/
to exclude test directories)
Based on lua patterns
You can configure nvim-ctx-ingest
by passing options to the setup function:
require("nvim-ctx-ingest").setup({
window = {
position = "float",
width = 100,
height = 40,
},
columns = {
size = true,
last_modified = true,
},
icons = {
folder = {
closed = "",
open = "",
empty = "",
empty_open = "",
},
default = "",
selected = "✓",
unselected = " ",
},
max_file_size = 10 * 1024 * 1024, -- 10MB max file size
ignore_patterns = {
"%.env",
"^%.git/",
"%.svn/",
"%.hg/",
"node_modules/",
"target/",
"dist/",
"build/",
"%.pyc$",
"__pycache__/",
"%.egg%-info/",
"%.vscode/",
"%.idea/",
"%.DS_Store$",
"%.gitignore",
"%.lock",
-- Add your own patterns here
},
gitignore = {
respect = true, -- Whether to respect .gitignore patterns
auto_add = true, -- Whether to add output file to .gitignore
},
patterns = {
include = {}, -- Default include patterns
exclude = {}, -- Default exclude patterns
},
output = {
save_file = false, -- Whether to save digest to file
copy_clipboard = true, -- Whether to copy to clipboard
}
})
Contributions are welcome! Please feel free to submit a PR
MIT