๐ code-companion-picker.nvim
March 24, 2026 ยท View on GitHub
Finally, a way to actually browse your CodeCompanion prompts!
Stop memorizing prompt names or hunting through files. This plugin gives you a beautiful, fast picker with rich markdown previews that shows you exactly what each prompt does before you use it. Think Telescope for files, but for your AI prompts.
Perfect for:
- ๐ค AI power users with large prompt libraries
- ๐ Prompt collectors who want to actually use what they save
- โก Efficiency lovers who prefer visual browsing over memorization
- ๐ฏ Context switchers who need different prompts for different tasks
โจ What You Get
- ๐ Lightning-fast fuzzy search through your entire prompt library
- ๐ Rich markdown previews with syntax highlighting
- ๐จ Fully customizable preview rendering - show exactly what you want to see
- โก Modern picker backends - Snacks (recommended) or Telescope
- ๐ง Smart prompt handling - system prompts update context, user prompts add to chat
- ๐ง Dynamic content support - prompts that use your current selection and context
- ๐ Multiple access methods - commands, slash commands, or direct API calls
Screenshots
Coming soon - screenshots of the beautiful prompt previews and selection UI
Installation
Requirements
- codecompanion.nvim - Required
- One picker backend:
- snacks.nvim - Modern, fast โญ Recommended
- telescope.nvim - โ ๏ธ Deprecated, will be removed in a future release
With Snacks (Recommended)
{
'3ZsForInsomnia/code-companion-picker.nvim',
dependencies = { 'folke/snacks.nvim' },
opts = {
picker = "snacks",
},
keys = {
{ "<leader>cp", "<cmd>CodeCompanionPrompts<cr>", desc = "Browse CodeCompanion Prompts" },
},
}
With Telescope (โ ๏ธ Deprecated)
Note: Telescope support is deprecated and will be removed in a future release. Please use Snacks instead.
{
'3ZsForInsomnia/code-companion-picker.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' },
opts = {
picker = "telescope",
},
keys = {
{ "<leader>cp", "<cmd>CodeCompanionPrompts<cr>", desc = "Browse CodeCompanion Prompts" },
},
}
In-Chat Access
Add this to your CodeCompanion config for in-chat slash command access:
{
strategies = {
chat = {
slash_commands = {
prompts = require("code-companion-picker").select_slash_command,
},
},
},
}
Then use /prompts in any CodeCompanion chat buffer to browse and insert prompts on the fly!
How Prompts Work
When you select a prompt:
- System prompts โ Updates your chat's system context
- User prompts โ Adds content to chat as your message without submitting, so you can edit before sending
- Mixed prompts โ Applies system context first, then adds user content
- Model specified โ Automatically switches to the prompt's preferred model
๐จ Customizing Previews
Want to customize how prompt previews look? The plugin uses a composable rendering system where you can override individual sections or disable them entirely.
Quick example:
{
renderers = {
description = function(text, _)
return text and ("๐ " .. text) or nil
end,
current_system = false, -- disable showing current system prompt
model = function(model, _)
return model and ("๐ค " .. model) or nil
end,
}
}
๐ See the full customization guide โ
The guide covers all 9 sections, advanced examples, and real-world configurations.
โ๏ธ Configuration
{
'3ZsForInsomnia/code-companion-picker.nvim',
opts = {
picker = "snacks", -- "snacks" or "telescope"
highlights = {
-- Customize syntax highlighting colors
yaml_key = { fg = "#79dac8", bold = true },
yaml_description = { fg = "#ff9e64" },
yaml_model = { fg = "#9d7cd8" },
system_header = { fg = "#f7768e", bold = true },
user_header = { fg = "#9ece6a", bold = true },
-- ... see source for all options
},
renderers = {
-- Customize how each section is rendered in the preview
description = function(text, _)
return text and ("๐ **Description:** " .. text) or nil
end,
model = function(model, _)
return model and ("๐ค **Model:** " .. model) or nil
end,
tools = function(tools_array, _)
return (#tools_array > 0) and ("๐ง **Tools:** " .. table.concat(tools_array, ", ")) or nil
end,
current_system = false, -- Disable showing current system prompt
-- Override other sections: opts, mode, context, system_prompt, user_prompt
},
}
}
๐ Related Plugin
Got VS Code prompts? Check out vs-code-companion - easily import your VS Code style prompts into CodeCompanion format. Perfect for migrating existing prompt libraries or sharing prompts between VS Code and Neovim!
๐ ๏ธ Extending the Plugin
Public API
The plugin exposes several functions for custom integrations:
local picker = require("code-companion-picker")
-- Get all prompts from CodeCompanion's prompt library
local prompts = picker.get_codecompanion_prompts()
-- Create display text for a prompt
local display = picker.create_prompt_display_text(prompt_info)
-- Convert prompt to markdown with custom renderers
local markdown = picker.codecompanion_to_markdown(prompt_data, prompt_name, custom_renderers)
-- Apply syntax highlighting to buffer
picker.apply_markdown_highlighting(bufnr, lines, highlights)
Custom Picker Integration
To add support for a new picker backend:
local picker = require("code-companion-picker")
local handlers = require("code-companion-picker.ui.handlers")
-- Get prompts
local prompts = picker.get_codecompanion_prompts()
-- Create your picker UI with the prompts
-- When user selects a prompt, call:
handlers.handle_prompt_selection(selected_prompt_info)
The handle_prompt_selection function handles all the complexity of applying prompts correctly based on their type and content.
Happy prompting! ๐
TODO
- Extract
get_or_open_chatpattern fromskill_handlers.luaintochat_utilsand reuse inhandlers.luaandtool_handlers.lua - Remove redundant snacks availability checks โ
ui/pickers.luaguards duplicate whatsnacks_utils.luaalready checks - Remove telescope support entirely