/ modules / home / programs / neovim / plugins.nix
plugins.nix
  1  {
  2    programs.lazyvim.plugins = {
  3      colorscheme = ''
  4        return {
  5          { "ellisonleao/gruvbox.nvim" },
  6          -- {
  7          --   "catppuccin/nvim",
  8          --   lazy = true,
  9          --   name = "catppuccin",
 10          --   opts = {
 11          --     lsp_styles = {
 12          --       underlines = {
 13          --         errors = { "undercurl" },
 14          --         hints = { "undercurl" },
 15          --         warnings = { "undercurl" },
 16          --         information = { "undercurl" },
 17          --       },
 18          --     },
 19          --     integrations = {
 20          --       aerial = true,
 21          --       alpha = true,
 22          --       cmp = true,
 23          --       dashboard = true,
 24          --       flash = true,
 25          --       fzf = true,
 26          --       grug_far = true,
 27          --       gitsigns = true,
 28          --       headlines = true,
 29          --       illuminate = true,
 30          --       indent_blankline = { enabled = true },
 31          --       leap = true,
 32          --       lsp_trouble = true,
 33          --       mason = true,
 34          --       mini = true,
 35          --       navic = { enabled = true, custom_bg = "lualine" },
 36          --       neotest = true,
 37          --       neotree = true,
 38          --       noice = true,
 39          --       notify = true,
 40          --       snacks = true,
 41          --       telescope = true,
 42          --       treesitter_context = true,
 43          --       which_key = true,
 44          --     },
 45          --   },
 46          --   specs = {
 47          --     {
 48          --       "akinsho/bufferline.nvim",
 49          --       optional = true,
 50          --       opts = function(_, opts)
 51          --         if (vim.g.colors_name or ""):find("catppuccin") then
 52          --           opts.highlights = require("catppuccin.special.bufferline").get_theme()
 53          --         end
 54          --       end,
 55          --     },
 56          --   },
 57          -- },
 58  
 59          {
 60            "LazyVim/LazyVim",
 61            opts = {
 62              -- colorscheme = "catppuccin",
 63              colorscheme = "gruvbox",
 64            },
 65          },
 66        }
 67      '';
 68  
 69      dashboard-nvim = ''
 70        return {
 71          "nvimdev/dashboard-nvim",
 72          lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
 73          opts = function()
 74            local logo = [[
 75                  (              )               (     *
 76           (      )\ )   (    ( /(                )\ ) (  `
 77           )\    (()/(   )\   )\())     (     (  (()/( )\))(
 78        ((((_)(   /(_))(((_) ((_)\      )\    )\  /(_))((_)()\
 79        )\ _ )\  (_))  )\___  _((_)    ((_)  ((_)(_))  (_()((_)
 80         █████╗ ██████╗  ██████╗██╗  ██╗██╗   ██╗██╗███╗   ███╗
 81        ██╔══██╗██╔══██╗██╔════╝██║  ██║██║   ██║██║████╗ ████║
 82        ███████║██████╔╝██║     ███████║██║   ██║██║██╔████╔██║
 83        ██╔══██║██╔══██╗██║     ██╔══██║╚██╗ ██╔╝██║██║╚██╔╝██║
 84        ██║  ██║██║  ██║╚██████╗██║  ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
 85        ╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝  ╚═══╝  ╚═╝╚═╝     ╚═╝
 86  
 87        "Do not proceed with a mess; messes just grow with time.” ― Bjarne Stroustrup
 88            ]]
 89  
 90            logo = string.rep("\n", 8) .. logo .. "\n\n"
 91  
 92            local opts = {
 93              theme = "doom",
 94              hide = {
 95                -- this is taken care of by lualine
 96                -- enabling this messes up the actual laststatus setting after loading a file
 97                statusline = false,
 98              },
 99              config = {
100                header = vim.split(logo, "\n"),
101                -- stylua: ignore
102                center = {
103                  { action = 'lua LazyVim.pick()()',                           desc = " Find File",       icon = " ", key = "f" },
104                  { action = "ene | startinsert",                              desc = " New File",        icon = " ", key = "n" },
105                  { action = 'lua LazyVim.pick("oldfiles")()',                 desc = " Recent Files",    icon = " ", key = "r" },
106                  { action = 'lua LazyVim.pick("live_grep")()',                desc = " Find Text",       icon = " ", key = "g" },
107                  { action = 'lua LazyVim.pick.config_files()()',              desc = " Config",          icon = " ", key = "c" },
108                  { action = 'lua require("persistence").load()',              desc = " Restore Session", icon = " ", key = "s" },
109                  { action = "LazyExtras",                                     desc = " Lazy Extras",     icon = " ", key = "x" },
110                  { action = "Lazy",                                           desc = " Lazy",            icon = "󰒲 ", key = "l" },
111                  { action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit",            icon = " ", key = "q" },
112                },
113                footer = function()
114                  local stats = require("lazy").stats()
115                  local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
116                  return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
117                end,
118              },
119            }
120  
121            for _, button in ipairs(opts.config.center) do
122              button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
123              button.key_format = "  %s"
124            end
125  
126            -- open dashboard after closing lazy
127            if vim.o.filetype == "lazy" then
128              vim.api.nvim_create_autocmd("WinClosed", {
129                pattern = tostring(vim.api.nvim_get_current_win()),
130                once = true,
131                callback = function()
132                  vim.schedule(function()
133                    vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
134                  end)
135                end,
136              })
137            end
138  
139            return opts
140          end,
141        }
142      '';
143  
144      nvim-orgmode = ''
145        ---@type LazySpec
146        return {
147            "nvim-orgmode/orgmode",
148            event = "VeryLazy",
149            config = function()
150              -- Setup orgmode
151              require("orgmode").setup({
152                org_agenda_files = "~/Documents/org/**/*",
153                org_default_notes_file = "~/Documents/org/refile.org",
154              })
155            end,
156          }
157      '';
158  
159      yazi-nvim = ''
160        ---@type LazySpec
161        return {
162          -- https://github.com/mikavilpas/yazi.nvim
163          "mikavilpas/yazi.nvim",
164          version = "*", -- use the latest stable version
165          event = "VeryLazy",
166          dependencies = {
167            { "nvim-lua/plenary.nvim", lazy = true },
168          },
169          keys = {
170            {
171              "<leader>cw",
172              "<cmd>Yazi cwd<cr>",
173              desc = "Open the file manager in nvim's working directory",
174            },
175            {
176              "<c-up>",
177              "<cmd>Yazi toggle<cr>",
178              desc = "Resume the last yazi session",
179            },
180          },
181          ---@type YaziConfig | {}
182          opts = {
183            -- if you want to open yazi instead of netrw, see below for more info
184            open_for_directories = true,
185            keymaps = {
186              show_help = "<f1>",
187            },
188          },
189          -- 👇 if you use `open_for_directories=true`, this is recommended
190          init = function()
191            -- mark netrw as loaded so it's not loaded at all.
192            --
193            -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802
194            vim.g.loaded_netrwPlugin = 1
195          end,
196        }
197      '';
198  
199      # TODO:complete setup
200  
201      # lsp-config = ''
202      #   return {
203      #     "neovim/nvim-lspconfig",
204      #     opts = function(_, opts)
205      #       opts.servers = opts.servers or {}
206      #
207      #       opts.servers.likec4 = {
208      #         cmd = {"pnpx", "@likec4/language-server", "--stdio" },
209      #       }
210      #
211      #       return opts
212      #     end,
213      #   }
214      # '';
215    };
216  }