Skip to content

Commit

Permalink
feat: move completion settings to its own namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
glwbr committed Jun 29, 2024
1 parent bc39763 commit cead90f
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
_: {
programs.nixvim = {
opts.completeopt = ["menu" "menuone" "noselect"];
opts.completeopt = ["menu" "menuone" "noinsert"];

plugins = {
luasnip.enable = true;

lspkind = {
enable = true;

cmp = {
enable = true;
menu = {
nvim_lsp = "[LSP]";
nvim_lua = "[api]";
path = "[path]";
luasnip = "[snip]";
buffer = "[buffer]";
# neorg = "[neorg]";
# cmp_tabby = "[Tabby]";
};
};
};

cmp = {
enable = true;

Expand All @@ -39,16 +22,14 @@ _: {
};

sources = [
{name = "path";}
{name = "nvim_lsp";}
# {name = "cmp_tabby";}
{name = "luasnip";}
{name = "nvim_lsp";}
{name = "path";}
{
name = "buffer";
# Words from other open buffers can also be suggested.
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
# {name = "neorg";}
];
};
};
Expand Down
6 changes: 6 additions & 0 deletions home/editors/neovim/plugins/completion/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_: {
imports = [
./cmp.nix
./lspkind.nix
];
}
54 changes: 54 additions & 0 deletions home/editors/neovim/plugins/completion/lspkind.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
_: {
programs.nixvim = {
plugins = {
lspkind = {
enable = true;

symbolMap = {
Copilot = "";
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 = "";
};

extraOptions = {
maxwidth = 50;
ellipsis_char = "...";
};

cmp = {
enable = true;
menu = {
nvim_lsp = "[LSP]";
nvim_lua = "[api]";
path = "[path]";
luasnip = "[snip]";
buffer = "[buffer]";
};
};
};
};
};
}
34 changes: 0 additions & 34 deletions home/editors/neovim/plugins/lsp.nix

This file was deleted.

5 changes: 5 additions & 0 deletions home/editors/neovim/plugins/lsp/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
_: {
imports = [
./lsp.nix
];
}
78 changes: 78 additions & 0 deletions home/editors/neovim/plugins/lsp/lsp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
_: {
programs.nixvim = {
plugins = {
lsp = {
enable = true;

keymaps = {
silent = true;
diagnostic = {
# Navigate in diagnostics
"<C-p>" = "goto_prev";
"<C-n>" = "goto_next";
"<C-y>" = "confirm";
"<C-space>" = "complete";
};

lspBuf = {
gd = "definition";
gD = "references";
gt = "type_definition";
gi = "implementation";
K = "hover";
};
};

servers = {
clangd.enable = true;
eslint.enable = true;
lua-ls = {
enable = true;
extraOptions = {
settings = {
Lua = {
completion = {
callSnippet = "Replace";
};
hint.enable = true;
telemetry.enabled = false;
};
};
};
};
nil-ls.enable = true;
tsserver = {
enable = false;
filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
};
};
};
};
}

0 comments on commit cead90f

Please sign in to comment.