204 lines
5.7 KiB
Nix
204 lines
5.7 KiB
Nix
|
{config, pkgs, inputs, ... }: {
|
||
|
imports = [
|
||
|
inputs.nixvim.homeManagerModules.nixvim
|
||
|
];
|
||
|
programs.nixvim = {
|
||
|
extraPlugins = [ pkgs.vimPlugins.molokai ];
|
||
|
coloscheme = "molokai";
|
||
|
vimAlias = true;
|
||
|
highlight.Normal = {
|
||
|
ctermbg = "NONE";
|
||
|
guibg = "NONE";
|
||
|
};
|
||
|
options = {
|
||
|
number = true;
|
||
|
autoindent = true;
|
||
|
mouse = false;
|
||
|
encoding = "utf-8";
|
||
|
shiftwidth = 2;
|
||
|
smartindent = true;
|
||
|
tabstop = 2;
|
||
|
|
||
|
ignorecase = true;
|
||
|
incsearch = true;
|
||
|
smartcase = true;
|
||
|
};
|
||
|
keymaps = [
|
||
|
{
|
||
|
action = "<cmd>Neotree toggle<CR>";
|
||
|
key = "<C-n>";
|
||
|
mode = "n";
|
||
|
options.silent = true;
|
||
|
}
|
||
|
{
|
||
|
action = "<C-\\><C-n>";
|
||
|
key = "<esc>";
|
||
|
mode = "t";
|
||
|
}
|
||
|
];
|
||
|
plugins.nvim-cmp = {
|
||
|
enable = true;
|
||
|
sources = [
|
||
|
{ name = "nvim_lsp"; }
|
||
|
{ name = "luasnip"; }
|
||
|
{ name = "buffer"; }
|
||
|
{ name = "nvim_lua"; }
|
||
|
{ name = "path"; }
|
||
|
];
|
||
|
formatting = {
|
||
|
fields = [ "abbr" "kind" "menu" ];
|
||
|
format = ''
|
||
|
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
|
||
|
'';
|
||
|
};
|
||
|
snippet = { expand = "luasnip"; };
|
||
|
window = {
|
||
|
completion = {
|
||
|
winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
|
||
|
scrollbar = false;
|
||
|
sidePadding = 0;
|
||
|
border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ];
|
||
|
};
|
||
|
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>" = {
|
||
|
modes = [ "i" "s" ];
|
||
|
action = ''
|
||
|
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>" = {
|
||
|
modes = [ "i" "s" ];
|
||
|
action = ''
|
||
|
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
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
plugins.lsp = {
|
||
|
enable = true;
|
||
|
keymaps.lspBuf = {
|
||
|
"K" = "hover";
|
||
|
"gd" = "definition";
|
||
|
"gD" = "references";
|
||
|
"gt" = "type_definition";
|
||
|
"gi" = "implementation";
|
||
|
};
|
||
|
servers = {
|
||
|
bashls.enable = true;
|
||
|
lua-ls.enable = true;
|
||
|
nixd.enable = true;
|
||
|
ruff-lsp.enable = true;
|
||
|
};
|
||
|
};
|
||
|
plugins.none-ls = {
|
||
|
enable = true;
|
||
|
sources.diagnostics = {
|
||
|
pylint.enable = true;
|
||
|
shellcheck.enable = true;
|
||
|
statix.enable = true;
|
||
|
};
|
||
|
sources.formatting = {
|
||
|
nixfmt.enable = true;
|
||
|
markdownlint.enable = true;
|
||
|
rustfmt.enable = true;
|
||
|
};
|
||
|
};
|
||
|
plugins.neo-tree = {
|
||
|
enable = true;
|
||
|
closeIfLastWindow = true;
|
||
|
};
|
||
|
plugins.treesitter = {
|
||
|
enable = true;
|
||
|
nixGrammars = true;
|
||
|
indent = true;
|
||
|
};
|
||
|
plugins.cmp-buffer.enable = true;
|
||
|
plugins.cmp-emoji.enable = true;
|
||
|
plugins.cmp-nvim-lsp.enable = true;
|
||
|
plugins.cmp-path.enable = true;
|
||
|
plugins.cmp_luasnip.enable = true;
|
||
|
plugins.luasnip.enable = true;
|
||
|
plugins.lightline.enable = true;
|
||
|
plugins.rainbow-delimiters.enable = true;
|
||
|
plugins.rustaceanvim.enable = true;
|
||
|
plugins.treesitter-context.enable = true;
|
||
|
};
|
||
|
}
|