config/modules/neovim/default.nix

262 lines
6.8 KiB
Nix
Raw Normal View History

2025-05-12 15:19:01 -07:00
{
config,
2025-06-07 13:56:21 -07:00
pkgs,
2025-05-12 15:19:01 -07:00
lib,
...
}:
{
# based on default options from upstream:
# https://github.com/NotAShelf/nvf/blob/main/configuration.nix
#
# a full list of options is available too:
# https://notashelf.github.io/nvf/options.html
#
# override level 999 is used to not conflict with mkDefault as used by nvf.
# which allows user configurations to disable/override anything here.
2025-06-07 13:56:21 -07:00
config.vim = lib.mkOverride 999 {
2025-05-12 15:19:01 -07:00
theme = {
enable = true;
};
2025-07-05 21:04:38 -07:00
options = {
tabstop = 2;
softtabstop = 2;
shiftwidth = 2;
undofile = true;
swapfile = false;
showmode = false;
foldlevel = 99;
foldcolumn = "1";
foldlevelstart = 99;
foldenable = true;
foldmethod = "expr";
#Default to treesitter folding
foldexpr = "v:lua.vim.treesitter.foldexpr()";
};
2025-05-12 15:19:01 -07:00
visuals = {
# notification system
# https://github.com/j-hui/fidget.nvim
fidget-nvim.enable = true;
# highlight undo / paste / autoformat / macros
# https://github.com/tzachar/highlight-undo.nvim
highlight-undo.enable = true;
# indentation guides
# https://github.com/lukas-reineke/indent-blankline.nvim
2025-07-05 21:04:38 -07:00
indent-blankline.enable = true;
2025-05-12 15:19:01 -07:00
# extra icons
nvim-web-devicons.enable = true;
# https://github.com/petertriho/nvim-scrollbar
nvim-scrollbar.enable = false;
};
lsp = {
# Must be enabled for language modules to hook into the LSP API.
enable = true;
2025-07-05 21:04:38 -07:00
# enable debug adapter protocal by default
enableDAP = true;
2025-05-12 15:19:01 -07:00
formatOnSave = true;
# show errors inline
# https://github.com/folke/trouble.nvim
trouble.enable = true;
# show lightbulb icon in gutter to indicate code actions
# https://github.com/kosayoda/nvim-lightbulb
2025-07-05 21:04:38 -07:00
lightbulb.enable = false;
2025-05-12 15:19:01 -07:00
# show icons in auto-completion menu
# https://github.com/onsails/lspkind.nvim
lspkind.enable = config.vim.autocomplete.blink-cmp.enable;
2025-07-05 21:04:38 -07:00
# Enables inlay hints (types info in rust and shit)
inlayHints.enable = true;
#Nice mappings that i use :3
mappings = {
codeAction = "<leader>ca";
goToDeclaration = "gD";
goToDefinition = "gd";
listReferences = "gr";
goToType = "gy";
hover = "K";
nextDiagnostic = "<leader>d";
openDiagnosticFloat = "<leader>df";
renameSymbol = "rn";
documentHighlight = null;
listDocumentSymbols = null;
listImplementations = null;
listWorkspaceFolders = null;
previousDiagnostic = null;
removeWorkspaceFolder = null;
signatureHelp = null;
toggleFormatOnSave = null;
};
2025-05-12 15:19:01 -07:00
};
2025-05-27 19:12:01 -07:00
treesitter = {
enable = true;
addDefaultGrammars = true;
};
2025-05-12 15:19:01 -07:00
debugger = {
nvim-dap = {
enable = true;
ui.enable = true;
};
};
languages = {
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
# sort-lines: on
bash.enable = true;
clang.enable = true;
css.enable = true;
html.enable = true;
2025-05-27 19:12:01 -07:00
markdown.enable = true;
2025-05-12 15:19:01 -07:00
nix.enable = true;
2025-05-27 19:12:01 -07:00
python.enable = true;
2025-05-12 15:19:01 -07:00
rust.crates.enable = true;
rust.enable = true;
ts.enable = true;
zig.enable = true;
2025-07-05 21:04:38 -07:00
lua.enable = true;
2025-05-12 15:19:01 -07:00
# sort-lines: off
2025-06-07 13:56:21 -07:00
ts.format.enable = false; # deno fmt is enabled elsewhere
2025-05-12 15:19:01 -07:00
nix.format.type = "nixfmt"; # looks so much nicer
};
2025-06-07 13:56:21 -07:00
formatter.conform-nvim = {
enable = true;
setupOpts.formatters_by_ft = {
typescript = [ "deno_fmt" ];
typescriptreact = [ "deno_fmt" ];
javascript = [ "deno_fmt" ];
javascriptreact = [ "deno_fmt" ];
};
setupOpts.formatters.deno_fmt = {
command = lib.meta.getExe pkgs.deno;
};
};
2025-05-12 15:19:01 -07:00
filetree = {
neo-tree = {
2025-05-20 21:30:54 -07:00
enable = false;
2025-05-12 15:19:01 -07:00
};
};
tabline = {
nvimBufferline.enable = true;
};
autocomplete = {
2025-05-19 21:42:58 -07:00
blink-cmp = {
enable = true;
sourcePlugins = {
ripgrep.enable = true;
};
friendly-snippets.enable = true;
};
2025-05-12 15:19:01 -07:00
};
statusline = {
lualine = {
enable = true;
refresh = {
statusline = 100;
tabline = 100;
winbar = 100;
};
};
};
2025-05-19 21:42:58 -07:00
utility = {
snacks-nvim = {
enable = true;
setupOpts = {
bigfile.enable = true;
explorer.replace_netrw = true;
dashboard = {
2025-05-27 19:12:01 -07:00
preset.keys = [
2025-05-19 21:42:58 -07:00
{
2025-05-27 19:12:01 -07:00
icon = " ";
key = "n";
desc = "New File";
action = ":ene | startinsert";
2025-05-19 21:42:58 -07:00
}
{
2025-05-27 19:12:01 -07:00
icon = " ";
key = "r";
desc = "Recent Files";
action = ":lua Snacks.dashboard.pick('oldfiles')";
}
];
sections = [
{ section = "header"; }
{
section = "keys";
2025-05-19 21:42:58 -07:00
indent = 2;
padding = 1;
}
{
icon = " ";
title = "Projects";
section = "projects";
indent = 2;
padding = 1;
}
2025-05-27 19:12:01 -07:00
{
icon = " ";
title = "Git";
section = "terminal";
enabled = lib.options.literalExpression ''
function()
return Snacks.git.get_root() ~= nil
end
'';
cmd = "git status --short --branch --renames";
height = 10;
padding = 1;
ttl = 5 * 60;
indent = 3;
}
2025-05-19 21:42:58 -07:00
];
};
2025-05-27 19:56:17 -07:00
image = {
enable = true;
math.enabled = false;
};
2025-05-19 21:42:58 -07:00
notifier.timeout = 3000;
picker = {
enable = true;
sources = {
2025-05-27 19:12:01 -07:00
explorer = { };
2025-05-19 21:42:58 -07:00
};
};
};
};
};
2025-05-12 15:19:01 -07:00
binds = {
whichKey.enable = true;
cheatsheet.enable = true;
};
ui = {
borders.enable = true;
# https://github.com/norcalli/nvim-colorizer.lua
colorizer.enable = true;
# https://github.com/RRethy/vim-illuminate
illuminate.enable = true;
breadcrumbs = {
enable = false;
navbuddy.enable = config.vim.ui.breadcrumbs.enable;
};
};
notes = {
todo-comments.enable = true;
};
git = {
enable = true;
gitsigns.enable = true;
gitsigns.codeActions.enable = false; # throws an annoying debug message
};
2025-07-05 21:04:38 -07:00
# Better help docs
lazy.plugins."helpview.nvim" = {
enabled = true;
package = pkgs.vimPlugins.helpview-nvim;
lazy = false;
};
2025-05-12 15:19:01 -07:00
};
}