feat: create gruvbox-themed nixvim configuration
Added nixvim as a flake input in flake.nix Added plugin definitions ini home-manager/stvnliu/nixvim/ Added configuration options for easy toggling for editors
This commit is contained in:
parent
2f04f90bc3
commit
fcb2066392
22 changed files with 490 additions and 39 deletions
152
home-manager/stvnliu/nixvim/cmp.nix
Normal file
152
home-manager/stvnliu/nixvim/cmp.nix
Normal file
|
@ -0,0 +1,152 @@
|
|||
# # Source: https://github.com/hmajid2301/dotfiles/blob/ab7098387426f73c461950c7c0a4f8fb4c843a2c/home-manager/editors/nvim/plugins/coding/cmp.nix
|
||||
{
|
||||
plugins = {
|
||||
luasnip.enable = true;
|
||||
copilot-lua = {
|
||||
enable = true;
|
||||
suggestion.enabled = false;
|
||||
panel.enabled = false;
|
||||
};
|
||||
|
||||
cmp-buffer = {enable = true;};
|
||||
|
||||
cmp-emoji = {enable = true;};
|
||||
|
||||
cmp-nvim-lsp = {enable = true;};
|
||||
|
||||
cmp-path = {enable = true;};
|
||||
|
||||
cmp_luasnip = {enable = true;};
|
||||
|
||||
cmp = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
snippet.expand = ''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
{name = "luasnip";}
|
||||
{
|
||||
name = "buffer";
|
||||
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||
}
|
||||
{name = "nvim_lua";}
|
||||
{name = "path";}
|
||||
{name = "copilot";}
|
||||
];
|
||||
|
||||
formatting = {
|
||||
fields = ["abbr" "kind" "menu"];
|
||||
format =
|
||||
# lua
|
||||
''
|
||||
function(_, item)
|
||||
local icons = {
|
||||
Namespace = "",
|
||||
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 = "",
|
||||
Table = "",
|
||||
Object = "",
|
||||
Tag = "",
|
||||
Array = "[]",
|
||||
Boolean = "",
|
||||
Number = "",
|
||||
Null = "",
|
||||
String = "",
|
||||
Calendar = "",
|
||||
Watch = "",
|
||||
Package = "",
|
||||
Copilot = "",
|
||||
Codeium = "",
|
||||
TabNine = "",
|
||||
}
|
||||
|
||||
local icon = icons[item.kind] or ""
|
||||
item.kind = string.format("%s %s", icon, item.kind or "")
|
||||
return item
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
|
||||
scrollbar = false;
|
||||
sidePadding = 0;
|
||||
border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"];
|
||||
};
|
||||
|
||||
settings.documentation = {
|
||||
border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"];
|
||||
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
|
||||
};
|
||||
};
|
||||
|
||||
mapping = {
|
||||
"<C-n>" = "cmp.mapping.select_next_item()";
|
||||
"<C-p>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-j>" = "cmp.mapping.select_next_item()";
|
||||
"<C-k>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
|
||||
"<Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
"<S-Tab>" =
|
||||
# lua
|
||||
''
|
||||
function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue