Skip to content

⚡ Turn your codebase into AI-ready context in seconds – the Neovim plugin that bridges the gap between your code and AI assistants. Select files, generate structured prompts, and feed your entire project to Claude/ChatGPT/Cursor with zero friction.

License

Notifications You must be signed in to change notification settings

kylesnowschwartz/prompt-tower.nvim

Repository files navigation

prompt-tower.nvim

A Neovim plugin for creating AI-ready context from your codebase.

Features

  • 📁 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

UI Interface

Prompt Tower UI

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

Installation

Using lazy.nvim

{
  'kylesnowschwartz/prompt-tower.nvim',
  config = function()
    require('prompt-tower').setup({
      -- Configuration options (see below)
    })
  end,
}
use {
  'kylesnowschwartz/prompt-tower.nvim',
  config = function()
    require('prompt-tower').setup()
  end
}

Quick Start

  1. Select files for context:

    :PromptTowerSelect  " Add current file to selection
  2. Generate and copy context:

    :PromptTowerGenerate  " Generate context and copy to clipboard
  3. Clear selection:

    :PromptTowerClear  " Remove all files from selection

Commands

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

Additional Commands

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 format

Configuration

Default 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,
  },
})

Template Formats

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.

UI Interface

The plugin provides a floating window interface for interactive file selection:

:PromptTower  \" Opens the UI interface

Default Keymaps

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.

File Ignore Patterns

prompt-tower.nvim supports multiple ways to exclude files from selection:

  1. Built-in ignore patterns: Common patterns like node_modules, .git, etc.
  2. .gitignore files: Respects project .gitignore files (when use_gitignore = true)
  3. .towerignore files: Custom ignore patterns specific to Prompt Tower (when use_towerignore = true)

Using .towerignore

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)

Development

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.

Roadmap

See ROADMAP.md for detailed development plans and feature parity tracking.

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Run tests (make test)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

MIT License - see LICENSE file for details.

Acknowledgments

About

⚡ Turn your codebase into AI-ready context in seconds – the Neovim plugin that bridges the gap between your code and AI assistants. Select files, generate structured prompts, and feed your entire project to Claude/ChatGPT/Cursor with zero friction.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published