parent
054964fd66
commit
e1d77a4f3b
5 changed files with 69 additions and 73 deletions
homeManagerModules/neovim/langs/c-lang
|
@ -4,27 +4,18 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) attrValues mkIf;
|
||||
inherit (lib) mkIf;
|
||||
inherit (pkgs.writers) writeYAML;
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
in
|
||||
mkIf cfg.enableIde {
|
||||
in {
|
||||
config = mkIf cfg.enableIde {
|
||||
xdg.configFile."clangd/config.yaml".source = writeYAML "config.yaml" {
|
||||
CompileFlags.Add = ["-D__cpp_concepts=202002L"];
|
||||
};
|
||||
|
||||
programs = {
|
||||
neovim = {
|
||||
extraPackages = attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
gcc
|
||||
clang-tools
|
||||
cmake-language-server
|
||||
;
|
||||
};
|
||||
|
||||
extraLuaConfig =
|
||||
# lua
|
||||
''
|
||||
|
@ -32,33 +23,38 @@ in
|
|||
pattern = { 'cpp', 'c' },
|
||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||
});
|
||||
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
local clangd_extensions = require('clangd_extensions.inlay_hints');
|
||||
|
||||
lsp.cmake.setup({
|
||||
capabilities = default_capabilities,
|
||||
});
|
||||
|
||||
lsp.clangd.setup({
|
||||
capabilities = default_capabilities,
|
||||
|
||||
handlers = require('lsp-status').extensions.clangd.setup(),
|
||||
|
||||
on_attach = function(_, bufnr)
|
||||
clangd_extensions.setup_autocmd();
|
||||
clangd_extensions.set_inlay_hints();
|
||||
end,
|
||||
});
|
||||
'';
|
||||
|
||||
plugins = attrValues {
|
||||
inherit
|
||||
(pkgs.vimPlugins)
|
||||
clangd_extensions-nvim
|
||||
;
|
||||
};
|
||||
plugins = [
|
||||
{
|
||||
plugin = pkgs.vimPlugins.clangd_extensions-nvim;
|
||||
type = "lua";
|
||||
config =
|
||||
# lua
|
||||
''
|
||||
local lsp = require('lspconfig');
|
||||
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
|
||||
|
||||
local clangd_extensions = require('clangd_extensions.inlay_hints');
|
||||
|
||||
lsp.cmake.setup({
|
||||
capabilities = default_capabilities,
|
||||
});
|
||||
|
||||
lsp.clangd.setup({
|
||||
capabilities = default_capabilities,
|
||||
|
||||
handlers = require('lsp-status').extensions.clangd.setup(),
|
||||
|
||||
on_attach = function(_, bufnr)
|
||||
clangd_extensions.setup_autocmd();
|
||||
clangd_extensions.set_inlay_hints();
|
||||
end,
|
||||
});
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
14
homeManagerModules/neovim/langs/c-lang/devShell.nix
Normal file
14
homeManagerModules/neovim/langs/c-lang/devShell.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
mkShell,
|
||||
gcc,
|
||||
clang-tools,
|
||||
cmake-language-server,
|
||||
...
|
||||
}:
|
||||
mkShell {
|
||||
packages = [
|
||||
gcc
|
||||
clang-tools
|
||||
cmake-language-server
|
||||
];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue