Send to a live CLI conversation
This integration requires Copilot CLI 1.0.97 or newer with experimental extensions enabled. It joins an existing local foreground conversation; it does not create a new conversation or resume its history in another process. The CLI extension API is experimental and may change.
Setup
Keep the kvim-copilot-bridge companion executable beside kvim (use the .exe suffix on Windows). Release archives and RPMs include both. For a source build, use cargo build --workspace --release; building only package kvim does not produce the companion executable. Ordinary editing and the other AI integrations do not require it.
Run Copilot CLI once and authenticate normally, then in kvim run:
:copilot bridge install
This explicitly installs the bundled kvim user extension under COPILOT_HOME/extensions/kvim, or the CLI's default ~/.copilot/extensions/kvim. Both programs must use the same OS account and Kvim state directory. Set COPILOT_HOME consistently if you override it. Installation checks for a regular companion executable beside Kvim and records its absolute location in the extension. It does not search PATH for another copy or download a helper. Keep that executable installed there.
In the CLI terminal, enable experimental features with /experimental on (or start the CLI with copilot --experimental). Use /extensions manage to confirm the kvim extension is running. If extensions are disabled, change /extensions mode to Load Only or Load & Augment. Reload extensions after installation; Copilot's extension-management tools can reload them without replacing the conversation. Do not use /clear to reload an existing conversation, because it starts a fresh session.
The extension uses the CLI's bundled SDK; no npm installation or new authentication is required. Each joined session starts its own kvim-copilot-bridge process, not another editor process. The companion hosts protected local IPC: owner-only named pipes on Windows, and a Unix socket inside a private directory on Linux/macOS. There is no TCP listener or bearer token file. Helpers disappear when their extension stops. There is no persistent daemon. The editor client, native companion, and extension use an explicitly checked wire protocol (currently version 2). Compatibility is based on that protocol, not an exact application-version match; unsupported peers are rejected with instructions to reinstall/reload. Releases ship both executables at the same package version. The companion's --version and --protocol-version options are available for diagnostics.
Installation does not follow links/reparse points or overwrite different existing content. To remove the bundled extension, run:
:copilot bridge uninstall
The command is also available in the command palette. It removes only a verified copy of the bundled extension.mjs, leaves containing directories and other files alone, and clears remembered destination sessions. A missing installation is reported without creating directories. Modified, unrecognized, symlinked, or reparse-point targets are refused rather than deleted.
Reload extensions in each running Copilot CLI session after uninstalling. Removing the file does not stop an extension that is already loaded, cancel queued prompts, or remove conversations, CLI settings, or authentication.
After upgrading Kvim or moving the executables, use the new Kvim build to run :copilot bridge uninstall, then :copilot bridge install, and reload extensions in each CLI session. You do not need the old executable. Uninstall recognizes the current and recorded historical bundled scripts by their full-template SHA-256, ignoring only CRLF/LF differences and the valid absolute executable path recorded in the script. Historical fingerprints are retained when the bundled extension changes. Installation still never overwrites different content automatically.
To migrate an installation that launched kvim --copilot-bridge-host, run :copilot bridge uninstall, then :copilot bridge install, and reload extensions in every running CLI session. This version recognizes the exact previous bundled script for safe removal; installation never overwrites it or customized scripts automatically. Already-running legacy helpers remain active until their extensions stop/reload, and can still keep the old editor executable locked on Windows. New extensions launch only the companion. If a script is customized or predates the recognized history, the error gives its exact path. Inspect it, then move only extension.mjs to a backup outside Copilot's extensions directory. Run :copilot bridge install and reload extensions. Do not delete the containing kvim extension directory or other extensions, and do not use /clear for this recovery.
Send To Copilot
| Action | Default shortcut | Ex command |
|---|---|---|
| Open the prompt | <space>ac |
:copilot send |
| Choose a live destination | <space>as |
:copilot sessions |
Both actions are also in the command palette. Their configurable action names are copilot.ask and copilot.sessions; the same bindings work in Normal, Visual, and Visual-Line modes.
No selection is necessary. Normal mode includes the current complete line, file path, and cursor position. Visual mode includes the exact contiguous selection; Visual-Line includes complete selected lines. Visual-Block is not supported. The source must be a named file within the selected CLI session's working directory. Source files are limited to 8 MiB, selected/current-line context to 256 KiB, and prompts to 16 KiB.
Send To Copilot opens a compact input band across the active editor pane, immediately below the cursor's rendered row. Horizontal separators replace the floating box, and colored shortcut buttons sit directly on the bottom separator. The band and session finder use the editor background rather than a lighter panel fill; action buttons, status badges, and selected rows keep their semantic theme colors. Session name/status, ID/folder, and source context use theme colors. The band overlays source rows without editing or inserting text.
Near the bottom, the rendered view scrolls just enough to keep the cursor, the complete band, and at least one normal editor row below it visible. The global status bar does not count as that margin. This temporary scroll does not change the window's persistent viewport; closing the band restores the normal view. Wrapping, rendered Markdown, inlay hints, and split offsets use the editor's existing screen mapping. Linked file-diff panes retain their shared scrolling. Short panes compact metadata/previews; panes too small to preserve the margin show a resize notice instead.
The Tab session finder remains a separate wider picker. It gives each session separate name and metadata rows, abbreviates long folder paths from the left, and shows the selected name and full ID below the list when space permits:
Enter: Send (saves first); a missing destination opens the session picker.Tab: choose another session without losing the draft.Esc: cancel, or return from the picker to the draft.- Left/Right, Home/End, Backspace/Delete, and Ctrl-U edit the prompt.
Multiline/control-character paste is rejected rather than submitted. Picking a session never sends automatically: press Enter again to submit. Session names, short IDs, working directories, and busy state are shown in the picker. Names use the CLI's current friendly title, including automatic titles and renames, refreshed on discovery. A missing title falls back to the initial name or summary, then "Unnamed session"; the ID remains a separate field. The explicit choice is remembered per workspace for this Kvim process and checked again when reopening the popup. A vanished session is not silently replaced by another. If the originating pane changes buffer or is replaced, the prompt is cancelled with its draft retained; an already-dispatched delivery may have occurred and must be checked in the CLI.
Opening/cancelling the popup does not save. Submitting uses the ordinary save pipeline, including format-on-save and trailing-whitespace cleanup. Delivery waits for the exact current buffer revision to be written and verified on disk. A failed save never sends; the draft stays open. Cancelling after a save has started prevents delivery but does not undo that save.
If saving changes the captured context or its range cannot be mapped exactly, delivery pauses for review. The popup previews the changed context: Enter confirms it through another save, or Ctrl-R closes the popup so you can reselect/reposition and reopen Send To Copilot with the draft retained. This includes text appended to the current line by a formatter. Workspace changes also retain the draft, but require choosing the source context again.
Busy CLI sessions receive the request with the SDK's enqueue mode. Sent/Queued acknowledge acceptance, not completion; the busy label is an observation, not an atomic queue-position guarantee. A dispatched send cannot be cancelled. If an acknowledgement is lost, kvim reports Delivery unknown: inspect the CLI before retrying to avoid duplicate work.
Live-session privacy and editing
The chosen CLI conversation receives your prompt, source path, UTF-16 cursor/range positions, selected/current-line text, and a saved-file SHA-256. It does not receive the rest of the buffer from kvim. Unlike the isolated grammar/clarity adapter, the live conversation keeps its existing tools, repository instructions, authentication, and permission approvals. It may read more repository content and edit files under those permissions.
The bridge does not approve CLI operations, copy credentials, or automatically apply model output inside Kvim. Existing external-file-change handling reloads clean buffers after CLI edits; dirty buffers require explicit conflict resolution. While a prompt is queued, further editor changes remain possible: the attachment is a snapshot, and the prompt tells Copilot to reread the file before editing. Saving before delivery does not lock the file against future concurrent edits.
No source text or prompt is persisted in bridge discovery files or logs. Same-account processes are inside the local trust boundary. If no sessions appear, check experimental/extension mode, /extensions manage, the recorded Kvim executable location, and whether the CLI is local rather than remote. Discovery reports malformed or incompatible endpoints as warnings without hiding other healthy sessions. Rejected client requests do not stop the companion; a lost or invalid reply after dispatch still stops it to prevent misattributing a later acknowledgement.
Diff and review snapshots
In an editable two-file comparison, the Git hunk view, Explorer's Git preview, or the PR Review workspace, <space>ac captures diff-aware context instead of pretending historical text is a current-file selection. An explicit selection takes precedence; otherwise the focused hunk is used. Review's selected thread includes its discussion and original location, including an explicit outdated marker when applicable.
Choose a scope with :copilot send hunk, :copilot send line, or :copilot send selection. The configurable actions are copilot.ask_hunk, copilot.ask_line, and copilot.ask_selection. Git hunk rows can be selected with v/V. Explorer's Git preview supports whole-hunk context; it reports that line/range selection is unavailable instead of inventing a cursor.
The prompt shows the captured context identity. Snapshots include bounded before/after text, old/new coordinates, and comparison or PR revision identifiers. Removed text is historical data and does not claim a location in the current file. Stale comparison results cannot supply a new snapshot. Sending a snapshot does not save buffers or apply AI output.
The destination is still an explicitly selected live CLI conversation, with the same workspace-confinement checks, queueing, tools, permissions, and unknown-delivery behavior described above. Reload the installed bridge extension after upgrading when its snapshot protocol/capability changes. Snapshots may be stale by the time Copilot processes them; it is instructed to inspect current repository state before editing.
Insert-mode completion
kvim can merge GitHub Copilot suggestions into the existing Insert-mode completion popup. The integration is opt-in and uses the official @github/copilot-language-server process over stdio; kvim does not call a private Copilot HTTP API and does not reuse credentials from another editor.
Install the server
Use kvim's managed installer:
:copilot install
Confirm the reviewed recipe to install the pinned official @github/copilot-language-server package and managed Node runtime into kvim's platform data directory. Downloads are verified, installation is cancellable, and the service starts when installation completes. Later kvim sessions use the managed launcher automatically unless [copilot].command or [copilot].args explicitly overrides it.
Enable the service in the OS-specific kvim/config.toml:
[copilot]
enabled = trueYou can instead start the configured service for only the current editor session:
:copilot
This internal Ex command uses the managed launcher when installed, otherwise the configured command and args or their defaults. Neither command modifies config.toml; use [copilot] enabled = true to start the service automatically in future sessions.
User-managed server
Alternatively, install Node.js 22.13 or newer and the official package:
npm install --global @github/copilot-language-server
copilot-language-server --version
Set command and args explicitly to override a managed installation. The server executable must be available to the environment that launches kvim. GUI applications can have a different PATH from an interactive shell, so an absolute command path is preferable when command lookup is unreliable.
kvim launches commands directly, without a shell. On Windows, npm's .cmd and .ps1 shims therefore are not portable direct-process commands. Configure node.exe and the package entry point instead, replacing the paths with those from the local installation:
[copilot]
enabled = true
command = 'C:\Program Files\nodejs\node.exe'
args = [
'C:\Users\you\AppData\Roaming\npm\node_modules\@github\copilot-language-server\dist\language-server.js',
"--stdio",
]Sign in and inspect status
Open :health and navigate to the Copilot section. It reports whether the server is starting, ready, or failed, along with authentication and content-exclusion/inactive status.
When the account row says signed out, select it and press Enter. The row then shows the GitHub device code and verification URL. Press Enter again to continue sign-in; kvim accepts only an HTTP(S) URL from the server and asks the OS to open it. Enter the displayed code in the browser. Health updates as the server finishes authorization. Selecting a signed-in account row and pressing Enter signs out.
Server status rows that provide an action are also executable with Enter. Server-initiated questions appear as modal choices; use arrows, h/j/k/l, or Tab/Shift-Tab, then Enter. Number keys choose the corresponding action. Esc, q, or Ctrl-C returns no action.
Use completion
Press Ctrl-Space in Insert mode. Candidates are ranked in this order:
- GitHub Copilot;
- configured language server;
- relative paths;
- focused-buffer tokens, then other-buffer tokens.
Copilot rows use a dedicated badge and color (C with the ASCII glyph profile). A multiline suggestion shows its first line plus a … (+N lines) summary, but acceptance inserts the complete server edit. Enter or Tab accepts it as one undoable edit and preserves the buffer's LF or CRLF line ending.
The source can be hidden from completion without disabling the process:
[completion]
copilot = falseThis switch only suppresses Copilot candidates. To stop the service and all document synchronization, set [copilot].enabled = false or remove the section.
Completion is manually triggered. kvim does not request Copilot suggestions automatically and does not render them as ghost text.
Prompt-oriented Copilot actions use the installed and authenticated Copilot CLI, not the popup-completion Language Server. kvim invokes it without repository tools, custom instructions, built-in MCP servers, or remote export. Request context is stored in a temporary attachment only for the lifetime of the contained CLI process.
Privacy and trust boundary
Copilot is disabled by default. When enabled, kvim synchronizes every open, path-backed buffer with the local Copilot Language Server, including its file URI, language ID, full initial contents, subsequent edits, and focus changes. Manual completion requests include the cursor position and indentation options. Pathless scratch buffers are not synchronized.
Grammar/clarity prompt actions do not use the Language Server. They pass bounded selected text to the separately authenticated Copilot CLI through a temporary attachment, with tools and repository instructions disabled. The CLI may send that context to GitHub under the account's Copilot terms and organization policy. The attachment is deleted when generation completes or is cancelled.
The server may send synchronized content and completion context to GitHub under the account's Copilot terms, organization policy, and content-exclusion configuration. The server owns authentication tokens; kvim neither reads nor stores them. kvim also:
- does not log server stderr, source text, device credentials, or tokens;
- rejects server requests to edit workspace files;
- only opens server-provided external URLs with an
http://orhttps://scheme; - exposes server-reported inactive, policy, quota, and error state in Health.
Content exclusion is enforced and reported by the Copilot server, not by a second local kvim rules engine. If a repository must never be synchronized, disable the [copilot] service before opening it rather than relying on the completion-source toggle.
Troubleshooting
- No Copilot section activity: confirm
[copilot].enabled = true, then restart kvim. - Server failed to start: inspect the Copilot
serverrow in:healthand verify the configured command outside kvim. - Signed in but no candidates: confirm
[completion].copilot = true, select a path-backed buffer, and check Health for inactive/content-excluded status. - Windows npm command does not launch: use the explicit
node.exerecipe above instead of the npm shim. - Prompt or completion fails: inspect the file-backed log screen with
<space>m; logs intentionally omit raw server stderr and source content.