1
0
Pārlūkot izejas kodu

refactor: nvim refactor

Zander Hawke 10 mēneši atpakaļ
vecāks
revīzija
6d44696cc1

+ 31 - 0
home/features/nvim/copilot.nix

@@ -0,0 +1,31 @@
+{
+  programs.nixvim = {
+    plugins.copilot-lua.enable = true;
+    plugins.copilot-lua.settings = {
+      suggestion = {
+        enabled = true;
+        auto_trigger = true;
+        accept = false;
+      };
+      panel.enabled = false;
+      filetypes."*" = true;
+    };
+
+    keymaps = [
+      {
+        key = "<S-Tab>";
+        action.__raw = ''
+          function()
+            if require("copilot.suggestion").is_visible() then
+              require("copilot.suggestion").accept()
+            else
+              vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<S-Tab>", true, false, true), "n", false)
+            end
+          end
+        '';
+        mode = "i";
+        options.silent = true;
+      }
+    ];
+  };
+}

+ 105 - 41
home/features/nvim/default.nix

@@ -1,51 +1,115 @@
 { inputs
-, lib
 , pkgs
 , ...
 }:
-let
-  # Define `recursiveUpdateMany` if not present
-  recursiveUpdateMany = sets: lib.fold lib.attrsets.recursiveUpdate { } sets;
-
-  # Merge all plugin configurations directly from imports
-  nixvim = recursiveUpdateMany [
-    {
-      enable = true;
-      defaultEditor = true;
-      vimdiffAlias = true;
-
-      extraPlugins = with pkgs; [
-        (vimUtils.buildVimPlugin rec {
-          pname = "nord.nvim";
-          version = "1.1.0";
-          src = fetchFromGitHub {
-            owner = "gbprod";
-            repo = "nord.nvim";
-            rev = "v${version}";
-            sha256 = "sha256-gSAXDXhxoigWl6qMAJ0yX59bnkOehVA1MADMeHoTHDo=";
-          };
-          meta.homepage = "https://github.com/gbprod/nord.nvim";
-        })
-        vimPlugins.vim-tmux-focus-events
-      ];
-
-      extraConfigLua = ''
-        require("nord").setup({
-          transparent = true,
-        })
-        vim.cmd.colorscheme("nord")
-      '';
-    }
-
-    (import ./keymaps.nix)
-    (import ./options.nix)
-    (import ./plugins.nix)
-  ];
-in
 {
   imports = [
     inputs.nixvim.homeManagerModules.nixvim
+
+    ./copilot.nix # copilot plugin
+    ./lsp.nix
+    ./mini.nix # mini.nvim plugin
+    ./telescope.nix # fuzzy find everything
+    ./treesitter.nix # treesitter support
+    ./which-key.nix # keybinding helper
   ];
 
-  programs.nixvim = nixvim;
+  programs.nixvim.plugins = {
+    tmux-navigator.enable = true; # tmux navigation
+    todo-comments.enable = true; # todo comments eg TODO, FIXME, etc
+  };
+
+  programs.nixvim = {
+    enable = true;
+    defaultEditor = true;
+    vimdiffAlias = true;
+
+    extraPlugins = with pkgs; [
+      vimPlugins.kanagawa-nvim
+    ];
+
+    extraConfigLua = ''
+      require("kanagawa").setup({
+        transparent = true,
+      })
+      vim.cmd.colorscheme("kanagawa")
+    '';
+
+    globals.mapleader = " ";
+    globals.maplocalleader = " ";
+    globals.have_nerd_font = true;
+
+    clipboard.register = "unnamedplus";
+
+    opts = {
+      number = true;
+      relativenumber = true;
+      showmode = false;
+      breakindent = true;
+      undofile = true;
+      ignorecase = true;
+      smartcase = true;
+      signcolumn = "yes";
+      updatetime = 250;
+      timeoutlen = 300;
+      splitright = true;
+      splitbelow = true;
+      list = true;
+      listchars = {
+        tab = "» ";
+        trail = "·";
+        nbsp = "␣";
+      };
+      inccommand = "split";
+      cursorline = true;
+      scrolloff = 10;
+      hlsearch = true;
+      swapfile = false;
+      backup = false;
+      conceallevel = 1;
+      laststatus = 3;
+      cmdheight = 0;
+    };
+
+    autoCmd = [
+      {
+        event = "TextYankPost";
+        desc = "Highlight when yanking (copying) text";
+        group = "kickstart-highlight-yank";
+        callback.__raw = ''
+          function()
+            vim.highlight.on_yank()
+          end
+        '';
+      }
+    ];
+
+    autoGroups = {
+      "kickstart-highlight-yank".clear = true;
+    };
+
+    keymaps = [
+      { key = "<Esc>"; action = "<cmd>nohlsearch<CR>"; mode = "n"; }
+      # Diagnostic keymaps
+      # { key = "<leader>q"; action.__raw = "vim.diagnostic.setloclist"; mode = "n"; options.desc = "Open diagnostic [Q]uickfix list"; }
+      # Exit terminal mode in the builtin terminal
+      # { key = "<Esc><Esc>"; action = "<C-\\><C-n>"; mode = "t"; option.desc = "Exit terminal mode"; }
+      # Keybinds to make split navigation easier. TODO: figure out if these work
+      { key = "<C-h>"; action = "<C-w><C-h>"; mode = "n"; options.desc = "Move focus to the left window"; }
+      { key = "<C-l>"; action = "<C-w><C-l>"; mode = "n"; options.desc = "Move focus to the right window"; }
+      { key = "<C-j>"; action = "<C-w><C-j>"; mode = "n"; options.desc = "Move focus to the lower window"; }
+      { key = "<C-k>"; action = "<C-w><C-k>"; mode = "n"; options.desc = "Move focus to the upper window"; }
+      # Move highlighed blocks of code up and down
+      { key = "K"; action = ":m '<-2<CR>gv=gv"; mode = "v"; options.desc = "Move highlighted block up"; }
+      { key = "J"; action = ":m '>+1<CR>gv=gv"; mode = "v"; options.desc = "Move highlighted block down"; }
+
+      { key = "J"; action = "mzJ`z"; mode = "n"; options.desc = "Join lines without losing cursor position"; }
+
+      { key = "<C-d>"; action = "<C-d>zz"; mode = "n"; options.desc = "Scroll down and center cursor"; }
+      { key = "<C-u>"; action = "<C-u>zz"; mode = "n"; options.desc = "Scroll up and center cursor"; }
+
+      { key = "n"; action = "nzzzv"; mode = "n"; options.desc = "Find next and center cursor"; }
+      { key = "N"; action = "Nzzzv"; mode = "n"; options.desc = "Find previous and center cursor"; }
+    ];
+  };
 }

