dotfiles/nix/configs/nvim.nix

261 lines
6.1 KiB
Nix
Raw Permalink Normal View History

{ pkgs, ... }: {
programs.nixvim = {
enable = true;
#TODO floaterm
# a snippet engine
plugins.luasnip = {
enable = true;
};
# TODO lsp_signature idk if it exists
#plugins.lsp_signature = {
# enable = true;
#};
2024-08-29 18:25:03 +02:00
plugins.none-ls = {
enable = true;
sources = {
code_actions = {
statix.enable = true;
gitsigns.enable = true;
};
diagnostics = {
statix.enable = true;
deadnix.enable = true;
pylint.enable = true;
checkstyle.enable = true;
};
formatting = {
alejandra.enable = true;
stylua.enable = true;
shfmt.enable = true;
nixpkgs_fmt.enable = true;
google_java_format.enable = false;
prettier = {
enable = true;
disableTsServerFormatter = true;
};
};
completion = {
luasnip.enable = true;
spell.enable = true;
};
};
};
plugins.lsp =
{
enable = true;
servers = {
# Average webdev LSPs
tsserver.enable = true; # TS/JS
cssls.enable = true; # CSS
tailwindcss.enable = true; # TailwindCSS
html.enable = true; # HTML
astro.enable = true; # AstroJS
phpactor.enable = true; # PHP
svelte.enable = false; # Svelte
vuels.enable = false; # Vue
pyright.enable = true; # Python
marksman.enable = true; # Markdown
nil-ls.enable = true; # Nix
dockerls.enable = true; # Docker
bashls.enable = true; # Bash
clangd.enable = true; # C/C++
csharp-ls.enable = true; # C#
yamlls.enable = true; # YAML
lua-ls = {
# Lua
enable = true;
settings.telemetry.enable = false;
};
# Rust
rust-analyzer = {
enable = true;
installRustc = false; # disabled so devshells work
installCargo = false; # disabled so devsellsh work
};
};
};
# Highlight word under cursor
plugins.illuminate = {
enable = true;
underCursor = false;
filetypesDenylist = [
"Outline"
"TelescopePrompt"
"alpha"
"harpoon"
"reason"
];
};
# Dashboard
plugins.alpha = {
enable = true;
theme = "dashboard";
iconsEnabled = true;
};
plugins.cmp = {
enable = true;
settings = {
autoEnableSources = true;
experimental = { ghost_text = true; };
performance = {
debounce = 60;
fetchingTimeout = 200;
maxViewEntries = 30;
};
snippet = { expand = "luasnip"; };
formatting = { fields = [ "kind" "abbr" "menu" ]; };
sources = [
{ name = "nvim_lsp"; }
{ name = "emoji"; }
{
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
# { name = "copilot"; } # enable/disable copilot
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
];
window = {
completion = { border = "solid"; };
documentation = { border = "solid"; };
};
mapping = {
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<C-j>" = "cmp.mapping.select_next_item()";
"<C-k>" = "cmp.mapping.select_prev_item()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
};
};
};
plugins.cmp-nvim-lsp = {
enable = true; # LSP
};
plugins.cmp-buffer = {
enable = true;
};
plugins.cmp-path = {
enable = true; # file system paths
};
plugins.cmp_luasnip = {
enable = true; # snippets
};
# TODO gen.nvim not in nixvim
# highlites colors (like #FFF)
plugins.nvim-colorizer = {
enable = true;
};
# todo-comments
2024-08-29 18:25:03 +02:00
plugins.todo-comments.enable = true;
# TODO feline-nvim and theme for it
# inline git blame
plugins.gitsigns = {
enable = true;
settings = {
current_line_blame = true;
trouble = true;
};
};
# inline error display
plugins.trouble = {
enable = true;
};
#plugins.nvimtree.enable = true;
# when adding " or any letter the selected word gets wrapped in it
plugins.surround.enable = true;
# file explorer
plugins.chadtree = {
enable = true;
};
2024-08-29 18:25:03 +02:00
# status bar
plugins.lualine = {
enable = true;
};
# a cool summary searcher
plugins.navbuddy.enable = true;
2024-08-29 18:25:03 +02:00
# a completion engine using LSP
# languages
plugins.rustaceanvim.enable = true;
plugins.nix.enable = true;
keymaps = [
{
key = "<leader>v";
action = "<cmd>CHADopen --always-focus<cr>";
}
{
key = "<leader>e";
action = "<cmd>CHADopen<cr>";
}
];
opts = {
number = true;
relativenumber = true;
};
globals.mapleader = " ";
# TODO shades of purple colorscheme
2024-08-29 18:25:03 +02:00
#extraPlugins = [ pkgs.vimPlugins.gruvbox ];
#colorscheme = "gruvbox";
# extraPlugins = [
# pkgs.vimUtils.buildVimPlugin
# {
# pname = "shades-of-purple";
# version = "1.1.1";
# src = pkgs.fetchFromGitHub {
# owner = "Rigellute";
# repo = "shades-of-purple.vim";
# rev = "e806d38190a6a2e8b9244824c2953d6567f141f3";
# hash = "sha256-iiGASgVlIXnnUNBlp9viKgDBfHiOP5P/yJx9XyELT9g=";
# };
# buildScript = ":";
# }
# ];
};
}