You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nixfiles/config/profiles/graphical/nixvim.nix

211 lines
6.1 KiB
Nix

{config, pkgs, inputs, ... }: {
home-manager.users.emily.imports = [
inputs.nixvim.homeManagerModules.nixvim
];
home-manager.users.emily.programs.nixvim = {
enable = true;
extraPlugins = [
pkgs.vimPlugins.molokai
pkgs.vimPlugins.vim-airline-themes
];
colorscheme = "molokai";
vimAlias = true;
highlightOverride.Normal = {
ctermbg = "NONE";
bg = "NONE";
};
options = {
number = true;
expandtab = true;
autoindent = true;
mouse = "";
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.cmp = {
enable = true;
settings.sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "nvim_lua"; }
{ name = "path"; }
];
settings.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
'';
};
settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
settings.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";
};
};
settings.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>" = ''
cmp.mapping(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,{"i","s"})
'';
"<S-Tab>" = ''
cmp.mapping(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,{"i","s"})
'';
};
};
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;
settings = {
eval.depth = 5;
eval.workers = 6;
formatting.command = "nixpkgs-fmt";
options.enable = true;
};
};
ruff-lsp.enable = true;
rust-analyzer.enable = true;
};
};
plugins.none-ls = {
enable = true;
sources.diagnostics = {
pylint.enable = true;
statix.enable = true;
};
sources.formatting = {
nixfmt.enable = true;
markdownlint.enable = true;
};
};
plugins.neo-tree = {
enable = true;
closeIfLastWindow = true;
};
plugins.treesitter = {
enable = true;
nixGrammars = true;
indent = true;
};
plugins.airline.enable = 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.nvim-autopairs.enable = true;
plugins.rainbow-delimiters.enable = true;
plugins.rustaceanvim.enable = true;
plugins.treesitter-context.enable = true;
};
}