+ 0 - 76
home/features/nvim/keymaps.nix

@@ -1,76 +0,0 @@
-{
-  keymaps = [
-    # clear search highlight on <ESC>
-    {
-      key = "<Esc>";
-      action = "<cmd>nohlsearch<CR>";
-      mode = "n";
-    }
-    # Diagnostic keymaps
-    # { key = "<leader>q"; action.__raw = "vim.diagnostic.setloclist"; mode = "n"; options.desc = "Open diagnostic [Q]uickfix list"; }
-    # Exit terminal mode in the builtin terminal
-    # { key = "<Esc><Esc>"; action = "<C-\\><C-n>"; mode = "t"; option.desc = "Exit terminal mode"; }
-    # Keybinds to make split navigation easier.
-    {
-      key = "<C-h>";
-      action = "<C-w><C-h>";
-      mode = "n";
-      options.desc = "Move focus to the left window";
-    }
-    {
-      key = "<C-l>";
-      action = "<C-w><C-l>";
-      mode = "n";
-      options.desc = "Move focus to the right window";
-    }
-    {
-      key = "<C-j>";
-      action = "<C-w><C-j>";
-      mode = "n";
-      options.desc = "Move focus to the lower window";
-    }
-    {
-      key = "<C-k>";
-      action = "<C-w><C-k>";
-      mode = "n";
-      options.desc = "Move focus to the upper window";
-    }
-    # Move highlighed blocks of code up and down
-    {
-      key = "K";
-      action = ":m '<-2<CR>gv=gv";
-      mode = "v";
-    }
-    {
-      key = "J";
-      action = ":m '>+1<CR>gv=gv";
-      mode = "v";
-    }
-
-    {
-      key = "J";
-      action = "mzJ`z";
-      mode = "n";
-    }
-    {
-      key = "<C-d>";
-      action = "<C-d>zz";
-      mode = "n";
-    }
-    {
-      key = "<C-u>";
-      action = "<C-u>zz";
-      mode = "n";
-    }
-    {
-      key = "n";
-      action = "nzzzv";
-      mode = "n";
-    }
-    {
-      key = "N";
-      action = "Nzzzv";
-      mode = "n";
-    }
-  ];
-}

+ 151 - 150
home/features/nvim/lsp.nix

@@ -1,170 +1,171 @@
 {
-  autoCmd = [
-    {
-      event = "LspAttach";
-      desc = "Keymaps for when LSP is attached";
-      group = "kickstart-lsp-attach";
-      callback.__raw = ''
-        function(event)
-          local map = function(keys, func, desc)
-            vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
-          end
+  programs.nixvim = {
+    autoCmd = [
+      {
+        event = "LspAttach";
+        desc = "Keymaps for when LSP is attached";
+        group = "kickstart-lsp-attach";
+        callback.__raw = ''
+          function(event)
+            local map = function(keys, func, desc)
+              vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
+            end
 
-          -- Jump to the definition of the word under your cursor.
-          --  This is where a variable was first declared, or where a function is defined, etc.
-          --  To jump back, press <C-t>.
-          map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-
-          -- Find references for the word under your cursor.
-          map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-
-          -- Jump to the implementation of the word under your cursor.
-          --  Useful when your language has ways of declaring types without an actual implementation.
-          map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
-
-          -- Jump to the type of the word under your cursor.
-          --  Useful when you're not sure what type a variable is and you want to see
-          --  the definition of its *type*, not where it was *defined*.
-          map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
-
-          -- Fuzzy find all the symbols in your current document.
-          --  Symbols are things like variables, functions, types, etc.
-          map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
-
-          -- Fuzzy find all the symbols in your current workspace.
-          --  Similar to document symbols, except searches over your entire project.
-          map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-
-          -- Rename the variable under your cursor.
-          --  Most Language Servers support renaming across files, etc.
-          map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-
-          -- Execute a code action, usually your cursor needs to be on top of an error
-          -- or a suggestion from your LSP for this to activate.
-          map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-
-          -- WARN: This is not Goto Definition, this is Goto Declaration.
-          --  For example, in C this would take you to the header.
-          map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-
-          -- The following two autocommands are used to highlight references of the
-          -- word under your cursor when your cursor rests there for a little while.
-          --    See `:help CursorHold` for information about when this is executed
-          --
-          -- When you move your cursor, the highlights will be cleared (the second autocommand).
-          local client = vim.lsp.get_client_by_id(event.data.client_id)
-          if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
-            local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
-            vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
-              buffer = event.buf,
-              group = highlight_augroup,
-              callback = vim.lsp.buf.document_highlight,
-            })
-
-            vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
-              buffer = event.buf,
-              group = highlight_augroup,
-              callback = vim.lsp.buf.clear_references,
-            })
-
-            vim.api.nvim_create_autocmd('LspDetach', {
-              group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
-              callback = function(event2)
-                vim.lsp.buf.clear_references()
-                vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
-              end,
-            })
-          end
+            -- Jump to the definition of the word under your cursor.
+            --  This is where a variable was first declared, or where a function is defined, etc.
+            --  To jump back, press <C-t>.
+            map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
+
+            -- Find references for the word under your cursor.
+            map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
+
+            -- Jump to the implementation of the word under your cursor.
+            --  Useful when your language has ways of declaring types without an actual implementation.
+            map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
+
+            -- Jump to the type of the word under your cursor.
+            --  Useful when you're not sure what type a variable is and you want to see
+            --  the definition of its *type*, not where it was *defined*.
+            map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
+
+            -- Fuzzy find all the symbols in your current document.
+            --  Symbols are things like variables, functions, types, etc.
+            map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
+
+            -- Fuzzy find all the symbols in your current workspace.
+            --  Similar to document symbols, except searches over your entire project.
+            map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
+
+            -- Rename the variable under your cursor.
+            --  Most Language Servers support renaming across files, etc.
+            map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
+
+            -- Execute a code action, usually your cursor needs to be on top of an error
+            -- or a suggestion from your LSP for this to activate.
+            map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
+
+            -- WARN: This is not Goto Definition, this is Goto Declaration.
+            --  For example, in C this would take you to the header.
+            map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
+
+            -- The following two autocommands are used to highlight references of the
+            -- word under your cursor when your cursor rests there for a little while.
+            --    See `:help CursorHold` for information about when this is executed
+            --
+            -- When you move your cursor, the highlights will be cleared (the second autocommand).
+            local client = vim.lsp.get_client_by_id(event.data.client_id)
+            if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
+              local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
+              vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
+                buffer = event.buf,
+                group = highlight_augroup,
+                callback = vim.lsp.buf.document_highlight,
+              })
+
+              vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
+                buffer = event.buf,
+                group = highlight_augroup,
+                callback = vim.lsp.buf.clear_references,
+              })
+
+              vim.api.nvim_create_autocmd('LspDetach', {
+                group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
+                callback = function(event2)
+                  vim.lsp.buf.clear_references()
+                  vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
+                end,
+              })
+            end
 
