Git Product home page Git Product logo

clangd-nvim's Introduction

DEPRECATED! Use nvim-treesitter instead.

clangd-nvim

Issues: see gitlab

clangd-nvim uses Neovim's build- in Language Server Protocol to enable clangd's support for semantic highlighting.

Left: clangd-nvim + nvim-lsp; Right: no plugin

Roadmap

  • Implement basic semantic highlight support
  • Implement highlight groups
  • Enable/Disable semantic highlighting
  • Change highlight color

Features

  • Semantic Highlighting for c,cpp

Requirements

Install

" Required
Plug 'neovim/nvim-lsp'
" Plugin
Plug 'robert-oleynik/clangd-nvim'

Setup

Add to init file:

lua << EOF
local clangd_nvim = require'clangd_nvim'

require'nvim_lsp'.clangd.setup{
    capabilities = {
        textDocument = {
            semanticHighlightingCapabilities = {
                semanticHighlighting = true
            }
        }
    },
    on_init = clangd_nvim.on_init
}
EOF

Functions

Enable semantic highlighting

Enabled by default

lua require'clangd_nvim'.enable()

Disable semantic highlighting

lua require'clangd_nvim'.disable()

Reload current buffer's semantic highlight

lua require'clangd_nvim'.reload()

Clear current buffer's semantic highlight

lua require'clangd_nvim'.clear_highlight()

Change Colors

  1. Add to init file (init.vim)
augroup ConfigSetup
    autocmd!
    autocmd VimEnter,ColorScheme * runtime syntax/custom_colors.vim
augroup END
  1. Add to neovim config folder syntax/custom_colors.vim-File (on Linux ~/.config/nvim/syntax/custom_colors.vim)
  2. Change Colors by:
hi! default link <clangd-syntax-highlight-group> <vim-syntax-highlight-group>
" Example:
hi! default link ClangdClass Type

Note: :so $VIMRUNTIME/syntax/hitest.vim lists all available syntax highlight groups with colors.

Symbols And Syntax Highlight Groups

Clangd Symbol Highlight Group Default Value
entity.name.function.cpp ClangdFunction Function
entity.name.function.method.cpp ClangdMemberFunction Function
entity.name.function.method.static.cpp ClangdStaticMemberFunction Function
entity.name.function.preprocessor.cpp ClangdPreprocessor Macro
entity.name.namespace.cpp ClangdNamespace Namespace
entity.name.other.dependent.cpp ClangdDependentName Function
entity.name.type.class.cpp ClangdClass Type
entity.name.type.concept.cpp ClangdConcept Type
entity.name.type.dependent.cpp ClangdDependentType Type
entity.name.type.enum.cpp ClangdEnum Type
entity.name.type.typedef.cpp ClangdTypedef Type
entity.name.type.template.cpp ClangdTemplateParameter Type
storage.type.primitive.cpp ClangdPrimitive Type
variable.other.cpp ClangdVariable Variable
variable.other.local.cpp ClangdLocalVariable Variable
variable.parameter.cpp ClangdParameter Variable
variable.other.field.cpp ClangdField Variable
variable.other.static.field.cpp ClangdStaticField Variable
variable.other.enummember.cpp ClangdEnumConstant Constant
meta.disabled ClangdInactiveCode Comment

clangd-nvim's People

Contributors

robert-oleynik avatar swarn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.