Configuration File
Configure coc.nvim with JSONC, workspace overrides, language scopes, schemas, and the visual configuration tool.
Configuration
coc.nvim stores settings in JSON with comments (JSONC). Install coc-json to get completion and validation inside coc-settings.json.
| 1 | :CocInstall coc-json |
User and workspace settings
| Scope | Open it | File and behavior |
|---|---|---|
| User | :CocConfig | Opens coc-settings.json under coc#util#get_config_home(). Set g:coc_config_home before coc.nvim starts to use another directory. |
| Workspace folder | :CocLocalConfig | Opens .vim/coc-settings.json in the current workspace folder. These values override user settings for resources in that folder. |
A folder settings file is only active when its parent directory is resolved as a coc.nvim workspace folder. When local settings appear to be ignored, check :CocList folders and Workspace Folders.
The g:coc_user_config variable and coc#config() API can override values from the user configuration. They are useful for small Vimscript-owned overrides; keep larger configuration in JSONC.
Variable expansion
All string settings support ${userHome}, ${cwd}, and ${env:NAME}. Missing environment variables are left unexpanded.
Path-oriented settings and language-server args also support ~ at the beginning and these resource variables:
${workspaceFolder}and${workspaceFolderBasename}${file},${fileDirname}, and${fileExtname}${fileBasename}and${fileBasenameNoExtension}
| 1 | { |
| 2 | "workspace.ignoredFolders": ["${userHome}/tmp", "${env:CACHE_DIR}"], |
| 3 | "languageserver": { |
| 4 | "example": { |
| 5 | "command": "${workspaceFolder}/bin/server", |
| 6 | "args": ["--config", "${fileDirname}/server.json"], |
| 7 | "filetypes": ["example"] |
| 8 | } |
| 9 | } |
| 10 | } |
Configuration scopes
| Scope | Where it can be set |
|---|---|
application | User configuration only. |
resource | User or workspace-folder configuration. |
language-overridable | User or workspace settings, including language-specific blocks. |
The Settings Generator shows the scope of every built-in property.
Language-specific settings
A language-overridable property can be placed in a combined language section:
| 1 | { |
| 2 | "[rust][lua][c]": { |
| 3 | "inlayHint.enable": false |
| 4 | } |
| 5 | } |
Use coc.nvim language IDs, which normally match the mapped Vim filetype. Run :CocCommand document.echoFiletype to inspect the current value.
Language server configuration
The languageserver object starts servers that are not managed by an extension. A server entry can launch a command, load a Node module, or connect to a socket; it also declares filetypes, optional rootPatterns, initialization options, settings, and disabled features.
| 1 | { |
| 2 | "languageserver": { |
| 3 | "example": { |
| 4 | "command": "example-language-server", |
| 5 | "args": ["--stdio"], |
| 6 | "filetypes": ["example"], |
| 7 | "rootPatterns": ["example.toml", ".git"], |
| 8 | "settings": { "example.trace": "messages" } |
| 9 | } |
| 10 | } |
| 11 | } |
Prefer a maintained coc extension when it needs to install binaries, contribute schemas, or adapt server behavior. See Language Servers for examples.
Built-in and extension settings
Built-in settings cover workspace, file watching, extensions, editor behavior, floats, trees, dialogs, HTTP, npm, language servers, MCP, completion, diagnostics, lists, notifications, semantic tokens, and other LSP features.
Extensions add their own settings through contributes.configuration in package.json. Their schemas become available to coc-json and the Settings Generator after the extension is installed.
- Use the Settings Generator & Validator to search every current built-in property and copy valid JSON.
- Use
:h coc-configfor the generated Vim help reference. - Type a section name such as
suggest.,diagnostic., orlist.incoc-settings.jsonfor schema-aware completion.
Applying and troubleshooting settings
Most components observe configuration changes after the file is saved. An extension or language server may still require its own restart when it documents that behavior.
When a value is ignored:
- Confirm the JSONC file has no validation errors.
- Check the property scope in /config-tool.
- Confirm the current workspace folder and mapped filetype.
- Use
:CocInfo,:CocOpenLog, or Troubleshooting for runtime errors.
Source of truth: doc/coc.txt configuration help and doc/coc-config.txt.