Skip to content

Commit

Permalink
feat(pack): add cpp base pack
Browse files Browse the repository at this point in the history
  • Loading branch information
doupongzeng committed Jun 21, 2023
1 parent bfb9f9c commit cada5fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lua/astrocommunity/pack/cpp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# cpp Language Pack

This plugin pack does the following:

- Adds `cpp` `c` Treesitter parser
- Adds `clangd` language server
- Adds `clang-format` formatter

tips: the offset_encondings of clangd will confilicts whit null-ls, so add the following file in your user_config.
```lua
-- <user_config_path>/lsp/config/clangd.lua
return {
capabilities = {
offsetEncoding = "utf-8",
},
}
```
21 changes: 21 additions & 0 deletions lua/astrocommunity/pack/cpp/cpp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local utils = require "astronvim.utils"
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { "cpp", "c" })
end
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "clangd") end,
},
{
"jay-babu/mason-null-ls.nvim",
opts = function(_, opts)
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "clang-format")
end,
},
}

0 comments on commit cada5fb

Please sign in to comment.