From 74cadc4f69af41c5868f14eea65de38aef990887 Mon Sep 17 00:00:00 2001 From: Doloro1978 Date: Fri, 15 May 2026 12:55:55 +0100 Subject: [PATCH] nvim is cool now --- config/modules/nixvim/default.nix | 656 +++++++++++++++++------------- config/modules/tmux.nix | 39 +- 2 files changed, 388 insertions(+), 307 deletions(-) diff --git a/config/modules/nixvim/default.nix b/config/modules/nixvim/default.nix index 0684742..331a8b0 100644 --- a/config/modules/nixvim/default.nix +++ b/config/modules/nixvim/default.nix @@ -4,8 +4,7 @@ lib, inputs, ... -}: -{ +}: { # Its in its own folder for future modulizaion efforts flake-file.inputs = { nixvim = { @@ -15,294 +14,375 @@ }; modules = { nixvim = { - nixos = - { home-manager, ... }: - { - }; - homeManager = - { pkgs, ... }: - { - imports = [ - inputs.nixvim.homeModules.nixvim - ]; - programs.nixvim = { - enable = true; - defaultEditor = true; - nixpkgs = { - config = { - allowUnfree = true; - }; - }; - colorschemes.gruvbox-material.enable = true; - extraPackages = with pkgs; [ - # formatters - alejandra - rustfmt - # misc - ripgrep - # misc - nixd - tree-sitter - ]; - performance.byteCompileLua = { - enable = true; - plugins = true; - nvimRuntime = true; - luaLib = true; - configs = true; - }; - plugins = { - todo-comments.enable = true; - lsp-status.enable = true; - transparent.enable = true; - which-key.enable = true; - conform-nvim = { - enable = true; - settings = { - formatters_by_ft = { - nix = [ "alejandra" ]; - rust = [ "rustfmt" ]; - "_" = [ - "squeeze_blanks" - "trim_whitespace" - "trim_newlines" - ]; - }; - format_on_save = { - timeout_ms = 500; - lsp_format = "fallback"; - }; - }; - }; - # efmls-configs = { - # enable = true; - # languages = { - # scss = { - # formatter = "prettier"; - # linter = "stylelint"; - # }; - # }; - # }; - lsp = { - enable = true; - servers = { - qmlls = { - enable = true; - config = { - cmd = "-E"; - }; - }; - rust_analyzer = { - enable = true; - installCargo = false; - installRustc = false; - }; - nixd = { - enable = true; - }; - astro = { - enable = true; - }; - ts_ls = { - enable = true; - }; - cssls.enable = true; - svelte.enable = true; - }; - }; - lsp-format = { - enable = true; - # lspServersToEnable = [ "qmlls" ]; - }; - notify = { - enable = true; - settings = { - background_color = "#00000000"; - }; - }; - mini-cursorword.enable = true; - # mini-statusline.enable = true; - lualine = { - enable = true; - settings = { - sections = { - lualine_a = [ "mode" ]; - lualine_b = [ - "branch" - "diff" - "diagnostics" - ]; - lualine_c = [ "filename" ]; - lualine_x = [ - "encoding" - "fileformat" - "filetype" - ]; - lualine_y = [ "lsp_status" ]; - lualine_z = [ "location" ]; - }; - inactive_sections = { - lualine_a = [ ]; - lualine_b = [ ]; - lualine_c = [ "filename" ]; - lualine_x = [ "location" ]; - lualine_y = [ ]; - lualine_z = [ ]; - }; - }; - }; - web-devicons.enable = true; - vim-dadbod-completion.enable = true; - telescope.enable = true; - lazygit.enable = true; - mini-indentscope = { - enable = true; - settings = { - draw = { - delay = 10; - }; - }; - }; - mini-files = { - enable = true; - settings = { - windows = { - preview = true; - }; - }; - }; - trouble.enable = true; - cmp = { - enable = true; - autoEnableSources = true; - settings = { - sources = [ - { name = "nvim_lsp"; } - { name = "path"; } - { name = "buffer"; } - ]; - mapping = { - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = "cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, {'i', 's'})"; - "" = "cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() end end, {'i', 's'})"; - }; - }; - }; - lspkind.enable = true; - tiny-inline-diagnostic.enable = true; - # persisted.enable = true; - auto-session = { - enable = false; - settings = { - enabled = true; - auto_save = true; - auto_restore = true; - }; - }; - wakatime.enable = true; - treesitter = { - enable = true; - grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ - bash - css - html - javascript - json - lua - make - markdown - rust - nix - regex - toml - tsx - typescript - vim - vimdoc - xml - yaml - svelte - ]; - settings = { - highlight.enable = true; - indent.enable = true; - }; - }; - }; - extraPlugins = with pkgs; [ - # vimPlugins.mini-completion - vimPlugins.mini-comment - vimPlugins.melange-nvim - vimPlugins.telescope-file-browser-nvim - vimPlugins.lsp-progress-nvim - ]; - opts = { - number = true; - bg = "dark"; - tabstop = 2; - shiftwidth = 2; - termguicolors = true; - }; - globals = { - mapleader = " "; - }; - keymaps = [ - { - action = "Telescope persisted"; - key = "fs"; - options = { - silent = true; - }; - } - { - action = "Telescope find_files"; - key = "ff"; - options = { - silent = true; - }; - } - { - action = ":lua MiniFiles.open()"; - key = "fv"; - options = { - silent = true; - }; - } - { - action = "LazyGit"; - key = "lg"; - options = { - silent = true; - }; - } - { - action = "Telescope buffers"; - key = "fb"; - options = { - silent = true; - }; - } - { - action = "Telescope live_grep"; - key = "fg"; - options = { - silent = true; - }; - } - { - action = "Trouble diagnostics toggle"; - key = "fd"; - options = { - silent = true; - }; - } - ]; + nixos = {home-manager, ...}: { + }; + homeManager = {pkgs, ...}: let + tiny-code-action = pkgs.vimUtils.buildVimPlugin { + name = "tiny-code-action.nvim"; + src = pkgs.fetchFromGitHub { + owner = "rachartier"; + repo = "tiny-code-action.nvim"; + rev = "main"; + hash = "sha256-UF9zeO5Uujdt2MEwy2d2Lhk6JRnEN4vrEvYslv0/zaA"; }; + nvimSkipModules = ["tiny-code-action.previewers.snacks"]; }; + in { + imports = [ + inputs.nixvim.homeModules.nixvim + ]; + programs.nixvim = { + enable = true; + defaultEditor = true; + nixpkgs = { + config = { + allowUnfree = true; + }; + }; + colorschemes.gruvbox-material.enable = true; + extraPackages = with pkgs; [ + # formatters + alejandra + rustfmt + # misc + ripgrep + # misc + nixd + tree-sitter + ]; + performance.byteCompileLua = { + enable = true; + plugins = true; + nvimRuntime = true; + luaLib = true; + configs = true; + }; + plugins = { + todo-comments.enable = true; + lsp-status.enable = true; + transparent.enable = true; + which-key.enable = true; + snacks.enable = true; + conform-nvim = { + enable = true; + settings = { + formatters_by_ft = { + nix = ["alejandra"]; + rust = ["rustfmt"]; + "_" = [ + "squeeze_blanks" + "trim_whitespace" + "trim_newlines" + ]; + }; + format_on_save = { + timeout_ms = 500; + lsp_format = "fallback"; + }; + }; + }; + # efmls-configs = { + # enable = true; + # languages = { + # scss = { + # formatter = "prettier"; + # linter = "stylelint"; + # }; + # }; + # }; + lsp = { + enable = true; + servers = { + qmlls = { + enable = true; + config = { + cmd = "-E"; + }; + }; + rust_analyzer = { + enable = true; + installCargo = false; + installRustc = false; + }; + nixd = { + enable = true; + }; + astro = { + enable = true; + }; + ts_ls = { + enable = true; + }; + cssls.enable = true; + svelte.enable = true; + }; + }; + lsp-format = { + enable = true; + # lspServersToEnable = [ "qmlls" ]; + }; + notify = { + enable = true; + settings = { + background_color = "#00000000"; + }; + }; + mini-cursorword.enable = true; + # mini-statusline.enable = true; + lualine = { + enable = true; + settings = { + sections = { + lualine_a = ["mode"]; + lualine_b = [ + "branch" + "diff" + "diagnostics" + ]; + lualine_c = ["filename"]; + lualine_x = [ + "encoding" + "fileformat" + "filetype" + ]; + lualine_y = ["progress"]; + lualine_z = ["location"]; + }; + inactive_sections = { + lualine_a = []; + lualine_b = []; + lualine_c = ["filename"]; + lualine_x = ["location"]; + lualine_y = []; + lualine_z = []; + }; + }; + }; + web-devicons.enable = true; + vim-dadbod-completion.enable = true; + telescope.enable = true; + lazygit.enable = true; + mini-indentscope = { + enable = true; + settings = { + draw = { + delay = 10; + }; + }; + }; + mini-files = { + enable = true; + settings = { + windows = { + preview = true; + }; + }; + }; + lsp-lines.enable = true; + diaglist = { + enable = true; + settings = { + debug = false; + }; + }; + cmp = { + enable = true; + autoEnableSources = true; + settings = { + sources = [ + { + name = "nvim_lsp"; + priority = 100; + } + { + name = "buffer"; + priority = 50; + } + { + name = "path"; + priority = 40; + } + ]; + mapping = { + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() else fallback() end end, {'i', 's'})"; + "" = "cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() else fallback() end end, {'i', 's'})"; + }; + window = { + completion = { + border = "rounded"; + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None"; + }; + documentation = { + border = "rounded"; + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu"; + }; + }; + }; + }; + lspkind.enable = true; + tiny-inline-diagnostic.enable = true; + # tiny-code-action.enable = true; + # persisted.enable = true; + auto-session = { + enable = false; + settings = { + enabled = true; + auto_save = true; + auto_restore = true; + }; + }; + wakatime.enable = true; + treesitter = { + enable = true; + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + css + html + javascript + json + lua + make + markdown + rust + nix + regex + toml + tsx + typescript + vim + vimdoc + xml + yaml + svelte + ]; + settings = { + highlight.enable = true; + indent.enable = true; + }; + }; + }; + extraPlugins = with pkgs; [ + # vimPlugins.mini-completion + vimPlugins.mini-comment + vimPlugins.melange-nvim + vimPlugins.telescope-file-browser-nvim + vimPlugins.lsp-progress-nvim + vimPlugins.cmp-cmdline + vimPlugins.cmp-nvim-lsp-signature-help + tiny-code-action + ]; + opts = { + number = true; + bg = "dark"; + tabstop = 2; + shiftwidth = 2; + termguicolors = true; + }; + globals = { + mapleader = " "; + }; + extraConfigLua = '' + local cmp = require('cmp') + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources( + { { name = 'path' } }, + { { name = 'cmdline' } } + ), + window = { + completion = { + border = 'rounded', + }, + }, + }) + cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + }, + window = { + completion = { + border = 'rounded', + }, + }, + }) + + require('tiny-code-action').setup({ + backend = 'vim', + picker = 'snacks', + resolve_timeout = 100, + notify = { + enabled = true, + on_empty = true, + }, + }) + ''; + keymaps = [ + { + action = "Telescope persisted"; + key = "fs"; + options = { + silent = true; + }; + } + { + action = "Telescope find_files"; + key = "ff"; + options = { + silent = true; + }; + } + { + action = ":lua MiniFiles.open()"; + key = "fv"; + options = { + silent = true; + }; + } + { + action = "LazyGit"; + key = "lg"; + options = { + silent = true; + }; + } + { + action = "Telescope buffers"; + key = "fb"; + options = { + silent = true; + }; + } + { + action = "Telescope live_grep"; + key = "fg"; + options = { + silent = true; + }; + } + { + action = "DiaglistToggle"; + key = "fd"; + options = { + silent = true; + }; + } + { + action = "lua require('tiny-code-action').code_action()"; + key = "ca"; + mode = ["n" "x"]; + options = { + silent = true; + }; + } + ]; + }; + }; }; }; } diff --git a/config/modules/tmux.nix b/config/modules/tmux.nix index d777708..eedb6c5 100644 --- a/config/modules/tmux.nix +++ b/config/modules/tmux.nix @@ -1,23 +1,24 @@ -{ modules, ... }: -{ +{modules, ...}: { modules.tmux = { - homeManager = - { home, pkgs, ... }: - { - programs.tmux = { - enable = true; - plugins = with pkgs.tmuxPlugins; [ - sensible - minimal-tmux-status - ]; - extraConfig = '' - set-option -g default-terminal "tmux-256color" - set -as terminal-features ",xterm-256color:RGB" - set -g status-bg black - set -g status-fg white - set -g mouse on - ''; - }; + homeManager = { + home, + pkgs, + ... + }: { + programs.tmux = { + enable = true; + plugins = with pkgs.tmuxPlugins; [ + sensible + minimal-tmux-status + ]; + extraConfig = '' + set-option -g default-terminal "tmux-256color" + set -as terminal-features ",xterm-256color:RGB" + set -g status-bg black + set -g status-fg white + set -g mouse on + ''; }; + }; }; }