2023-04-25 09:50:25 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
2023-12-06 22:03:27 +01:00
|
|
|
let
|
|
|
|
cfg = config.programs.v.nvim;
|
|
|
|
cmp-vimtex = pkgs.vimUtils.buildVimPlugin {
|
|
|
|
name = "cmp-vimtex";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "micangl";
|
|
|
|
repo = "cmp-vimtex";
|
|
|
|
rev = "2b5089a79b29418e6afcdc7804d2b9f2f002946b";
|
|
|
|
hash = "sha256-IcXjCNXfiV8WMP4S41uy3C9OsKUi3zJnvg5MJVu3Khw=";
|
|
|
|
};
|
|
|
|
};
|
2023-04-25 09:50:25 +02:00
|
|
|
in {
|
2023-05-04 13:08:10 +02:00
|
|
|
options.programs.v.nvim = { enable = mkEnableOption "nvim"; };
|
2023-04-25 09:50:25 +02:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.nixvim = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.neovim-unwrapped;
|
|
|
|
vimAlias = true;
|
2023-12-06 22:03:27 +01:00
|
|
|
luaLoader.enable = true;
|
2023-04-25 09:50:25 +02:00
|
|
|
|
2023-10-25 13:56:15 +02:00
|
|
|
globals.mapleader = " ";
|
|
|
|
|
|
|
|
options.number = true;
|
|
|
|
|
2023-12-06 22:03:27 +01:00
|
|
|
clipboard = { providers.wl-copy.enable = true; };
|
|
|
|
|
2023-10-25 13:56:15 +02:00
|
|
|
keymaps = [
|
|
|
|
{
|
|
|
|
mode = "n";
|
2023-10-31 17:56:38 +01:00
|
|
|
key = "<leader>ff";
|
|
|
|
action = "require('telescope.builtin').find_files";
|
2023-10-25 13:56:15 +02:00
|
|
|
lua = true;
|
|
|
|
}
|
|
|
|
{
|
2023-10-31 17:56:38 +01:00
|
|
|
mode = "n";
|
2023-10-25 13:56:15 +02:00
|
|
|
key = "<leader>fg";
|
2023-10-31 17:56:38 +01:00
|
|
|
action = "require('telescope.builtin').live_grep";
|
|
|
|
lua = true;
|
|
|
|
}
|
|
|
|
{
|
2023-10-25 13:56:15 +02:00
|
|
|
mode = "n";
|
2023-10-31 17:56:38 +01:00
|
|
|
key = "<C-_>";
|
|
|
|
action = "require('Comment.api').toggle.linewise.current";
|
2023-10-25 13:56:15 +02:00
|
|
|
lua = true;
|
|
|
|
}
|
2023-12-06 22:03:27 +01:00
|
|
|
{
|
|
|
|
mode = "x";
|
|
|
|
key = "<C-_>";
|
|
|
|
action = ''
|
|
|
|
function()
|
|
|
|
require('Comment.api').toggle.linewise(vim.fn.visualmode())
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
lua = true;
|
|
|
|
}
|
2023-10-25 13:56:15 +02:00
|
|
|
{
|
|
|
|
mode = "n";
|
2023-10-31 17:56:38 +01:00
|
|
|
key = "g=";
|
|
|
|
action = "vim.lsp.buf.format";
|
2023-10-25 13:56:15 +02:00
|
|
|
lua = true;
|
|
|
|
}
|
|
|
|
];
|
2023-04-25 09:50:25 +02:00
|
|
|
|
2023-12-06 22:03:27 +01:00
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
|
|
|
FixCursorHold-nvim
|
|
|
|
cmp-vimtex
|
|
|
|
luasnip
|
|
|
|
plenary-nvim
|
|
|
|
neotest
|
|
|
|
neotest-plenary
|
|
|
|
neotest-rust
|
|
|
|
];
|
2023-04-25 09:50:25 +02:00
|
|
|
|
2023-12-06 22:03:27 +01:00
|
|
|
colorschemes.catppuccin = {
|
|
|
|
enable = true;
|
|
|
|
flavour = "frappe";
|
|
|
|
};
|
2023-04-25 09:50:25 +02:00
|
|
|
|
2023-12-06 22:03:27 +01:00
|
|
|
extraConfigLua = ''
|
|
|
|
require("neotest").setup({
|
|
|
|
adapters = {
|
|
|
|
require("neotest-plenary"),
|
|
|
|
require("neotest-rust") {
|
|
|
|
args = { "--no-capture" },
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
'';
|
2023-04-25 09:50:25 +02:00
|
|
|
|
|
|
|
plugins = {
|
|
|
|
bufferline.enable = true;
|
2023-10-25 13:56:15 +02:00
|
|
|
none-ls = {
|
2023-05-30 09:58:17 +02:00
|
|
|
enable = true;
|
|
|
|
sources = {
|
|
|
|
formatting.nixpkgs_fmt.enable = true;
|
|
|
|
code_actions.shellcheck.enable = true;
|
|
|
|
code_actions.statix.enable = true;
|
|
|
|
diagnostics = {
|
|
|
|
statix.enable = true;
|
|
|
|
deadnix.enable = true;
|
|
|
|
shellcheck.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-04-25 09:50:25 +02:00
|
|
|
nix.enable = true;
|
|
|
|
treesitter = {
|
|
|
|
enable = true;
|
|
|
|
nixGrammars = true;
|
2023-12-06 22:03:27 +01:00
|
|
|
disabledLanguages = [ "latex" ];
|
2023-04-25 09:50:25 +02:00
|
|
|
};
|
|
|
|
surround.enable = true;
|
|
|
|
fugitive.enable = true;
|
|
|
|
gitgutter.enable = true;
|
|
|
|
lualine = {
|
|
|
|
enable = true;
|
|
|
|
theme = "catppuccin";
|
|
|
|
};
|
|
|
|
telescope = {
|
|
|
|
enable = true;
|
|
|
|
extensions.fzf-native.enable = true;
|
|
|
|
extensions.fzf-native.fuzzy = true;
|
|
|
|
};
|
|
|
|
comment-nvim = { enable = true; };
|
|
|
|
lsp = {
|
|
|
|
enable = true;
|
2023-09-25 11:56:02 +02:00
|
|
|
servers = {
|
|
|
|
nil_ls.enable = true;
|
2023-12-06 22:03:27 +01:00
|
|
|
rust-analyzer = {
|
|
|
|
installCargo = false;
|
|
|
|
installRustc = false;
|
|
|
|
};
|
2023-09-25 11:56:02 +02:00
|
|
|
pyright.enable = true;
|
|
|
|
elixirls.enable = true;
|
|
|
|
clangd.enable = true;
|
|
|
|
yamlls.enable = true;
|
|
|
|
};
|
2023-04-25 09:50:25 +02:00
|
|
|
};
|
|
|
|
trouble.enable = true;
|
|
|
|
lspkind.enable = true;
|
2023-12-06 22:03:27 +01:00
|
|
|
|
|
|
|
vimtex.enable = true;
|
|
|
|
|
2023-04-25 09:50:25 +02:00
|
|
|
nvim-cmp = {
|
|
|
|
enable = true;
|
|
|
|
autoEnableSources = true;
|
|
|
|
sources = [
|
|
|
|
{ name = "nvim_lsp"; }
|
2023-12-06 22:03:27 +01:00
|
|
|
{
|
|
|
|
name = "vimtex";
|
|
|
|
}
|
|
|
|
# { name = "cmp-latex-symbols"; }
|
2023-04-25 09:50:25 +02:00
|
|
|
{
|
|
|
|
name = "luasnip";
|
|
|
|
option = { show_autosnippets = true; };
|
|
|
|
}
|
|
|
|
{ name = "cmp-spell"; }
|
|
|
|
{ name = "cmp-rg"; }
|
|
|
|
{ name = "path"; }
|
|
|
|
{ name = "buffer"; }
|
|
|
|
];
|
|
|
|
snippet.expand = "luasnip";
|
|
|
|
mappingPresets = [ "insert" "cmdline" ];
|
|
|
|
mapping = {
|
|
|
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
|
|
|
"<Tab>" = {
|
|
|
|
modes = [ "i" "s" ];
|
|
|
|
action = ''
|
|
|
|
function(fallback)
|
|
|
|
local luasnip = require('luasnip')
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_next_item()
|
|
|
|
elseif luasnip.expandable() then
|
|
|
|
luasnip.expand()
|
|
|
|
elseif luasnip.expand_or_jumpable() then
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|