Skip to content

Megatherium/continue.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Continue.nvim

Status: 🚧 Phase 1 Complete - HTTP Client & Core UI Implemented

AI code assistant for Neovim - a lightweight HTTP client for Continue CLI.

Architecture: HTTP Client Approach

Instead of porting the entire Continue codebase (40-70K tokens of TypeScript), continue.nvim is a thin HTTP client that connects to cn serve (the Continue CLI backend).

Benefits:

  • πŸš€ 90% less code - Only ~5K tokens of Lua
  • πŸ”„ Always up-to-date - npm update @continuedev/cli gets latest features
  • 🎯 Same behavior - Identical to Continue CLI (no divergence)
  • πŸ› οΈ All features - Agent, Chat, Tools, MCP - everything Continue offers

Features

Core Features βœ…

HTTP Client & Infrastructure:

  • HTTP Client - curl-based async requests with timeout handling
  • Process Manager - Auto-start/stop cn serve with port scanning
  • State Polling - Dynamic intervals (100ms active, 1s idle)
  • Chat UI - Split window with input area (80% chat, 20% input)
  • Message Formatting - User/Assistant/System/Tool messages
  • Streaming Support - Character-by-character real-time updates
  • Permission System - Interactive tool approval prompts
  • State Diffing - Efficient UI updates (only render changes)

Polish & UX:

  • Syntax Highlighting - Code blocks with language-aware highlighting
  • Message Copying - yy (current), yA (all) to clipboard
  • Keyboard Help - Press ? for interactive help
  • Processing Indicator - Real-time status (⏳/πŸ“₯/βœ…) in header
  • Request Retry - Auto-retry transient failures (2x max)
  • Welcome Screen - Beautiful ASCII art and quick start
  • Export to Markdown - :ContinueExport command

Advanced Features ✨ (New!)

Autocomplete Systems:

  • Slash Command Autocomplete - Fuzzy-finding preview for /commands

    • Real-time filtering as you type
    • Keyboard navigation (↑/↓, Tab)
    • 16 system commands + custom commands support
    • Visual indicators (βš™ system, πŸ€– custom)
  • File Attachment Picker - Git-aware fuzzy finder for @mentions

    • Fuzzy matching on filenames and paths
    • Multi-select support (attach multiple files)
    • Keyboard navigation (↑/↓, Tab)
    • Visual indicators for attached files

