add core configuration
This commit is contained in:
parent
74c78e1c68
commit
f40517cff1
94 changed files with 2816 additions and 959 deletions
85
home-manager/modules/neovim/plugins/lsp/cmp.nix
Normal file
85
home-manager/modules/neovim/plugins/lsp/cmp.nix
Normal file
|
@ -0,0 +1,85 @@
|
|||
{...}: {
|
||||
programs.nixvim.plugins = {
|
||||
cmp = {
|
||||
autoEnableSources = false;
|
||||
enable = true;
|
||||
settings = {
|
||||
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||
formatting = {
|
||||
fields = ["kind" "abbr" "menu"];
|
||||
format = ''
|
||||
function(entry, vim_item)
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = " ",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = " ",
|
||||
Misc = " ",
|
||||
}
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.abbr = vim_item.abbr .. " " .. (vim_item.menu and vim_item.menu or "")
|
||||
if vim.fn.strchars(vim_item.abbr) > 50 then
|
||||
vim_item.abbr = vim.fn.strcharpart(vim_item.abbr, 0, 50) .. "..."
|
||||
end
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]"
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
'';
|
||||
};
|
||||
mapping.__raw = '' cmp.mapping.preset.insert({
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<S-TAB>"] = cmp.mapping.select_prev_item(),
|
||||
["<TAB>"] = cmp.mapping.select_next_item(),
|
||||
})'';
|
||||
window = {
|
||||
completion.__raw = "cmp.config.window.bordered()";
|
||||
documentation.__raw = "cmp.config.window.bordered()";
|
||||
};
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{name = "path";}
|
||||
{name = "buffer";}
|
||||
{name = "crates";}
|
||||
];
|
||||
};
|
||||
};
|
||||
cmp_luasnip.enable = true;
|
||||
cmp-buffer.enable = true;
|
||||
cmp-path.enable = true;
|
||||
cmp-nvim-lsp.enable = true;
|
||||
luasnip.enable = true;
|
||||
};
|
||||
}
|
192
home-manager/modules/neovim/plugins/lsp/default.nix
Normal file
192
home-manager/modules/neovim/plugins/lsp/default.nix
Normal file
|
@ -0,0 +1,192 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./cmp.nix
|
||||
];
|
||||
programs.nixvim.plugins = {
|
||||
crates.enable = true; # Does not work
|
||||
dressing.enable = true;
|
||||
};
|
||||
programs.nixvim.extraConfigVim = ''
|
||||
augroup unrecognized_filetypes
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile *.vert set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.tesc set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.tese set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.frag set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.geom set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.comp set filetype=glsl
|
||||
autocmd BufRead,BufNewFile *.qml set filetype=qml
|
||||
autocmd BufRead,BufNewFile *.slint set filetype=slint
|
||||
autocmd BufRead,BufNewFile *.typ set filetype=typst
|
||||
augroup END
|
||||
'';
|
||||
programs.nixvim.plugins.lsp = {
|
||||
enable = true;
|
||||
|
||||
capabilities = ''
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true'';
|
||||
preConfig = ''
|
||||
local border = {
|
||||
{ "╭", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╮", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
{ "╯", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╰", "FloatBorder" },
|
||||
{ "│", "FloatBorder" }
|
||||
}
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||
'';
|
||||
|
||||
inlayHints = true;
|
||||
servers = {
|
||||
clangd = {
|
||||
enable = true;
|
||||
settings.arguments = [
|
||||
"--clang-tidy"
|
||||
"--background-index"
|
||||
"--completion-style=detailed"
|
||||
"--cross-file-rename"
|
||||
"--header-insertion=iwyu"
|
||||
"--all-scopes-completion"
|
||||
];
|
||||
};
|
||||
# jdtls.enable = true;
|
||||
emmet_ls.enable = true;
|
||||
ts_ls.enable = true;
|
||||
cssls.enable = true;
|
||||
# glsl_analyzer.enable = true;
|
||||
glslls.enable = true;
|
||||
pyright.enable = true;
|
||||
nixd.enable = true;
|
||||
lua_ls = {
|
||||
enable = true;
|
||||
settings = {
|
||||
telemetry.enable = false;
|
||||
workspace.checkThirdParty = false;
|
||||
};
|
||||
};
|
||||
svelte = {
|
||||
enable = true;
|
||||
settings.enable_ts_plugin = true;
|
||||
};
|
||||
slint_lsp.enable = true;
|
||||
zls.enable = true;
|
||||
rust_analyzer = {
|
||||
enable = true;
|
||||
installRustc = false;
|
||||
installCargo = false;
|
||||
settings = {
|
||||
imports = {
|
||||
granularity.group = "crate";
|
||||
prefix = "self";
|
||||
preferNoStd = true;
|
||||
};
|
||||
check = {
|
||||
command = "clippy";
|
||||
allTargets = true;
|
||||
};
|
||||
completion = {
|
||||
fullFunctionSignatures.enable = false;
|
||||
autoimport.enable = true;
|
||||
};
|
||||
cargo = {
|
||||
allTargets = true;
|
||||
features = "all";
|
||||
};
|
||||
procMacro.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
keymaps = {
|
||||
silent = true;
|
||||
extra = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>rn";
|
||||
action.__raw = "vim.lsp.buf.rename";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ca";
|
||||
action.__raw = "vim.lsp.buf.code_action";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>di";
|
||||
action.__raw = "vim.diagnostic.open_float";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dv";
|
||||
action.__raw = "require('telescope.builtin').diagnostics";
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "gd";
|
||||
action.__raw = "vim.lsp.buf.definition";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gr";
|
||||
action.__raw = "require('telescope.builtin').lsp_references";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gI";
|
||||
action.__raw = "vim.lsp.buf.implementation";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>D";
|
||||
action.__raw = "vim.lsp.buf.type_definition";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ds";
|
||||
action.__raw = "require('telescope.builtin').lsp_document_symbols";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ws";
|
||||
action.__raw = "require('telescope.builtin').lsp_dynamic_workspace_symbols";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>K";
|
||||
action.__raw = "vim.lsp.buf.hover";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>k";
|
||||
action.__raw = "vim.lsp.buf.signature_help";
|
||||
}
|
||||
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gD";
|
||||
action.__raw = "vim.lsp.buf.declaration";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>wa";
|
||||
action.__raw = "vim.lsp.buf.add_workspace_folder";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>wr";
|
||||
action.__raw = "vim.lsp.buf.remove_workspace_folder";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>wl";
|
||||
action.__raw = "function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue