Skip to main content
Docs / VIM INTERFACE

Vim Interface Overview

Architecture and the complete component directory for coc.nvim's Vim interface.

Vim Interface

Welcome to the Vim Interface specification for coc.nvim. This chapter provides a complete, authoritative reference for integrating, configuring, and extending coc.nvim from Vimscript and Neovim Lua, directly sourced from the official doc/coc.txt.

Introduction & Architecture

coc.nvim acts as a high-performance LSP client and extension runtime running as an external Node.js background process. It connects to Vim / Neovim over asynchronous msgpack-RPC channels, ensuring editing in the foreground remains non-blocking and buttery smooth (60fps UI).

The interface between Vim and coc.nvim is structured into six core components:

Vim and Neovim interface components communicating with the coc.nvim Node.js background server


Vim Interface Component Directory

Explore each dedicated reference section below:

ComponentDescriptionReference Link
Key MappingsAll 38+ <Plug> mappings for definitions, references, diagnostics, formatting, rename, code actions, text objects, and multi-cursor.Go to Key Mappings
VariablesComplete reference of Global (g:), Buffer (b:), Window (w:), and Environment ($) configuration and state variables.Go to Variables
Functions & ActionsBuilt-in Vimscript functions (coc#*, coc#pum#*, coc#float#*) and the complete 60+ CocAction() / CocRequest() catalog.Go to Functions
Highlight GroupsOver 115 highlight groups for diagnostics, float windows, popup completion menu, inlay hints, semantic tokens, and trees.Go to Highlight Groups
Commands & AutocmdsEx commands (:CocStart, :CocConfig, :CocList) and User autocommand events (CocDiagnosticChange, CocStatusChange).Go to Commands & Autocmds

Runtime Flow & Best Practices

  1. Wait for Service Initialization:
    Certain functions only execute once the background server is live. Check g:coc_service_initialized or listen to CocNvimInit.
  2. Buffer Local Disabling:
    You can selectively disable autocompletion or auto-formatting per buffer (e.g. in large log files or markdown scratchpads) by setting b:coc_suggest_disable = 1 and b:coc_disable_autoformat = 1.
  3. Statusline Integration:
    Call coc#status() and inspect b:coc_diagnostic_info in your statusline / winbar configuration for instant diagnostic indicators and background task spinners.
<!-- generated-current-vim-reference -->