-          -- The following code creates a keymap to toggle inlay hints in your
-          -- code, if the language server you are using supports them
-          --
-          -- This may be unwanted, since they displace some of your code
-          if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
-            map('<leader>th', function()
-              vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
-            end, '[T]oggle Inlay [H]ints')
+            -- The following code creates a keymap to toggle inlay hints in your
+            -- code, if the language server you are using supports them
+            --
+            -- This may be unwanted, since they displace some of your code
+            if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
+              map('<leader>th', function()
+                vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
+              end, '[T]oggle Inlay [H]ints')
+            end
           end
-        end
-      '';
-    }
-  ];
+        '';
+      }
+    ];
 
-  autoGroups = {
-    "kickstart-lsp-attach".clear = true;
-  };
+    autoGroups = {
+      "kickstart-lsp-attach".clear = true;
+    };
 
-  keymaps = [
-    {
-      key = "<C-h>";
-      action.__raw = "vim.lsp.buf.signature_help";
-      mode = "i";
-    }
-  ];
-
-  plugins.lsp = {
-    enable = true;
-
-    keymaps = {
-      diagnostic = {
-        "<leader>vd" = "open_float";
-        "[d" = "goto_next";
-        "]d" = "goto_prev";
-      };
+    keymaps = [
+      {
+        key = "<C-h>";
+        action.__raw = "vim.lsp.buf.signature_help";
+        mode = "i";
+      }
+    ];
+
+    plugins.lsp = {
+      enable = true;
+
+      keymaps = {
+        diagnostic = {
+          "<leader>vd" = "open_float";
+          "[d" = "goto_next";
+          "]d" = "goto_prev";
+        };
 
-      lspBuf = {
-        "<leader>f" = "format";
-        "gd" = "definition";
-        "K" = "hover";
-        "<leader>vws" = "workspace_symbol";
-        "<leader>vca" = "code_action";
-        "<leader>vrr" = "references";
-        "<leader>vrn" = "rename";
+        lspBuf = {
+          "<leader>f" = "format";
+          "gd" = "definition";
+          "K" = "hover";
+          "<leader>vws" = "workspace_symbol";
+          "<leader>vca" = "code_action";
+          "<leader>vrr" = "references";
+          "<leader>vrn" = "rename";
+        };
       };
-    };
 
-    servers = {
-      astro.enable = true;
-      bashls.enable = true;
-
-      denols = {
-        enable = true;
-        extraOptions.init_options = {
-          lint = true;
-          unstable = true;
-          root_dir.__raw = ''
-            require("lspconfig.util").root_pattern("deno.json", "deno.jsonc", "deno.lock")
-          '';
+      servers = {
+        astro.enable = true;
+        bashls.enable = true;
+
+        denols = {
+          enable = true;
+          extraOptions.init_options = {
+            lint = true;
+            unstable = true;
+            root_dir.__raw = ''
+              require("lspconfig.util").root_pattern("deno.json", "deno.jsonc", "deno.lock")
+            '';
+          };
         };
-      };
 
-      gopls.enable = true;
+        gopls.enable = true;
 
-      # elixirls.enable = true;
-      nextls.enable = true;
-      nil_ls.enable = true;
-      tailwindcss.enable = true;
+        nextls.enable = true;
+        nil_ls.enable = true;
+        tailwindcss.enable = true;
 
-      ts_ls = {
-        enable = true;
-        extraOptions = {
-          single_file_support = false;
-          root_dir.__raw = ''
-            function(fname)
-              local util = require("lspconfig.util")
-              local deno_root = util.root_pattern("deno.json", "deno.jsonc", "deno.lock")(fname)
+        ts_ls = {
+          enable = true;
+          extraOptions = {
+            single_file_support = false;
+            root_dir.__raw = ''
+              function(fname)
+                local util = require("lspconfig.util")
+                local deno_root = util.root_pattern("deno.json", "deno.jsonc", "deno.lock")(fname)
 
-              if deno_root then
-                return nil
-              end
+                if deno_root then
+                  return nil
+                end
 
-              return util.root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")(fname)
-            end
-          '';
+                return util.root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")(fname)
+              end
+            '';
+          };
         };
-      };
 
-      volar.enable = true;
+        volar.enable = true;
+      };
     };
   };
 }

+ 71 - 0
home/features/nvim/mini.nix

@@ -0,0 +1,71 @@
+{
+  programs.nixvim = {
+    plugins.mini.enable = true;
+    plugins.mini.mockDevIcons = true;
+    plugins.mini.modules = {
+      comment = { };
+      diff = { };
+      icons = { };
+      indentscope = { };
+      notify = { };
+      statusline = { };
+
+      starter = {
+        content_hooks = {
+          "__unkeyed-1.adding_bullet" = {
+            __raw = "require('mini.starter').gen_hook.adding_bullet()";
+          };
+          "__unkeyed-2.indexing" = {
+            __raw = "require('mini.starter').gen_hook.indexing('all', { 'Builtin actions' })";
+          };
+          "__unkeyed-3.padding" = {
+            __raw = "require('mini.starter').gen_hook.aligning('center', 'center')";
+          };
+        };
+        evaluate_single = true;
+        header = ''
+
+
+
+
+                                    ░████ ░██                                              
+                                   ░██                                                     
+          ░█████████  ░███████  ░████████ ░██ ░███████       ░███████  ░██░████  ░████████ 
+               ░███  ░██    ░██    ░██    ░██░██    ░██     ░██    ░██ ░███     ░██    ░██ 
+             ░███    ░██    ░██    ░██    ░██░█████████     ░██    ░██ ░██      ░██    ░██ 
+           ░███      ░██    ░██    ░██    ░██░██            ░██    ░██ ░██      ░██   ░███ 
+          ░█████████  ░███████     ░██    ░██ ░███████  ░██  ░███████  ░██       ░█████░██ 
+                                                                                       ░██ 
+                                                                                 ░███████  
+                                                                                           
+
+
+
+        '';
+        items = {
+          "__unkeyed-1.buildtin_actions" = {
+            __raw = "require('mini.starter').sections.builtin_actions()";
+          };
+          "__unkeyed-2.recent_files_current_directory" = {
+            __raw = "require('mini.starter').sections.recent_files(10, false)";
+          };
+          "__unkeyed-3.recent_files" = {
+            __raw = "require('mini.starter').sections.recent_files(10, true)";
+          };
+        };
+      };
+
+      surround = {
+        mappings = {
+          add = "gsa";
+          delete = "gsd";
+          find = "gsf";
+          find_left = "gsF";
+          highlight = "gsh";
+          replace = "gsr";
+          update_n_lines = "gsn";
+        };
+      };
+    };
+  };
+}

+ 0 - 83
home/features/nvim/options.nix

@@ -1,83 +0,0 @@
-{
-  globals.mapleader = " ";
-  globals.maplocalleader = " ";
-  globals.have_nerd_font = true;
-
-  # Make system clipboard work
-  clipboard.register = "unnamedplus";
-
-  opts = {
-    # Make line numbers default
-    number = true;
-    relativenumber = true;
-    # Enable mouse mode, can be useful for resizing splits for example!
-    mouse = "a";
-    # Don't show the mode, since it's already in the status line
-    showmode = false;
-    # Enable break indent
-    breakindent = true;
-    # Save undo history
-    undofile = true;
-    # Case-insensitive searching UNLESS \C or one or more capital letters in the search term
-    ignorecase = true;
-    smartcase = true;
-    # Keep signcolumn on by default
-    signcolumn = "yes";
-    # Decrease update time
-    updatetime = 250;
-    # Decrease mapped sequence wait time
-    # Displays which-key popup sooner
-    timeoutlen = 300;
-    # Configure how new splits should be opened
-    splitright = true;
-    splitbelow = true;
-    # Sets how neovim will display certain whitespace characters in the editor.
-    list = true;
-    listchars = {
-      tab = "» ";
-      trail = "·";
-      nbsp = "␣";
-    };
-    # Preview substitutions live, as you type!
-    inccommand = "split";
-    # Show which line your cursor is on
-    cursorline = true;
-    # Minimal number of screen lines to keep above and below the cursor.
-    scrolloff = 10;
-    # Set highlight on search
-    hlsearch = true;
-    # Disable swapfile and backup
-    swapfile = false;
-    backup = false;
-    # Set's the conceal level
-    conceallevel = 1;
-    # I don't need a status all the time
-    laststatus = 3;
-    # Hide command bar
-    cmdheight = 0;
-
-    # guicursor = "";
-    # incsearch = true;
-    # termguicolors = true;
-    # scrolloff = 8;
-    # isfname = [ "@-@" ];
-    # colorcolumn = "80";
-  };
-
-  autoCmd = [
-    {
-      event = "TextYankPost";
-      desc = "Highlight when yanking (copying) text";
-      group = "kickstart-highlight-yank";
-      callback.__raw = ''
-        function()
-          vim.highlight.on_yank()
-        end
-      '';
-    }
-  ];
-
-  autoGroups = {
-    "kickstart-highlight-yank".clear = true;
-  };
-}

+ 0 - 26
home/features/nvim/plugins.nix

@@ -1,26 +0,0 @@
-{
-  imports = [
-    ./lsp.nix
-    # ./plugins/avante.nix
-    ./plugins/conform.nix
-    ./plugins/comment.nix
-    ./plugins/copilot.nix
-    ./plugins/fidget.nix
-    ./plugins/gitsigns.nix
-    ./plugins/indent-blankline.nix
-    ./plugins/lint.nix
-    ./plugins/mdx.nix
-    ./plugins/mini.nix
-    ./plugins/oil.nix
-
-    # ./plugins/snacks.nix
-
-    ./plugins/telescope.nix
-    ./plugins/tmux.nix
-    ./plugins/todo-comments.nix
-    ./plugins/treesitter.nix
-    ./plugins/web-devicons.nix
-    ./plugins/which-key.nix
-    # ./plugins/zenmode.nix
-  ];
-}

+ 0 - 13
home/features/nvim/plugins/avante.nix

@@ -1,13 +0,0 @@
-{
-  plugins.avante.enable = true;
-  plugins.avante.settings = {
-    hints.enabled = false;
-    provider = "openrouter";
-    vendors.openrouter = {
-      __inherited_from = "openai";
-      endpoint = "https://openrouter.ai/api/v1";
-      api_key_name = "OPENROUTER_API_KEY";
-      model = "moonshotai/kimi-k2:free";
-    };
-  };
-}

+ 0 - 44
home/features/nvim/plugins/cmp.nix

@@ -1,44 +0,0 @@
-{
-  plugins.cmp.enable = true;
-  plugins.cmp.autoEnableSources = true;
-  plugins.cmp.settings.mapping = {
-    "<C-n>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
-    "<C-p>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
-    "<C-b>" = "cmp.mapping.scroll_docs(-4)";
-    "<C-f>" = "cmp.mapping.scroll_docs(4)";
-    "<C-y>" = "cmp.mapping.confirm({ select = true })";
-    "<C-Space>" = "cmp.mapping.complete()";
-    "<C-e>" = "cmp.mapping.close()";
-
-    "<C-l>" = ''
-      cmp.mapping(function()
-        if luasnip.expand_or_locally_jumpable() then
-          luasnip.expand_or_jump()
-        end
-      end, { 'i', 's' })
-    '';
-
-    "<C-h>" = ''
-      cmp.mapping(function()
-        if luasnip.locally_jumpable(-1) then
-          luasnip.jump(-1)
-        end
-      end, { 'i', 's' })
-    '';
-  };
-  plugins.cmp.settings.sources = [
-    { name = "nvim_lsp"; }
-    { name = "luasnip"; }
-    { name = "path"; }
-    { name = "buffer"; }
-    { name = "friendly-snippets"; }
-  ];
-
-  plugins.luasnip.enable = true;
-  plugins.cmp_luasnip.enable = true;
-  plugins.cmp-nvim-lsp.enable = true;
-  plugins.cmp-nvim-lsp-document-symbol.enable = true;
-  plugins.cmp-nvim-lsp-signature-help.enable = true;
-  plugins.cmp-path.enable = true;
-  plugins.friendly-snippets.enable = true;
-}

+ 0 - 3
home/features/nvim/plugins/comment.nix

@@ -1,3 +0,0 @@
-{
-  plugins.comment.enable = true;
-}

+ 0 - 41
home/features/nvim/plugins/conform.nix

@@ -1,41 +0,0 @@
-{
-  keymaps = [
-    {
-      key = "<leader>f";
-      action.__raw = ''
-        function()
-          require('conform').format { async = true, lsp_fallback = true }
-        end
-      '';
-      options.desc = "[F]ormat buffer";
-    }
-  ];
-
-  plugins.conform-nvim = {
-    enable = true;
-    settings.formatters_by_ft = {
-      lua = [ "lua_ls" ];
-      javascript = [
-        [
-          "prettierd"
-          "prettier"
-        ]
-        [
-          "eslint_d"
-          "eslint"
-        ]
-      ];
-      typescript = [
-        [
-          "prettierd"
-          "prettier"
-        ]
-        [
-          "eslint_d"
-          "eslint"
-        ]
-      ];
-    };
-    settings.notify_on_error = false;
-  };
-}

+ 0 - 29
home/features/nvim/plugins/copilot.nix

@@ -1,29 +0,0 @@
-{
-  plugins.copilot-lua.enable = true;
-  plugins.copilot-lua.settings = {
-    suggestion = {
-      enabled = true;
-      auto_trigger = true;
-      accept = false;
-    };
-    panel.enabled = false;
-    filetypes."*" = true;
-  };
-
-  keymaps = [
-    {
-      key = "<S-Tab>";
-      action.__raw = ''
-        function()
-          if require("copilot.suggestion").is_visible() then
-            require("copilot.suggestion").accept()
-          else
-            vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<S-Tab>", true, false, true), "n", false)
-          end
-        end
-      '';
-      mode = "i";
-      options.silent = true;
-    }
-  ];
-}

+ 0 - 32
home/features/nvim/plugins/elixir-tools.nix

@@ -1,32 +0,0 @@
-# { pkgs, ... }:
-{
-  plugins.elixir.enable = false;
-  # plugins.elixir.settings = {
-  #   nextls = {
-  #     enable = true;
-  #     cmd = "nextls";
-  #     init_options = {
-  #       mix_env = "production";
-  #       mix_target = "localhost";
-  #       experimental.completions.enable = true;
-  #       extensions.credo = {
-  #         enable = true;
-  #         cli_options = [];
-  #       };
-  #     };
-  #     # on_attach.__raw = ''
-  #     #   function(client, bufnr)
-  #     #     -- from config
-  #     #   end
-  #     # '';
-  #   };
-  # #   nextls.enable = true;
-  # #   nextls.auto_update = true;
-  # #   elixirls.enable = false;
-  # #   projectionist.enable = false;
-  # };
-  # extraPlugins = with pkgs.vimPlugins; [ elixir-tools-nvim ];
-  # extraConfigLua = ''
-  #   require("elixir").setup()
-  # '';
-}

+ 0 - 3
home/features/nvim/plugins/fidget.nix

@@ -1,3 +0,0 @@
-{
-  plugins.fidget.enable = true;
-}

+ 0 - 22
home/features/nvim/plugins/gitsigns.nix

@@ -1,22 +0,0 @@
-{
-  plugins.gitsigns.enable = true;
-  plugins.gitsigns.settings = {
-    signs = {
-      add = {
-        text = "+";
-      };
-      change = {
-        text = "~";
-      };
-      delete = {
-        text = "_";
-      };
-      topdelete = {
-        text = "‾";
-      };
-      changedelete = {
-        text = "~";
-      };
-    };
-  };
-}

+ 0 - 3
home/features/nvim/plugins/indent-blankline.nix

@@ -1,3 +0,0 @@
-{
-  plugins.indent-blankline.enable = true;
-}

+ 0 - 13
home/features/nvim/plugins/lint.nix

@@ -1,13 +0,0 @@
-{
-  plugins.lint.enable = true;
-  plugins.lint.lintersByFt = {
-    elixir = [ "credo" ];
-  };
-}
-# vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
-#   group = lint_augroup,
-#   callback = function()
-#     lint.try_lint()
-#   end,
-# })
-

+ 0 - 25
home/features/nvim/plugins/mdx.nix

@@ -1,25 +0,0 @@
-{
-  filetype.extension.mdx = "mdx";
-
-  plugins.treesitter.languageRegister.markdown = "mdx";
-
-  extraFiles = {
-    # highlighting import statements in markdown
-    "queries/markdown/injections.scm".text = ''
-      ; extends
-      ((inline) @injection.content
-        (#lua-match? @injection.content "^%s*import")
-        (#set! injection.language "typescript"))
-      ((inline) @injection.content
-        (#lua-match? @injection.content "^%s*export")
-        (#set! injection.language "typescript"))
-    '';
-
-    # disable spell check if turned on
-    "queries/markdown/highlights.scm".text = ''
-      ; extends
-      ((inline) @_inline (#lua-match? @_inline "^%s*import")) @nospell
-      ((inline) @_inline (#lua-match? @_inline "^%s*export")) @nospell
-    '';
-  };
-}

+ 0 - 61
home/features/nvim/plugins/mini.nix

@@ -1,61 +0,0 @@
-{
-  plugins.web-devicons.enable = true;
-  plugins.mini.enable = true;
-  plugins.mini.modules = {
-    ai.n_lines = 500;
-
-    starter = {
-      content_hooks = {
-        "__unkeyed-1.adding_bullet" = {
-          __raw = "require('mini.starter').gen_hook.adding_bullet()";
-        };
-        "__unkeyed-2.indexing" = {
-          __raw = "require('mini.starter').gen_hook.indexing('all', { 'Builtin actions' })";
-        };
-        "__unkeyed-3.padding" = {
-          __raw = "require('mini.starter').gen_hook.aligning('center', 'center')";
-        };
-      };
-      evaluate_single = true;
-      header = ''
-        ███╗   ██╗██╗██╗  ██╗██╗   ██╗██╗███╗   ███╗
-        ████╗  ██║██║╚██╗██╔╝██║   ██║██║████╗ ████║
-        ██╔██╗ ██║██║ ╚███╔╝ ██║   ██║██║██╔████╔██║
-        ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║
-        ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║
-      '';
-      items = {
-        "__unkeyed-1.buildtin_actions" = {
-          __raw = "require('mini.starter').sections.builtin_actions()";
-        };
-        "__unkeyed-2.recent_files_current_directory" = {
-          __raw = "require('mini.starter').sections.recent_files(10, false)";
-        };
-        "__unkeyed-3.recent_files" = {
-          __raw = "require('mini.starter').sections.recent_files(10, true)";
-        };
-        "__unkeyed-4.sessions" = {
-          __raw = "require('mini.starter').sections.sessions(5, true)";
-        };
-      };
-    };
-
-    statusline.section_location.__raw = ''
-      function()
-        return '%2l:%-2v'
-      end
-    '';
-
-    surround = {
-      mappings = {
-        add = "gsa";
-        delete = "gsd";
-        find = "gsf";
-        find_left = "gsF";
-        highlight = "gsh";
-        replace = "gsr";
-        update_n_lines = "gsn";
-      };
-    };
-  };
-}

+ 0 - 14
home/features/nvim/plugins/oil.nix

@@ -1,14 +0,0 @@
-{
-  keymaps = [
-    {
-      key = "-";
-      action = "<cmd>Oil<cr>";
-      mode = "n";
-    }
-  ];
-
-  plugins.oil.enable = true;
-  plugins.oil.settings.keymaps = {
-    "-" = "<cmd>Oil<cr>";
-  };
-}

+ 0 - 3
home/features/nvim/plugins/sleuth.nix

@@ -1,3 +0,0 @@
-{
-  plugins.sleuth.enable = true;
-}

+ 0 - 58
home/features/nvim/plugins/snacks.nix

@@ -1,58 +0,0 @@
-{
-  plugins.snacks = {
-    enable = true;
-    autoLoad = true;
-    settings = {
-      bigfile = {
-        enabled = true;
-      };
-      dashboard = {
-        width = 60;
-        row = null;
-        col = null;
-        pane_gap = 4;
-        autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
-        sections = [
-          { section = "header"; }
-          {
-            section = "keys";
-            gap = 1;
-          }
-          {
-            icon = " ";
-            title = "Recent Files";
-            section = "recent_files";
-            indent = 2;
-            padding = [
-              2
-              2
-            ];
-          }
-          {
-            icon = " ";
-            title = "Projects";
-            section = "projects";
-            indent = 2;
-            padding = 2;
-          }
-          { section = "startup"; }
-        ];
-      };
-      notifier = {
-        enabled = true;
-        timeout = 3000;
-      };
-      quickfile = {
-        enabled = true;
-      };
-      statuscolumn = {
-        enabled = true;
-      };
-      words = {
-        debounce = 100;
-        enabled = true;
-      };
-    };
-  };
-}

+ 0 - 117
home/features/nvim/plugins/telescope.nix

@@ -1,117 +0,0 @@
-{
-  plugins.telescope = {
-    enable = true;
-
-    settings.pickers.find_files.follow = true;
-
-    extensions.media-files.enable = true;
-    extensions.media-files.settings.find_cmd = "rg";
-
-    extensions.fzf-native.enable = true;
-    extensions.ui-select.enable = true;
-  };
-
-  keymaps = [
-    {
-      mode = "n";
-      key = "<leader>sh";
-      action.__raw = "require('telescope.builtin').help_tags";
-      options.desc = "[S]earch [H]elp";
-    }
-    {
-      mode = "n";
-      key = "<leader>sk";
-      action.__raw = "require('telescope.builtin').keymaps";
-      options.desc = "[S]earch [K]eymaps";
-    }
-    {
-      mode = "n";
-      key = "<leader>sf";
-      action.__raw = "require('telescope.builtin').find_files";
-      options.desc = "[S]earch [F]iles";
-    }
-    {
-      mode = "n";
-      key = "<leader>ss";
-      action.__raw = "require('telescope.builtin').builtin";
-      options.desc = "[S]earch [S]elect Telescope";
-    }
-    {
-      mode = "n";
-      key = "<leader>sw";
-      action.__raw = "require('telescope.builtin').grep_string";
-      options.desc = "[S]earch current [W]ord";
-    }
-    {
-      mode = "n";
-      key = "<leader>sg";
-      action.__raw = "require('telescope.builtin').live_grep";
-      options.desc = "[S]earch by [G]rep";
-    }
-    {
-      mode = "n";
-      key = "<leader>s.";
-      action.__raw = "require('telescope.builtin').oldfiles";
-      options.desc = "[S]earch Recent Files (\".\" for repeat)";
-    }
-    {
-      mode = "n";
-      key = "<leader>sd";
-      action.__raw = "require('telescope.builtin').diagnostics";
-      options.desc = "[S]earch [D]iagnostics";
-    }
-    {
-      mode = "n";
-      key = "<leader>sr";
-      action.__raw = "require('telescope.builtin').resume";
-      options.desc = "[S]earch [R]esume";
-    }
-    {
-      mode = "n";
-      key = "<leader><leader>";
-      action.__raw = "require('telescope.builtin').buffers";
-      options.desc = "[ ] Find existing buffers";
-    }
-
-    {
-      mode = "n";
-      key = "<leader>/";
-      action.__raw = ''
-        function()
-          require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
-            winblend = 10,
-            previewer = false,
-          })
-        end
-      '';
-      options.desc = "[/] Fuzzily search in current buffer";
-    }
-
-    {
-      mode = "n";
-      key = "<leader>s/";
-      action.__raw = ''
-        function()
-          require('telescope.builtin').live_grep {
-            grep_open_files = true,
-            prompt_title = 'Live Grep in Open Files',
-          }
-        end
-      '';
-      options.desc = "[S]earch [/] in Open Files";
-    }
-
-    {
-      mode = "n";
-      key = "<leader>sn";
-      action.__raw = ''
-        function()
-          require('telescope.builtin').find_files {
-            cwd = vim.fn.stdpath 'config'
-          }
-        end
-      '';
-      options.desc = "[S]earch [N]eovim files";
-    }
-  ];
-}

+ 0 - 3
home/features/nvim/plugins/tmux.nix

@@ -1,3 +0,0 @@
-{
-  plugins.tmux-navigator.enable = true;
-}

+ 0 - 4
home/features/nvim/plugins/todo-comments.nix

@@ -1,4 +0,0 @@
-{
-  plugins.todo-comments.enable = true;
-  plugins.todo-comments.settings.signs = false;
-}

+ 0 - 3
home/features/nvim/plugins/web-devicons.nix

@@ -1,3 +0,0 @@
-{
-  plugins.web-devicons.enable = true;
-}

+ 0 - 51
home/features/nvim/plugins/which-key.nix

@@ -1,51 +0,0 @@
-{
-  plugins.which-key.enable = true;
-  plugins.which-key.settings.spec = [
-    {
-      __unkeyed-1 = "<leader>c";
-      group = "[C]ode";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>d";
-      group = "[D]ocuments";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>r";
-      group = "[R]ename";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>s";
-      group = "[S]earch";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>w";
-      group = "[W]orkspace";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>t";
-      group = "[T]oggle";
-      icon = "󰄄 ";
-    }
-    {
-      __unkeyed-1 = "<leader>h";
-      group = "Git [H]unk";
-      icon = "󰄄 ";
-      mode = [
-        "n"
-        "v"
-      ];
-    }
-  ];
-  # { '<leader>c', group = '[C]ode' },
-  # { '<leader>d', group = '[D]ocument' },
-  # { '<leader>r', group = '[R]ename' },
-  # { '<leader>s', group = '[S]earch' },
-  # { '<leader>w', group = '[W]orkspace' },
-  # { '<leader>t', group = '[T]oggle' },
-  # { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }
-}

+ 0 - 18
home/features/nvim/plugins/zenmode.nix

@@ -1,18 +0,0 @@
-{
-  keymaps = [
-    {
-      key = "<leader>z";
-      action = "<cmd>ZenMode<CR>";
-      options.desc = "[Z]en Mode";
-    }
-  ];
-
-  plugins.zen-mode = {
-    enable = true;
-    settings = {
-      plugins.alacritty.enabled = true;
-      plugins.tmux.enabled = true;
-      window.width = 0.5;
-    };
-  };
-}

+ 69 - 0
home/features/nvim/telescope.nix

@@ -0,0 +1,69 @@
+{
+  programs.nixvim = {
+    plugins.telescope = {
+      enable = true;
+
+      settings.pickers.find_files.follow = true;
+
+      extensions.media-files.enable = true;
+      extensions.media-files.settings.find_cmd = "rg";
+
+      extensions.fzf-native.enable = true;
+      extensions.ui-select.enable = true;
+    };
+
+    keymaps = [
+      { mode = "n"; key = "<leader>sh"; action.__raw = "require('telescope.builtin').help_tags"; options.desc = "[S]earch [H]elp"; }
+      { mode = "n"; key = "<leader>sk"; action.__raw = "require('telescope.builtin').keymaps"; options.desc = "[S]earch [K]eymaps"; }
+      { mode = "n"; key = "<leader>sf"; action.__raw = "require('telescope.builtin').find_files"; options.desc = "[S]earch [F]iles"; }
+      { mode = "n"; key = "<leader>ss"; action.__raw = "require('telescope.builtin').builtin"; options.desc = "[S]earch [S]elect Telescope"; }
+      { mode = "n"; key = "<leader>sw"; action.__raw = "require('telescope.builtin').grep_string"; options.desc = "[S]earch current [W]ord"; }
+      { mode = "n"; key = "<leader>sg"; action.__raw = "require('telescope.builtin').live_grep"; options.desc = "[S]earch by [G]rep"; }
+      { mode = "n"; key = "<leader>s."; action.__raw = "require('telescope.builtin').oldfiles"; options.desc = "[S]earch Recent Files (\".\" for repeat)"; }
+      { mode = "n"; key = "<leader>sd"; action.__raw = "require('telescope.builtin').diagnostics"; options.desc = "[S]earch [D]iagnostics"; }
+      { mode = "n"; key = "<leader>sr"; action.__raw = "require('telescope.builtin').resume"; options.desc = "[S]earch [R]esume"; }
+      { mode = "n"; key = "<leader><leader>"; action.__raw = "require('telescope.builtin').buffers"; options.desc = "[ ] Find existing buffers"; }
+
+      {
+        mode = "n";
+        key = "<leader>/";
+        action.__raw = ''
+          function()
+            require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
+              winblend = 10,
+              previewer = false,
+            })
+          end
+        '';
+        options.desc = "[/] Fuzzily search in current buffer";
+      }
+
+      {
+        mode = "n";
+        key = "<leader>s/";
+        action.__raw = ''
+          function()
+            require('telescope.builtin').live_grep {
+              grep_open_files = true,
+              prompt_title = 'Live Grep in Open Files',
+            }
+          end
+        '';
+        options.desc = "[S]earch [/] in Open Files";
+      }
+
+      {
+        mode = "n";
+        key = "<leader>sn";
+        action.__raw = ''
+          function()
+            require('telescope.builtin').find_files {
+              cwd = vim.fn.stdpath 'config'
+            }
+          end
+        '';
+        options.desc = "[S]earch [N]eovim files";
+      }
+    ];
+  };
+}

+ 3 - 5
home/features/nvim/plugins/treesitter.nix → home/features/nvim/treesitter.nix

@@ -1,7 +1,5 @@
-{ pkgs, ... }: {
-  plugins.treesitter = {
-    grammarPackages = pkgs.vimPlugins.nvim-treesitter.passthru.allGrammars;
-
+{
+  programs.nixvim.plugins.treesitter = {
     enable = true;
     settings.ensure_installed = "all";
     settings.ignore_install = [ "norg" ];
@@ -11,5 +9,5 @@
     settings.indent.enable = true;
     nixvimInjections = true;
   };
-  plugins.treesitter-context.enable = true;
+  programs.nixvim.plugins.treesitter-context.enable = true;
 }

+ 22 - 0
home/features/nvim/which-key.nix

@@ -0,0 +1,22 @@
+{
+  programs.nixvim = {
+    plugins.which-key.enable = true;
+    plugins.which-key.settings.spec = [
+      { __unkeyed-1 = "<leader>c"; group = "[C]ode"; icon = "󰄄 "; }
+      { __unkeyed-1 = "<leader>d"; group = "[D]ocuments"; icon = "󰄄 "; }
+      { __unkeyed-1 = "<leader>r"; group = "[R]ename"; icon = "󰄄 "; }
+      { __unkeyed-1 = "<leader>s"; group = "[S]earch"; icon = "󰄄 "; }
+      { __unkeyed-1 = "<leader>w"; group = "[W]orkspace"; icon = "󰄄 "; }
+      { __unkeyed-1 = "<leader>t"; group = "[T]oggle"; icon = "󰄄 "; }
+      {
+        __unkeyed-1 = "<leader>h";
+        group = "Git [H]unk";
+        icon = "󰄄 ";
+        mode = [
+          "n"
+          "v"
+        ];
+      }
+    ];
+  };
+}