A Neovim plugin for creating AI-ready context from your codebase.
- 📁 File Selection: Choose files for context generation with UI interface or commands
- 🎨 Multiple Template Formats: XML, Markdown, and Minimal output formats with hot-swapping
- 🌳 Project Tree Generation: Configurable project structure visualization
- 📋 Clipboard Integration: Automatically copy generated context to clipboard
- 🚫 Smart Ignore Patterns: Respects .gitignore and .towerignore files
- ⚙️ Highly Configurable: Extensive configuration options for all aspects
- 🎯 Workspace Detection: Automatic project root detection
- ⌨️ Keyboard-Driven UI: Intuitive keymaps for efficient file selection
- 🧪 Well Tested: Comprehensive test suite using plenary.nvim
The interactive UI provides a comprehensive file selection interface with:
- File Tree (left): Navigate and select files with visual indicators
- Selected Files (right): View and manage your current selection
- Context Areas (bottom): Add custom context before and after your files
- Keyboard Navigation: Full keyboard-driven workflow for efficiency
Using lazy.nvim
{
'kylesnowschwartz/prompt-tower.nvim',
config = function()
require('prompt-tower').setup({
-- Configuration options (see below)
})
end,
}Using packer.nvim
use {
'kylesnowschwartz/prompt-tower.nvim',
config = function()
require('prompt-tower').setup()
end
}-
Select files for context:
:PromptTowerSelect " Add current file to selection -
Generate and copy context:
:PromptTowerGenerate " Generate context and copy to clipboard -
Clear selection:
:PromptTowerClear " Remove all files from selection
| Command | Description |
|---|---|
:PromptTower |
Open file selection UI interface |
:PromptTowerSelect |
Add current file to selection |
:PromptTowerGenerate |
Generate context from selected files |
:PromptTowerClear |
Clear all selected files |
:PromptTowerToggle [file] |
Toggle file selection |
You can also use the main :PromptTower command with subcommands:
:PromptTower ui \" Open UI interface (default)
:PromptTower select \" Add current file to selection
:PromptTower generate \" Generate context
:PromptTower clear \" Clear selections
:PromptTower format xml \" Switch to XML template format
:PromptTower format markdown \" Switch to Markdown template format
:PromptTower format minimal \" Switch to minimal template formatDefault configuration:
require('prompt-tower').setup({
-- File discovery settings
ignore_patterns = {
'.git', 'node_modules', '.DS_Store', '*.pyc', '__pycache__',
'.pytest_cache', '.venv', 'venv', 'target', 'build', 'dist',
'.next', '.nuxt',
},
use_gitignore = true,
use_towerignore = true,
max_file_size_kb = 500, -- 500KB limit
-- Output format settings
output_format = {
-- Default template format
default_format = 'xml', -- Options: 'xml', 'markdown', 'minimal'
-- Template presets for different output formats
presets = {
xml = {
block_template = '<file name="{fileNameWithExtension}" path="{rawFilePath}">\n{fileContent}\n</file>',
separator = '\n\n',
wrapper_template = '<!-- Generated by prompt-tower.nvim -->\n<!-- {fileCount} files selected -->\n\n{treeBlock}<project_files>\n{fileBlocks}\n</project_files>',
},
markdown = {
block_template = '## {fileName}\n\n**Path:** `{rawFilePath}`\n\n```{fileExtension}\n{fileContent}\n```',
separator = '\n\n---\n\n',
wrapper_template = '# Project Context\n\n{treeBlock}## Selected Files\n\n{fileBlocks}',
},
minimal = {
block_template = '// File: {rawFilePath}\n{fileContent}',
separator = '\n\n',
wrapper_template = '{fileBlocks}',
},
},
},
-- Project tree generation
project_tree = {
enabled = true,
type = 'fullFilesAndDirectories', -- 'fullFilesAndDirectories', 'fullDirectoriesOnly', 'selectedFilesOnly', 'none'
show_file_size = false,
template = '<project_tree>\n{projectTree}\n</project_tree>\n\n',
},
-- Keymaps for UI interface
keymaps = {
toggle_selection = '<Space>',
select_all = 'A',
clear_all = 'C',
generate_context = '<CR>',
quit = 'q',
help = '?',
},
-- Clipboard settings
clipboard = {
register = '+', -- System clipboard
notify_on_copy = true,
},
})prompt-tower.nvim supports three built-in template formats (XML, Markdown, Minimal) that can be switched on-the-fly using :PromptTower format <name>.
See TEMPLATES.md for detailed examples and customization options.
The plugin provides a floating window interface for interactive file selection:
:PromptTower \" Opens the UI interface| Key | Action |
|---|---|
<Space> |
Toggle file selection |
A |
Select all files |
C |
Clear all selections |
<CR> |
Generate context and copy to clipboard |
q |
Quit interface |
? |
Show help |
These keymaps can be customized in the configuration under the keymaps section.
prompt-tower.nvim supports multiple ways to exclude files from selection:
- Built-in ignore patterns: Common patterns like
node_modules,.git, etc. .gitignorefiles: Respects project.gitignorefiles (whenuse_gitignore = true).towerignorefiles: Custom ignore patterns specific to Prompt Tower (whenuse_towerignore = true)
Create a .towerignore file in your project root with custom ignore patterns:
# Example .towerignore file
# Ignore test output files
test_output.log
*.log
# Ignore temporary editor files
*.swp
*.swo
*~
# Ignore large build artifacts
dist/
build/
target/
# Custom project-specific patterns
scratch/
temp/
docs/archive/The .towerignore file uses the same syntax as .gitignore files and supports:
- Glob patterns (
*.log,temp*) - Directory patterns (
node_modules/) - Negation patterns (
!important.log) - Comments (
# This is a comment)
Note: The plugin has no runtime dependencies and uses only standard Neovim APIs. plenary.nvim is only required for running tests during development.
See CONTRIBUTING.md for development setup, testing, architecture details, and contribution guidelines.
See ROADMAP.md for detailed development plans and feature parity tracking.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Run tests (
make test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Inspired by Prompt Tower Extension
- Follows Neovim plugin development best practices
- Built entirely AI-assisted with Claude Code from Anthropic
