aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/nixvim
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@proton.me>2026-04-24 01:48:30 +0530
committerArpit Chakladar <arpitchakladar@proton.me>2026-04-24 01:48:30 +0530
commit3e232a2bc7f5c8ea33804be1ea071a91c5f98055 (patch)
treef772b5d7d393cacf708d845acb75b55c12d3e625 /modules/programs/nixvim
parent606716e0a4b8cbeb9076fb88b6b92664a5a24081 (diff)
downloadhome-manager-config-3e232a2bc7f5c8ea33804be1ea071a91c5f98055.tar.gz
home-manager-config-3e232a2bc7f5c8ea33804be1ea071a91c5f98055.zip
replacing tools with programs to be more consistent with config options
Diffstat (limited to 'modules/programs/nixvim')
-rw-r--r--modules/programs/nixvim/colorscheme.nix26
-rw-r--r--modules/programs/nixvim/default.nix83
-rw-r--r--modules/programs/nixvim/keymaps.nix41
-rw-r--r--modules/programs/nixvim/plugins/cmp.nix37
-rw-r--r--modules/programs/nixvim/plugins/comment.nix23
-rw-r--r--modules/programs/nixvim/plugins/default.nix20
-rw-r--r--modules/programs/nixvim/plugins/gitsigns.nix8
-rw-r--r--modules/programs/nixvim/plugins/indent-blankline.nix14
-rw-r--r--modules/programs/nixvim/plugins/lsp.nix91
-rw-r--r--modules/programs/nixvim/plugins/lualine.nix90
-rw-r--r--modules/programs/nixvim/plugins/luasnip.nix8
-rw-r--r--modules/programs/nixvim/plugins/noice.nix19
-rw-r--r--modules/programs/nixvim/plugins/nvim-tree.nix44
-rw-r--r--modules/programs/nixvim/plugins/telescope.nix85
-rw-r--r--modules/programs/nixvim/plugins/treesitter.nix19
-rw-r--r--modules/programs/nixvim/plugins/web-devicons.nix8
-rw-r--r--modules/programs/nixvim/plugins/which-key.nix21
17 files changed, 637 insertions, 0 deletions
diff --git a/modules/programs/nixvim/colorscheme.nix b/modules/programs/nixvim/colorscheme.nix
new file mode 100644
index 0000000..ba81634
--- /dev/null
+++ b/modules/programs/nixvim/colorscheme.nix
@@ -0,0 +1,26 @@
+{ config, lib, ... }:
+
+# Colorscheme - Base16 theme configuration for nixvim
+{
+ config.programs.nixvim.colorschemes.base16 = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ colorscheme = with config.scheme.withHashtag; {
+ base00 = base00;
+ base01 = base01;
+ base02 = base02;
+ base03 = base03;
+ base04 = base04;
+ base05 = base05;
+ base06 = base06;
+ base07 = base07;
+ base08 = base08;
+ base09 = base09;
+ base0A = base0A;
+ base0B = base0B;
+ base0C = base0C;
+ base0D = base0D;
+ base0E = base0E;
+ base0F = base0F;
+ };
+ };
+}
diff --git a/modules/programs/nixvim/default.nix b/modules/programs/nixvim/default.nix
new file mode 100644
index 0000000..1a66b47
--- /dev/null
+++ b/modules/programs/nixvim/default.nix
@@ -0,0 +1,83 @@
+{ config, lib, ... }:
+
+# Nixvim - Neovim configured through Nix (home-manager integration)
+{
+ imports = [
+ ./colorscheme.nix
+ ./keymaps.nix
+ ./plugins
+ ];
+
+ options.programs.nixvim = {
+ enable = lib.mkEnableOption "Enables nixvim.";
+ };
+
+ config = lib.mkIf config.programs.nixvim.enable {
+ programs.nixvim = {
+ defaultEditor = true;
+ opts = {
+ number = true;
+ relativenumber = true;
+ shiftwidth = 2;
+ tabstop = 2;
+ softtabstop = 2;
+ expandtab = true;
+ list = true;
+ laststatus = 3;
+ foldlevel = 99;
+ clipboard = "unnamedplus";
+ };
+ clipboard.providers.xclip.enable = true;
+ extraConfigLuaPre = with config.scheme.withHashtag; ''
+ vim.opt.fillchars:append({ eob = " " })
+ vim.opt.listchars = { tab = " ", trail = "_", lead = " " }
+ vim.api.nvim_set_hl(0, "WinSeparator", {
+ fg = "${base01}",
+ bg = "${base00}",
+ })
+ vim.api.nvim_set_hl(0, 'NotifyERRORBorder', { fg = '${base08}' })
+ vim.api.nvim_set_hl(0, 'NotifyWARNBorder', { fg = '${base09}' })
+ vim.api.nvim_set_hl(0, 'NotifyINFOBorder', { fg = '${base0B}' })
+ vim.api.nvim_set_hl(0, 'NotifyDEBUGBorder', { fg = '${base03}' })
+ vim.api.nvim_set_hl(0, 'NotifyTRACEBorder', { fg = '${base0E}' })
+
+ vim.api.nvim_set_hl(0, 'NotifyERRORIcon', { fg = '${base08}' })
+ vim.api.nvim_set_hl(0, 'NotifyWARNIcon', { fg = '${base09}' })
+ vim.api.nvim_set_hl(0, 'NotifyINFOIcon', { fg = '${base0B}' })
+ vim.api.nvim_set_hl(0, 'NotifyDEBUGIcon', { fg = '${base03}' })
+ vim.api.nvim_set_hl(0, 'NotifyTRACEIcon', { fg = '${base0E}' })
+
+ vim.api.nvim_set_hl(0, 'NotifyERRORTitle', { fg = '${base08}' })
+ vim.api.nvim_set_hl(0, 'NotifyWARNTitle', { fg = '${base09}' })
+ vim.api.nvim_set_hl(0, 'NotifyINFOTitle', { fg = '${base0B}' })
+ vim.api.nvim_set_hl(0, 'NotifyDEBUGTitle', { fg = '${base03}' })
+ vim.api.nvim_set_hl(0, 'NotifyTRACETitle', { fg = '${base0E}' })
+
+ vim.api.nvim_set_hl(0, 'NotifyERRORBody', { link = 'Normal' })
+ vim.api.nvim_set_hl(0, 'NotifyWARNBody', { link = 'Normal' })
+ vim.api.nvim_set_hl(0, 'NotifyINFOBody', { link = 'Normal' })
+ vim.api.nvim_set_hl(0, 'NotifyDEBUGBody', { link = 'Normal' })
+ vim.api.nvim_set_hl(0, 'NotifyTRACEBody', { link = 'Normal' })
+
+ vim.api.nvim_create_autocmd({ "FileType" }, {
+ pattern = { "yaml", "yml" },
+ callback = function()
+ vim.opt_local.expandtab = true
+ vim.opt_local.shiftwidth = 2
+ vim.opt_local.softtabstop = 2
+ vim.opt_local.tabstop = 2
+ end,
+ })
+ '';
+ performance = {
+ byteCompileLua.enable = true;
+ combinePlugins.enable = true;
+ };
+ };
+
+ home.sessionVariables = {
+ EDITOR = lib.mkForce (lib.getExe config.programs.nixvim.package);
+ MANPAGER = "${lib.getExe config.programs.nixvim.package} +Man!";
+ };
+ };
+}
diff --git a/modules/programs/nixvim/keymaps.nix b/modules/programs/nixvim/keymaps.nix
new file mode 100644
index 0000000..4e4b35a
--- /dev/null
+++ b/modules/programs/nixvim/keymaps.nix
@@ -0,0 +1,41 @@
+{ config, lib, ... }:
+
+# Keymaps - Keyboard shortcut configuration for nixvim
+{
+ config.programs.nixvim.keymaps = lib.mkIf config.programs.nixvim.enable [
+ {
+ key = "<c-h>";
+ action = "<c-w>h";
+ options.desc = "Move to left window";
+ }
+ {
+ key = "<c-w>";
+ action = "<c-w>j";
+ options.desc = "Move to bottom window";
+ }
+ {
+ key = "<c-k>";
+ action = "<c-w>k";
+ options.desc = "Move to top window";
+ }
+ {
+ key = "<c-l>";
+ action = "<c-w>l";
+ options.desc = "Move to right window";
+ }
+ {
+ key = "<c-n>";
+ action = "<cmd>NvimTreeToggle<cr>";
+ mode = [
+ "n"
+ "i"
+ ];
+ options.desc = "Toggle file explorer";
+ }
+ {
+ key = "<c-c>";
+ action = "<cmd>NotificationsClear<cr>";
+ options.desc = "Clear notifications";
+ }
+ ];
+}
diff --git a/modules/programs/nixvim/plugins/cmp.nix b/modules/programs/nixvim/plugins/cmp.nix
new file mode 100644
index 0000000..683e0d3
--- /dev/null
+++ b/modules/programs/nixvim/plugins/cmp.nix
@@ -0,0 +1,37 @@
+{ config, lib, ... }:
+
+# Cmp - Completion plugin (nvim-cmp) for auto-completion
+{
+ config.programs.nixvim.plugins.cmp = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ autoEnableSources = true;
+ settings = {
+ snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
+ mapping = {
+ "<C-Space>" = "cmp.mapping.complete()";
+ "<CR>" = "cmp.mapping.confirm({ select = true })";
+ "<Tab>" = "cmp.mapping.select_next_item()";
+ "<S-Tab>" = "cmp.mapping.select_prev_item()";
+ "<Down>" = "cmp.mapping.select_next_item()";
+ "<Up>" = "cmp.mapping.select_prev_item()";
+ "<C-u>" = "cmp.mapping.scroll_docs(-4)"; # scroll docs up
+ "<C-d>" = "cmp.mapping.scroll_docs(4)"; # scroll docs down
+
+ "<Escape>" = ''
+ cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.abort()
+ else
+ fallback()
+ end
+ end, { "i" })
+ '';
+ };
+ sources = [
+ { name = "nvim_lsp"; }
+ { name = "path"; }
+ { name = "buffer"; }
+ ];
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/comment.nix b/modules/programs/nixvim/plugins/comment.nix
new file mode 100644
index 0000000..cc1b9cb
--- /dev/null
+++ b/modules/programs/nixvim/plugins/comment.nix
@@ -0,0 +1,23 @@
+{ config, lib, ... }:
+
+# Comment - Comment toggling plugin (comment.nvim)
+{
+ config.programs.nixvim.plugins.comment = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ settings = {
+ toggler = {
+ line = "gcc"; # toggle line comment
+ block = "gbc"; # toggle block comment
+ };
+ opleader = {
+ line = "gc"; # line comment operator (gc + motion)
+ block = "gb"; # block comment operator (gb + motion)
+ };
+ extra = {
+ above = "gcO"; # add comment line above
+ below = "gco"; # add comment line below
+ eol = "gcA"; # add comment at end of line
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/default.nix b/modules/programs/nixvim/plugins/default.nix
new file mode 100644
index 0000000..a263c51
--- /dev/null
+++ b/modules/programs/nixvim/plugins/default.nix
@@ -0,0 +1,20 @@
+{ ... }:
+
+# Plugins - Collection of nixvim plugin configurations
+{
+ imports = [
+ ./cmp.nix
+ ./comment.nix
+ ./gitsigns.nix
+ ./indent-blankline.nix
+ ./lsp.nix
+ ./lualine.nix
+ ./luasnip.nix
+ ./noice.nix
+ ./nvim-tree.nix
+ ./telescope.nix
+ ./treesitter.nix
+ ./web-devicons.nix
+ ./which-key.nix
+ ];
+}
diff --git a/modules/programs/nixvim/plugins/gitsigns.nix b/modules/programs/nixvim/plugins/gitsigns.nix
new file mode 100644
index 0000000..ea99eba
--- /dev/null
+++ b/modules/programs/nixvim/plugins/gitsigns.nix
@@ -0,0 +1,8 @@
+{ config, lib, ... }:
+
+# Gitsigns - Git status in the sign column (gitsigns.nvim)
+{
+ config.programs.nixvim.plugins.gitsigns = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ };
+}
diff --git a/modules/programs/nixvim/plugins/indent-blankline.nix b/modules/programs/nixvim/plugins/indent-blankline.nix
new file mode 100644
index 0000000..eb2674a
--- /dev/null
+++ b/modules/programs/nixvim/plugins/indent-blankline.nix
@@ -0,0 +1,14 @@
+{ config, lib, ... }:
+
+# Indent-blankline - Visual indentation guides (indent-blankline.nvim)
+{
+ config.programs.nixvim.plugins.indent-blankline = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ settings = {
+ indent = {
+ char = "┊";
+ tab_char = "│";
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/lsp.nix b/modules/programs/nixvim/plugins/lsp.nix
new file mode 100644
index 0000000..dbe66a8
--- /dev/null
+++ b/modules/programs/nixvim/plugins/lsp.nix
@@ -0,0 +1,91 @@
+{ config, lib, ... }:
+
+# LSP - Language Server Protocol configuration (nvim-lspconfig)
+{
+ config.programs.nixvim = lib.mkIf config.programs.nixvim.enable {
+ plugins.lsp = {
+ enable = true;
+ inlayHints = true;
+ autoLoad = true;
+ keymaps.lspBuf = {
+ K = "hover";
+ gD = "references";
+ gd = "definition";
+ gi = "implementation";
+ gt = "type_definition";
+ };
+ servers = {
+ nil_ls = {
+ enable = true;
+ };
+ lua_ls = {
+ enable = true;
+ package = null;
+ };
+ nixd = {
+ enable = true;
+ package = null;
+ };
+ pyright = {
+ enable = true;
+ package = null;
+ };
+ ts_ls = {
+ enable = true;
+ package = null;
+ };
+ clangd = {
+ enable = true;
+ package = null;
+ };
+ jsonls = {
+ enable = true;
+ package = null;
+ };
+ yamlls = {
+ enable = true;
+ package = null;
+ };
+ bash-language-server = {
+ enable = true;
+ package = null;
+ };
+ gopls = {
+ enable = true;
+ package = null;
+ };
+ };
+ };
+
+ diagnostic = {
+ settings = {
+ virtual_text = false;
+ signs = true;
+ underline = true;
+ update_in_insert = false;
+ float = {
+ border = "rounded";
+ source = true; # Show which LSP the diagnostic is from
+ header = "";
+ prefix = "";
+ };
+ };
+ };
+
+ # Show diagnostics float on cursor hold
+ autoCmd = [
+ {
+ event = [ "CursorHold" ];
+ pattern = "*";
+ callback.__raw = ''
+ function()
+ vim.diagnostic.open_float(nil, { focus = false })
+ end
+ '';
+ }
+ ];
+
+ # How long before CursorHold fires (in ms)
+ opts.updatetime = 500;
+ };
+}
diff --git a/modules/programs/nixvim/plugins/lualine.nix b/modules/programs/nixvim/plugins/lualine.nix
new file mode 100644
index 0000000..72f34be
--- /dev/null
+++ b/modules/programs/nixvim/plugins/lualine.nix
@@ -0,0 +1,90 @@
+{ config, lib, ... }:
+
+# Lualine - Statusline configuration (lualine.nvim)
+{
+ config.programs.nixvim.plugins.lualine = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ settings = {
+ options = {
+ theme = with config.scheme.withHashtag; {
+ normal = {
+ a = {
+ fg = base00;
+ bg = base0D;
+ gui = "bold";
+ };
+ b = {
+ fg = base05;
+ bg = base01;
+ };
+ c = {
+ fg = base05;
+ bg = base00;
+ };
+ };
+ insert = {
+ a = {
+ fg = base00;
+ bg = base0B;
+ gui = "bold";
+ };
+ b = {
+ fg = base05;
+ bg = base01;
+ };
+ c = {
+ fg = base05;
+ bg = base00;
+ };
+ };
+ visual = {
+ a = {
+ fg = base00;
+ bg = base0A;
+ gui = "bold";
+ };
+ b = {
+ fg = base05;
+ bg = base01;
+ };
+ c = {
+ fg = base05;
+ bg = base00;
+ };
+ };
+ replace = {
+ a = {
+ fg = base00;
+ bg = base08;
+ gui = "bold";
+ };
+ b = {
+ fg = base05;
+ bg = base01;
+ };
+ c = {
+ fg = base05;
+ bg = base00;
+ };
+ };
+ inactive = {
+ a = {
+ fg = base04;
+ bg = base00;
+ gui = "bold";
+ };
+ b = {
+ fg = base04;
+ bg = base00;
+ };
+ c = {
+ fg = base04;
+ bg = base00;
+ };
+ };
+ };
+ icons_enabled = true;
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/luasnip.nix b/modules/programs/nixvim/plugins/luasnip.nix
new file mode 100644
index 0000000..60571e9
--- /dev/null
+++ b/modules/programs/nixvim/plugins/luasnip.nix
@@ -0,0 +1,8 @@
+{ config, lib, ... }:
+
+# Luasnip - Snippet engine for Neovim (Lua-based)
+{
+ config.programs.nixvim.plugins.luasnip = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ };
+}
diff --git a/modules/programs/nixvim/plugins/noice.nix b/modules/programs/nixvim/plugins/noice.nix
new file mode 100644
index 0000000..61acf2a
--- /dev/null
+++ b/modules/programs/nixvim/plugins/noice.nix
@@ -0,0 +1,19 @@
+{ config, lib, ... }:
+
+# Noice - Modern UI for Neovim (cmdline, popupmenu, messages)
+{
+ config.programs.nixvim.plugins.noice = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ cmdline = {
+ enabled = true;
+ view = "cmdline_popup";
+ };
+ popupmenu = {
+ enabled = true;
+ backend = "cmp";
+ };
+ presets = {
+ command_palette = true;
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/nvim-tree.nix b/modules/programs/nixvim/plugins/nvim-tree.nix
new file mode 100644
index 0000000..2ad6570
--- /dev/null
+++ b/modules/programs/nixvim/plugins/nvim-tree.nix
@@ -0,0 +1,44 @@
+{ config, lib, ... }:
+
+# Nvim-tree - File explorer sidebar (nvim-tree.lua)
+{
+ config.programs.nixvim.plugins.nvim-tree = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ settings = {
+ filters = {
+ dotfiles = false;
+ git_clean = false;
+ no_buffer = false;
+ custom = { };
+ };
+ git = {
+ enable = true;
+ ignore = false;
+ };
+ view = {
+ width = 30;
+ };
+ renderer = {
+ indent_markers = {
+ enable = true;
+ inline_arrows = false;
+ icons = {
+ corner = "└";
+ edge = "│";
+ item = "├";
+ bottom = "─";
+ none = " ";
+ };
+ };
+ icons = {
+ show = {
+ folder = true;
+ folder_arrow = false;
+ file = true;
+ git = true;
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/telescope.nix b/modules/programs/nixvim/plugins/telescope.nix
new file mode 100644
index 0000000..b9678fc
--- /dev/null
+++ b/modules/programs/nixvim/plugins/telescope.nix
@@ -0,0 +1,85 @@
+{ config, lib, ... }:
+
+# Telescope - Fuzzy finder
+{
+ config.programs.nixvim.plugins.telescope = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ extensions = {
+ fzf-native.enable = true; # faster fuzzy sorting
+ ui-select.enable = true; # use telescope for vim.ui.select (code actions etc.)
+ };
+ settings = {
+ defaults = {
+ layout_strategy = "horizontal";
+ layout_config = {
+ horizontal = {
+ preview_width = 0.55;
+ results_width = 0.45;
+ };
+ width = 0.87;
+ height = 0.80;
+ };
+ mappings = {
+ i = {
+ "<C-k>".__raw = "require('telescope.actions').move_selection_previous";
+ "<C-j>".__raw = "require('telescope.actions').move_selection_next";
+ "<Escape>".__raw = "require('telescope.actions').close";
+ };
+ };
+ };
+ };
+ keymaps = {
+ # Files
+ "<leader>ff" = {
+ action = "find_files";
+ options.desc = "Find files";
+ };
+ "<leader>fg" = {
+ action = "live_grep";
+ options.desc = "Live grep";
+ };
+ "<leader>fb" = {
+ action = "buffers";
+ options.desc = "Find buffers";
+ };
+ "<leader>fr" = {
+ action = "oldfiles";
+ options.desc = "Recent files";
+ };
+
+ # LSP
+ "<leader>fd" = {
+ action = "diagnostics";
+ options.desc = "Diagnostics";
+ };
+ "<leader>fs" = {
+ action = "lsp_document_symbols";
+ options.desc = "Document symbols";
+ };
+
+ # Git
+ "<leader>gc" = {
+ action = "git_commits";
+ options.desc = "Git commits";
+ };
+ "<leader>gb" = {
+ action = "git_branches";
+ options.desc = "Git branches";
+ };
+
+ # Misc
+ "<leader>fh" = {
+ action = "help_tags";
+ options.desc = "Help tags";
+ };
+ "<leader>fc" = {
+ action = "commands";
+ options.desc = "Commands";
+ };
+ "<leader>fk" = {
+ action = "keymaps";
+ options.desc = "Find keymaps";
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/treesitter.nix b/modules/programs/nixvim/plugins/treesitter.nix
new file mode 100644
index 0000000..035ac7a
--- /dev/null
+++ b/modules/programs/nixvim/plugins/treesitter.nix
@@ -0,0 +1,19 @@
+{ config, lib, ... }:
+
+# Treesitter - Syntax highlighting and parsing (nvim-treesitter)
+{
+ config.programs.nixvim.plugins.treesitter = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ folding = {
+ enable = true;
+ };
+ settings = {
+ highlight = {
+ enable = true;
+ };
+ indent = {
+ enable = true;
+ };
+ };
+ };
+}
diff --git a/modules/programs/nixvim/plugins/web-devicons.nix b/modules/programs/nixvim/plugins/web-devicons.nix
new file mode 100644
index 0000000..3c6ad86
--- /dev/null
+++ b/modules/programs/nixvim/plugins/web-devicons.nix
@@ -0,0 +1,8 @@
+{ config, lib, ... }:
+
+# Web-devicons - File icons for various file types (nvim-web-devicons)
+{
+ config.programs.nixvim.plugins.web-devicons = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ };
+}
diff --git a/modules/programs/nixvim/plugins/which-key.nix b/modules/programs/nixvim/plugins/which-key.nix
new file mode 100644
index 0000000..18018e7
--- /dev/null
+++ b/modules/programs/nixvim/plugins/which-key.nix
@@ -0,0 +1,21 @@
+{ config, lib, ... }:
+
+# Which-key - Popup for keybindings (which-key.nvim)
+{
+ config.programs.nixvim.plugins.which-key = lib.mkIf config.programs.nixvim.enable {
+ enable = true;
+ settings = {
+ plugins = {
+ marks = true;
+ registers = true;
+ spelling = {
+ enabled = true;
+ suggestions = 20;
+ };
+ };
+ win = {
+ border = "single";
+ };
+ };
+ };
+}