Search & Navigation:

  • Vim-Style Search - Search chat history with /, n, N

    • Real-time search with match highlighting
    • Jump between matches (n/N)
    • Match counter (e.g., "Match 3 of 12")
    • Clear highlights with
  • Code Block Navigation - Jump between code blocks

    • ]c / [c to navigate blocks
    • Language detection from fences

Code Operations:

  • Code Block Extraction - One-key operations on code blocks
    • yc to yank (copy) code block at cursor
    • ]c / [c to jump between blocks
    • ce to execute (Lua, Vim, Bash, Python)
    • cw to write block to file

Enhanced UI:

  • Help Overlay - Comprehensive keyboard reference (g?)

    • Full-screen help with all keybindings
    • Syntax-highlighted sections
    • Tips & tricks
    • Architecture overview
  • Local Command Handlers - Instant execution of common commands

    • /clear - Clear history (with confirmation)
    • /help - Show help overlay
    • /exit - Close chat window

Commands:

  • :Continue [msg] - Open chat or send message
  • :ContinueStart/Stop - Server management
  • :ContinuePause - Interrupt agent
  • :ContinueStatus - Show status
  • :ContinueDiff - Show git diff
  • :ContinueHealth - Dependency check
  • :ContinueExport [file] - Export to markdown

Future Enhancements πŸ“‹

  • Treesitter integration (enhanced syntax highlighting)
  • Session persistence (save/restore across restarts)
  • Visual mode operations (send selection)
  • Mode indicators (normal/plan/auto from CLI)
  • Custom command loading from server

Installation

Prerequisites

  • Neovim 0.10+ (for vim.json built-in)
  • Node.js 18+ (for Continue CLI)
  • curl (for HTTP requests)

Step 1: Install Continue CLI

npm install -g @continuedev/cli

Step 1.5: First-time Setup

cn init

Step 2: Install Plugin

Using lazy.nvim:

{
  'continue.nvim',
  dev = true,  -- For local development
  config = function()
    require('continue').setup({
      port = 8000,              -- Default port for cn serve
      port_range = { 8000, 8010 }, -- Auto-find available port
      timeout = 300,            -- Server timeout (seconds)
      auto_start = false,       -- DEPRECATED: server starts lazily on first command
      auto_find_port = true,    -- Find available port automatically
      cn_bin = 'cn',            -- Path to cn binary
      continue_config = nil,    -- Path to Continue config (optional)
    })
  end,
}

Using packer.nvim:

use {
  'continue.nvim',
  config = function()
    require('continue').setup()
  end
}

Configuration

All configuration options with defaults:

require('continue').setup({
  port = 8000,              -- Default port for cn serve
  port_range = { 8000, 8010 }, -- Range for auto port finding
  timeout = 300,            -- Server auto-shutdown timeout (seconds)
  auto_start = false,       -- DEPRECATED: server now starts lazily on first command
  auto_find_port = true,    -- Automatically find available port
  cn_bin = 'cn',            -- Path to cn CLI binary
  continue_config = nil,    -- Custom Continue config path (optional)
  
  -- Terminal window configuration
  terminal = {
    position = 'float',    -- 'float', 'left', 'right', 'top', 'bottom'
    hsize = 80,            -- Horizontal size in % (for float/left/right)
    vsize = 80,            -- Vertical size in % (for float/top/bottom)
    transparency = 0,      -- Transparency 0-100 (only for float, requires nvim 0.9+)
  },
})

Terminal Window Positions

  • float (default): Centered floating window with configurable transparency
  • left: Vertical split on the left side
  • right: Vertical split on the right side
  • top: Horizontal split at the top
  • bottom: Horizontal split at the bottom

Note: AI provider configuration (API keys, models) is handled by Continue CLI, not this plugin. Configure via ~/.continue/config.json or environment variables. See Continue docs.

Usage

Quick Start

" Open chat window
:Continue

" Send a message directly
:Continue How do I implement a binary search in Rust?

" Check health status
:ContinueHealth

Commands

Command Description
:Continue [message] Open chat or send message directly (auto-starts server)
:ContinueStart Manually start cn serve if needed
:ContinueStop Stop server and polling
:ContinuePause Interrupt current agent execution (like Ctrl+C)
:ContinueStatus Show server and client status
:ContinueDiff Show git diff in split window
:ContinueHealth Run health check (dependencies + server)

Keymaps (in Chat Window)

Key Action
q or <Esc> Close chat window
g? Show comprehensive help overlay
yy Copy current message to clipboard
yA Copy all messages to clipboard
/ Search in chat history (vim-style)
n Jump to next search match
N Jump to previous search match
<C-l> Clear search highlights

Code Block Operations:

Key Action
yc Yank (copy) code block at cursor
]c Jump to next code block
[c Jump to previous code block
<leader>ce Execute code block (Lua/Vim/Bash/Python)
<leader>cw Write code block to file

Input Area:

Key Action
i or a Start typing (insert mode)
<CR> Send message
/command Trigger slash command autocomplete
@filename Trigger file picker autocomplete
↑ / ↓ Navigate autocomplete suggestions
Tab Complete/select suggestion
<Esc> Cancel/hide suggestions

Window Resizing:

Key Action
<C-w>+ Increase window height
<C-w>- Decrease window height
<C-w>> Increase window width
<C-w>< Decrease window width
<C-w>= Reset window to default size

Note: Resize keybindings work in both floating and split window modes.

Testing

Manual Testing

Start Continue server:

cn serve --port 8000

Run integration tests in Neovim:

:luafile tests/test_http_client.lua

Health Check

:ContinueHealth

Example output:

=== Continue.nvim Health Check ===

βœ“ Neovim version: 0.10 (OK)
βœ“ Node.js: v20.11.0
βœ“ Continue CLI: 0.1.0 (/usr/local/bin/cn)
βœ“ curl: available

βœ“ Server: running on port 8000
βœ“ Server health: OK

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Neovim                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  continue.nvim           β”‚   β”‚
β”‚  β”‚  (Lua - ~8K tokens)      β”‚   β”‚
β”‚  β”‚                          β”‚   β”‚  HTTP/JSON
β”‚  β”‚  β€’ HTTP client           │───┼────────┐
β”‚  β”‚  β€’ State polling         β”‚   β”‚        β”‚
β”‚  β”‚  β€’ UI rendering          β”‚   β”‚        β”‚
β”‚  β”‚  β€’ Commands              β”‚   β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚
                                           β–Ό
                                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                     β”‚   cn serve      β”‚
                                     β”‚  (Node.js/TS)   β”‚
                                     β”‚                 β”‚
                                     β”‚  β€’ Agent logic  β”‚
                                     β”‚  β€’ LLM APIs     β”‚
                                     β”‚  β€’ Tools/MCP    β”‚
                                     β”‚  β€’ All Continue β”‚
                                     β”‚    features     β”‚
                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

lua/continue/
β”œβ”€β”€ init.lua          # Entry point & setup()
β”œβ”€β”€ client.lua        # HTTP client (endpoints, polling)
β”œβ”€β”€ process.lua       # cn serve lifecycle management
β”œβ”€β”€ commands.lua      # User commands (:Continue, etc.)
β”œβ”€β”€ ui/
β”‚   └── chat.lua      # Chat window & message rendering
└── utils/
    β”œβ”€β”€ http.lua      # curl wrapper (async HTTP)
    └── json.lua      # vim.json wrapper

tests/
└── test_http_client.lua  # Integration tests

HTTP Protocol

The plugin communicates with cn serve via REST API:

  • GET /state - Poll for chat state (every 500ms)
  • POST /message - Send user message
  • POST /permission - Approve/reject tool execution
  • POST /pause - Interrupt agent
  • GET /diff - Get git diff
  • POST /exit - Graceful shutdown

See source/extensions/cli/spec/wire-format.md for full protocol spec.

Contributing

This project is in early development. Contributions are welcome once the core architecture is stable.

License

Apache 2.0 Β© 2023-2025 Continue Dev, Inc.

Original Continue extension: https://github.com/continuedev/continue

Related Projects

Support

  • πŸ“– Documentation: docs/
  • πŸ› Issues: GitHub Issues (when ready)
  • πŸ’¬ Discussions: GitHub Discussions (when ready)

About

A Lua wrapper for continuedev/continue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •