1
0
Fork 0
forked from emily/nixfiles
nixfiles-emily/config/profiles/graphical/nixvim.nix

215 lines
6.1 KiB
Nix
Raw Normal View History

2024-02-14 21:40:07 +01:00
{config, pkgs, inputs, ... }: {
2024-02-22 20:20:07 +01:00
home-manager.users.emily.imports = [
2024-02-14 21:40:07 +01:00
inputs.nixvim.homeManagerModules.nixvim
];
2024-02-22 20:20:07 +01:00
home-manager.users.emily.programs.nixvim = {
enable = true;
2024-03-24 19:57:02 +01:00
extraPlugins = [
pkgs.vimPlugins.molokai
pkgs.vimPlugins.vim-airline-themes
2024-02-29 21:24:55 +01:00
];
2024-02-22 20:20:07 +01:00
colorscheme = "molokai";
2024-02-14 21:40:07 +01:00
vimAlias = true;
2024-02-22 20:20:07 +01:00
highlightOverride.Normal = {
2024-02-14 21:40:07 +01:00
ctermbg = "NONE";
2024-02-22 20:20:07 +01:00
bg = "NONE";
2024-02-14 21:40:07 +01:00
};
2024-05-06 20:42:50 +02:00
opts = {
2024-02-14 21:40:07 +01:00
number = true;
2024-02-29 21:24:55 +01:00
expandtab = true;
2024-02-14 21:40:07 +01:00
autoindent = true;
2024-02-22 20:20:07 +01:00
mouse = "";
2024-02-14 21:40:07 +01:00
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";
}
];
2024-03-24 19:57:02 +01:00
plugins.cmp = {
2024-02-14 21:40:07 +01:00
enable = true;
2024-03-24 19:57:02 +01:00
settings.sources = [
2024-02-14 21:40:07 +01:00
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "nvim_lua"; }
{ name = "path"; }
];
2024-03-24 19:57:02 +01:00
settings.formatting = {
2024-02-14 21:40:07 +01:00
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
'';
};
2024-03-24 19:57:02 +01:00
settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
settings.window = {
2024-02-14 21:40:07 +01:00
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";
};
};
2024-03-24 19:57:02 +01:00
settings.mapping = {
2024-02-14 21:40:07 +01:00
"<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 })";
2024-03-24 19:57:02 +01:00
"<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()
2024-02-14 21:40:07 +01:00
end
2024-03-24 19:57:02 +01:00
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()
2024-02-14 21:40:07 +01:00
end
2024-03-24 19:57:02 +01:00
end,{"i","s"})
'';
2024-02-14 21:40:07 +01:00
};
};
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;
2024-02-28 22:43:20 +01:00
nixd = {
enable = true;
settings = {
eval.depth = 5;
eval.workers = 6;
formatting.command = "nixpkgs-fmt";
options.enable = true;
};
};
2024-02-14 21:40:07 +01:00
ruff-lsp.enable = true;
2024-05-06 20:42:50 +02:00
rust-analyzer = {
enable = true;
installRustc = true;
installCargo = true;
};
2024-02-14 21:40:07 +01:00
};
};
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;
};
2024-02-28 22:43:20 +01:00
plugins.airline.enable = true;
2024-02-14 21:40:07 +01:00
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;
2024-02-28 22:43:20 +01:00
plugins.nvim-autopairs.enable = true;
2024-02-14 21:40:07 +01:00
plugins.rainbow-delimiters.enable = true;
plugins.rustaceanvim.enable = true;
plugins.treesitter-context.enable = true;
};
}