{"id":13872603,"url":"https://github.com/jackguo380/vim-lsp-cxx-highlight","last_synced_at":"2025-07-16T02:30:46.490Z","repository":{"id":51122029,"uuid":"172404644","full_name":"jackguo380/vim-lsp-cxx-highlight","owner":"jackguo380","description":"Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd","archived":false,"fork":false,"pushed_at":"2023-01-11T12:35:54.000Z","size":5653,"stargazers_count":337,"open_issues_count":18,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-06T23:52:24.336Z","etag":null,"topics":["c","ccls","clangd","coc","cpp","cquery","cxx","language-server-client","language-server-protocol","languageclient","neovim","nvim","semantic-highlighting","vim","vim-lsp","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackguo380.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-24T23:50:55.000Z","updated_at":"2024-07-01T07:42:01.000Z","dependencies_parsed_at":"2023-02-09T03:01:00.431Z","dependency_job_id":null,"html_url":"https://github.com/jackguo380/vim-lsp-cxx-highlight","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackguo380%2Fvim-lsp-cxx-highlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackguo380%2Fvim-lsp-cxx-highlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackguo380%2Fvim-lsp-cxx-highlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackguo380%2Fvim-lsp-cxx-highlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackguo380","download_url":"https://codeload.github.com/jackguo380/vim-lsp-cxx-highlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226095801,"owners_count":17572990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","ccls","clangd","coc","cpp","cquery","cxx","language-server-client","language-server-protocol","languageclient","neovim","nvim","semantic-highlighting","vim","vim-lsp","vim-plugin"],"created_at":"2024-08-05T23:00:47.660Z","updated_at":"2024-11-23T20:31:08.956Z","avatar_url":"https://github.com/jackguo380.png","language":"Vim script","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# vim-lsp-cxx-highlight\n\nvim-lsp-cxx-highlight is a vim plugin that provides C/C++/Cuda/ObjC semantic highlighting\nusing the language server protocol.\n\n## Archive Notice\n\nThis project has been archived as it is no longer needed to achieve highlighting\nas most LSP servers and clients now support Semantic Tokens.\n\nThe original purpose of this project was to bring good semantic highlighting to vim/nvim\nfor C++ well before it was standardized by parsing non-standard extensions from cquery and ccls.\n\nIt makes more sense for a LSP client (builtin or a separate plugin) to implement the highlighting\nas it is standardized now.\n\n## Introduction\n\nHow does this plugin differentiate itself from\n[color_coded](https://github.com/jeaye/color_coded) and\n[chromatica](https://github.com/arakashic/chromatica.nvim)?\n\nvim-lsp-cxx-highlight does no compilation/analysis of source files. It receives all \nof its semantic highlighting data over the language server protocol.\nThe main advantage of this plugin is that it is written entirely in vimscript.\n\nThe idea for this came from [vscode-cquery](https://github.com/cquery-project/vscode-cquery)\nand seeing how it uses cquery to provide semantic highlighting.\n\nLeft: No Plugin, Right: vim-lsp-cxx-highlight + ccls\n\n![Left: No Plugin, Right: vim-lsp-cxx-highlight + ccls](images/Comparison.jpg)\n\n## Requirements\n\nThe plugin requires `vim` or `neovim`. For `vim` `+timers` and `+byte_offset` are\nrecommended but not required.\n\nAdditionally, a compatible language server and language server client is required.\n\nThe following language servers and protocol extensions are supported:\n\n- **[cquery](https://www.github.com/cquery-project/cquery)**\n  - `$cquery/publishSemanticHighlighting` - semantic highlighting\n  - `$cquery/setInactiveRegions` - preprocessor skipped regions\n\n- **[ccls](https://www.github.com/MaskRay/ccls)**\n  - `$ccls/publishSemanticHighlight` - semantic highlighting\n  - `$ccls/publishSkippedRegions` - preprocessor skipped regions\n\n- **[clangd](https://clangd.llvm.org)**\n  - **Requires** [coc.nvim](https://github.com/neoclide/coc.nvim) and [coc-clangd](https://github.com/clangd/coc-clangd)\n  - Using the proposed [Semantic Highlighting Protocol](https://github.com/microsoft/language-server-protocol/issues/18)\n  - **IMPORTANT:** coc-clangd supports 2 implementaions: \"semantic highlighting\" (old, non-standard)\n  and \"semantic tokens\" (new, LSP standard). The latest versions of clangd (12+) require disabling\n  coc's semantic tokens to work; see below.\n\nThe following language server clients are supported:\n\n- **[vim-lsp](https://www.github.com/prabirshrestha/vim-lsp)**\n- **[LanguageClient-neovim](https://github.com/autozimu/LanguageClient-neovim)**\n- **[coc.nvim](https://github.com/neoclide/coc.nvim)**\n- **[nvim-lsp](https://github.com/neovim/nvim-lsp)**\n\n## Install\n\nUsing [vim-plug](https://www.github.com/junegunn/vim-plug) (Or use the plugin manager of your choice)\n\n```vim\nPlug 'prabirshrestha/vim-lsp' \" vim-lsp\n\" or\nPlug 'autozimu/LanguageClient-neovim' \" LanguageClient-neovim\n\" or\nPlug 'neoclide/coc.nvim' \" coc.nvim\n\" or\nPlug 'neovim/nvim-lsp' \" nvim-lsp\n\nPlug 'jackguo380/vim-lsp-cxx-highlight'\n```\nUsing vim8's native package manager (Run this command in a terminal)\n\n```bash\ngit clone https://github.com/jackguo380/vim-lsp-cxx-highlight.git ~/.vim/pack/vendor/start/vim-lsp-cxx-highlight\n```\n\nFor `cquery` the following initializationOptions are needed:\n```json\n{\n    \"highlight\": { \"enabled\" : true },\n    \"emitInactiveRegions\" : true\n}\n```\n\nFor `ccls` the following initializationOptions are needed:\n```json\n{\n    \"highlight\": { \"lsRanges\" : true }\n}\n```\n\nFor `clangd` `coc-settings.json` must have:\n```json\n{\n    \"clangd.semanticHighlighting\": true,\n    \"coc.preferences.semanticTokensHighlights\": false\n}\n```\n\nFor a sample vim-lsp configuration see [this](sample-configs/vim-lsp-register.vim)\n\nFor a sample LanguageClient-neovim configuration see [this](sample-configs/LanguageClient-register.vim)\n\nFor a sample coc.nvim coc-settings.json see [this](sample-configs/coc-settings.json)\n\nFor a sample nvim-lsp configuration see [this](sample-configs/nvim-lsp-register.vim)\n\n## Configuration\n\nThe plugin should work without any additional configuration. But if you don't like\nthe default settings see `:help vim-lsp-cxx-highlight`\n\n### Vim Text Properties\n\nvim-lsp-cxx-highlight now has support for Vim 8.1's text properties (See `:help textprop`).\n\nWhat using text-properties improves:\n - Highlighting moves around with the text, inserting new lines/words no longer messes things up\n - Deleting lines removes highlighting attached to text\n - Some performance improvements? (Unverified)\n\nSupport for this feature has been tested on Vim version `8.1.1722`, older versions may have problems.\nIt is recommended to upgrade to this version or newer.\n\nTo enable:\n```vim\nlet g:lsp_cxx_hl_use_text_props = 1\n```\n\n**Note:** This is now automatically enabled for vim version 8.2 or greater\n\nThis is a experimental feature, so it may be quite buggy. Please file bug reports!\n\n\n## License\n\n[MIT License](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackguo380%2Fvim-lsp-cxx-highlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackguo380%2Fvim-lsp-cxx-highlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackguo380%2Fvim-lsp-cxx-highlight/lists"}