Files
codetyper.nvim/doc/codetyper.txt

317 lines
10 KiB
Plaintext

*codetyper.txt* AI-powered coding partner for Neovim
Author: cargdev <carlos.gutierrez@carg.dev>
Homepage: https://github.com/cargdev/codetyper.nvim
License: MIT
==============================================================================
CONTENTS *codetyper-contents*
1. Introduction ............................ |codetyper-introduction|
2. Requirements ............................ |codetyper-requirements|
3. Installation ............................ |codetyper-installation|
4. Configuration ........................... |codetyper-configuration|
5. LLM Providers ........................... |codetyper-providers|
6. Usage ................................... |codetyper-usage|
7. Commands ................................ |codetyper-commands|
8. Agent Mode .............................. |codetyper-agent|
9. Transform Commands ...................... |codetyper-transform|
10. Keymaps ................................ |codetyper-keymaps|
11. API .................................... |codetyper-api|
==============================================================================
1. INTRODUCTION *codetyper-introduction*
Codetyper.nvim is an AI-powered coding partner that helps you write code
faster using LLM APIs with a unique workflow.
Key features:
- Split view with coder file and target file side by side
- Support for Claude, OpenAI, Gemini, Copilot, and Ollama providers
- Agent mode with autonomous tool use (read, edit, write, bash)
- Transform commands for inline prompt processing
- Auto-index feature for automatic companion file creation
- Automatic .gitignore management
- Real-time logs panel with token usage tracking
==============================================================================
2. REQUIREMENTS *codetyper-requirements*
- Neovim >= 0.8.0
- curl (for API calls)
- One of:
- GitHub Copilot (via copilot.lua or copilot.vim)
- Ollama running locally
==============================================================================
3. INSTALLATION *codetyper-installation*
Using lazy.nvim: >lua
{
"cargdev/codetyper.nvim",
config = function()
require("codetyper").setup({
llm = {
provider = "copilot", -- or "ollama"
},
})
end,
}
<
Using packer.nvim: >lua
use {
"cargdev/codetyper.nvim",
config = function()
require("codetyper").setup()
end,
}
<
==============================================================================
4. CONFIGURATION *codetyper-configuration*
Default configuration: >lua
require("codetyper").setup({
llm = {
provider = "claude", -- "claude", "openai", "gemini", "copilot", "ollama"
claude = {
api_key = nil, -- Uses ANTHROPIC_API_KEY env var if nil
model = "claude-sonnet-4-20250514",
},
copilot = {
model = "gpt-4o", -- Uses OAuth from copilot.lua/copilot.vim
},
ollama = {
host = "http://localhost:11434",
model = "deepseek-coder:6.7b",
},
},
window = {
width = 25, -- Percentage of screen width (25 = 25%)
position = "left",
border = "rounded",
},
auto_gitignore = true,
auto_open_ask = true,
auto_index = false, -- Auto-create coder companion files
})
<
==============================================================================
5. LLM PROVIDERS *codetyper-providers*
*codetyper-copilot*
GitHub Copilot~
Uses your existing Copilot subscription.
Requires copilot.lua or copilot.vim to be configured.
>lua
llm = {
provider = "copilot",
copilot = { model = "gpt-4o" },
}
<
*codetyper-ollama*
Ollama (Local)~
Run models locally with no API costs.
>lua
llm = {
provider = "ollama",
ollama = {
host = "http://localhost:11434",
model = "deepseek-coder:6.7b",
},
}
<
==============================================================================
6. USAGE *codetyper-usage*
1. Open any file (e.g., `index.ts`)
2. Run `:Coder open` to create/open the corresponding coder file
3. In the coder file, write prompts using the tag syntax:
>
Create a function that fetches user data from an API
with error handling and returns a User object
<
4. When you close the tag with `@/`, the plugin will:
- Send the prompt to the configured LLM
- Generate the code
- Inject it into the target file
Prompt Types~
The plugin detects the type of request from your prompt:
- "refactor" / "rewrite" - Modifies existing code
- "add" / "create" / "implement" - Adds new code
- "document" / "comment" - Adds documentation
- "explain" - Provides explanations (no code injection)
==============================================================================
7. COMMANDS *codetyper-commands*
*:Coder*
:Coder [subcommand]
Main command with subcommands:
open Open coder view for current file
close Close coder view
toggle Toggle coder view
process Process the last prompt and generate code
status Show plugin status and project statistics
focus Switch focus between coder and target windows
tree Manually refresh the tree.log file
tree-view Open tree.log in a split view
*:CoderOpen*
:CoderOpen
Open the coder split view for the current file.
*:CoderClose*
:CoderClose
Close the coder split view.
*:CoderToggle*
:CoderToggle
Toggle the coder split view.
*:CoderProcess*
:CoderProcess
Process the last prompt in the current coder buffer.
*:CoderAsk*
:CoderAsk
Open the Ask panel for questions and explanations.
*:CoderAskToggle*
:CoderAskToggle
Toggle the Ask panel.
*:CoderAskClear*
:CoderAskClear
Clear Ask panel chat history.
*:CoderAgent*
:CoderAgent
Open the Agent panel for autonomous coding tasks.
*:CoderAgentToggle*
:CoderAgentToggle
Toggle the Agent panel.
*:CoderAgentStop*
:CoderAgentStop
Stop the currently running agent.
*:CoderTransform*
:CoderLogs
Toggle the logs panel showing LLM request details.
*:CoderType*
:CoderType
Show mode switcher UI (Ask/Agent).
*:CoderTree*
:CoderTree
Manually refresh the tree.log file in .codetyper/ folder.
*:CoderTreeView*
:CoderTreeView
Open the tree.log file in a vertical split for viewing.
==============================================================================
8. AGENT MODE *codetyper-agent*
Agent mode provides an autonomous coding assistant with tool access.
Available Tools~
- read_file Read file contents at a path
- edit_file Edit files with find/replace
- write_file Create or overwrite files
- bash Execute shell commands
Using Agent Mode~
1. Open the agent panel: `:CoderAgent` or `<leader>ca`
2. Describe what you want to accomplish
3. The agent will use tools to complete the task
4. Review changes before they're applied
Agent Keymaps~
<CR> Submit message
Ctrl+c Stop agent execution
q Close agent panel
==============================================================================
9. TRANSFORM COMMANDS *codetyper-transform*
Transform commands allow you to process tags inline without
opening the split view.
*:CoderTransform*
:CoderTransform
Find and transform all tags in the current buffer.
Each tag is replaced with generated code.
*:CoderTransformCursor*
:CoderTransformCursor
Transform the tag at the current cursor position.
Useful for processing a single prompt.
*:CoderTransformVisual*
:'<,'>CoderTransformVisual
Transform tags within the visual selection.
Select lines containing tags and run this command.
Example~
>
// In your source file:
Add input validation for email
// After running :CoderTransformCursor:
function validateEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
<
==============================================================================
10. KEYMAPS *codetyper-keymaps*
Default keymaps (auto-configured):
<leader>ctt (Normal) Transform tag at cursor
<leader>ctt (Visual) Transform selected tags
<leader>ctT (Normal) Transform all tags in file
<leader>ca (Normal) Toggle Agent panel
<leader>ci (Normal) Open coder companion (index)
Ask Panel keymaps:
@ Attach/reference a file
Ctrl+Enter Submit question
Ctrl+n Start new chat
Ctrl+f Add current file as context
q Close panel
Y Copy last response
==============================================================================
11. API *codetyper-api*
*codetyper.setup()*
codetyper.setup({opts})
Initialize the plugin with configuration options.
*codetyper.get_config()*
codetyper.get_config()
Returns the current configuration table.
*codetyper.is_initialized()*
codetyper.is_initialized()
Returns true if the plugin has been initialized.
==============================================================================
vim:tw=78:ts=8:ft=help:norl: