dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

plugins.lua (13422B)


      1 return {
      2   {
      3     'stevearc/dressing.nvim',
      4     opts = {},
      5   },
      6   {
      7     'neovim/nvim-lspconfig',
      8     dependencies = {
      9       -- Automatically install LSPs to stdpath for neovim
     10       {
     11         'williamboman/mason.nvim',
     12         opts = {},
     13       },
     14       {
     15         'williamboman/mason-lspconfig.nvim',
     16         config = function()
     17           require 'config.mason-lspconfig'
     18 
     19           -- Workaround: https://github.com/neovim/neovim/issues/30985
     20           if vim.fn.has('nvim-0.11.0-dev') ~= 1 then
     21             error("Check if you still need this LSP workaround")
     22           end
     23           for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do
     24             local default_diagnostic_handler = vim.lsp.handlers[method]
     25             vim.lsp.handlers[method] = function(err, result, context, config)
     26               if err ~= nil and err.code == -32802 then
     27                 return
     28               end
     29               return default_diagnostic_handler(err, result, context, config)
     30             end
     31           end
     32         end,
     33       },
     34 
     35       -- Useful status updates for LSP
     36       {
     37         'j-hui/fidget.nvim',
     38         opts = {},
     39       },
     40 
     41       -- Additional lua configuration, makes nvim stuff amazing
     42       {
     43         'folke/neodev.nvim',
     44         opts = {
     45           library = { plugins = { "nvim-dap-ui" }, types = true },
     46         },
     47       }
     48     },
     49   },
     50 
     51   {
     52     'jose-elias-alvarez/null-ls.nvim',
     53     config = function()
     54       local null_ls = require('null-ls')
     55       null_ls.setup { sources = {
     56         null_ls.builtins.diagnostics.shellcheck,
     57         null_ls.builtins.code_actions.shellcheck,
     58         null_ls.builtins.diagnostics.phpcs,
     59         -- null_ls.builtins.diagnostics.vacuum,
     60         null_ls.builtins.diagnostics.yamllint.with({
     61           extra_args = {
     62             "-d", [[{
     63               extends: default,
     64               rules: {
     65                 line-length: {max: 160},
     66                 document-start: disable,
     67                 comments: {
     68                   min-spaces-from-content: 1,
     69                 },
     70               }
     71               }]]
     72           }
     73         }),
     74         null_ls.builtins.diagnostics.checkmake,
     75         null_ls.builtins.diagnostics.flake8.with({
     76           extra_args = { "--max-line-length", "130" },
     77         }),
     78         -- null_ls.builtins.diagnostics.pylint,
     79         null_ls.builtins.diagnostics.ansiblelint,
     80       } }
     81     end,
     82   },
     83 
     84   { -- Autocompletion
     85     'hrsh7th/nvim-cmp',
     86     config = function()
     87       require 'config.nvim-cmp'
     88     end,
     89     dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'zjp-CN/nvim-cmp-lsp-rs' },
     90   },
     91 
     92   { -- Highlight, edit, and navigate code
     93     'nvim-treesitter/nvim-treesitter',
     94     build = function()
     95       pcall(require('nvim-treesitter.install').update { with_sync = true })
     96     end,
     97     config = function()
     98       require 'config.nvim-treesitter'
     99     end,
    100   },
    101 
    102   -- Additional text objects via treesitter
    103   'nvim-treesitter/nvim-treesitter-textobjects',
    104 
    105   {
    106     'lewis6991/gitsigns.nvim',
    107     opts = {
    108       signs = {
    109         add = { text = '+' },
    110         change = { text = '~' },
    111         delete = { text = '_' },
    112         topdelete = { text = '‾' },
    113         changedelete = { text = '~' },
    114       },
    115       on_attach = function()
    116         vim.keymap.set('n', ']c', function() require('gitsigns').next_hunk() end, { buffer = true })
    117         vim.keymap.set('n', '[c', function() require('gitsigns').prev_hunk() end, { buffer = true })
    118         vim.keymap.set('n', ']=', function() require('gitsigns').toggle_deleted() end, { buffer = true })
    119         vim.keymap.set('n', ']~', function() require('gitsigns').diffthis() end, { buffer = true })
    120         vim.keymap.set('n', ']-', function() require('gitsigns').preview_hunk() end, { buffer = true })
    121         vim.keymap.set('n', ']+', function() require('gitsigns').select_hunk() end, { buffer = true })
    122       end,
    123     },
    124   },
    125 
    126 
    127   { -- Add indentation guides even on blank lines
    128     'lukas-reineke/indent-blankline.nvim',
    129     main = 'ibl',
    130     opts = {
    131       indent = {
    132         char = '┊',
    133       },
    134     }
    135   },
    136 
    137   {
    138     'numToStr/Comment.nvim', -- "gc" to comment visual regions/lines
    139     opts = {}
    140   },
    141 
    142   -- Fuzzy Finder (files, lsp, etc)
    143   {
    144     'nvim-telescope/telescope.nvim',
    145     dependencies = { 'nvim-lua/plenary.nvim' },
    146     config = function()
    147       require 'config.telescope'
    148     end,
    149   },
    150 
    151   -- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
    152   {
    153     'nvim-telescope/telescope-fzf-native.nvim',
    154     build = 'make',
    155     cond = vim.fn.executable 'make' == 1
    156   },
    157 
    158   {
    159     "debugloop/telescope-undo.nvim",
    160     dependencies = { -- note how they're inverted to above example
    161       {
    162         "nvim-telescope/telescope.nvim",
    163         dependencies = { "nvim-lua/plenary.nvim" },
    164       },
    165     },
    166     keys = {
    167       { -- lazy style key map
    168         "<leader>U",
    169         "<cmd>Telescope undo<cr>",
    170         desc = "undo history",
    171       },
    172     },
    173     opts = {
    174       -- don't use `defaults = { }` here, do this in the main telescope spec
    175       extensions = {
    176         undo = {
    177           mappings = {
    178             i = {
    179               ["<cr>"] = function(bufnr)
    180                 return require("telescope-undo.actions").restore(bufnr)
    181               end,
    182               ["<C-y>"] = function(bufnr)
    183                 return require("telescope-undo.actions").yank_additions(bufnr)
    184               end,
    185             },
    186             n = {
    187               ["<cr>"] = function(bufnr)
    188                 return require("telescope-undo.actions").restore(bufnr)
    189               end,
    190               ["y"] = function(bufnr)
    191                 return require("telescope-undo.actions").yank_additions(bufnr)
    192               end,
    193             },
    194           },
    195         },
    196         -- no other extensions here, they can have their own spec too
    197       },
    198     },
    199     config = function(_, opts)
    200       -- Calling telescope's setup from multiple specs does not hurt, it will happily merge the
    201       -- configs for us. We won't use data, as everything is in it's own namespace (telescope
    202       -- defaults, as well as each extension).
    203       require("telescope").setup(opts)
    204       require("telescope").load_extension("undo")
    205     end,
    206   },
    207 
    208   {
    209     "folke/which-key.nvim",
    210     config = function()
    211       vim.o.timeout = true
    212       vim.o.timeoutlen = 300
    213       require("which-key").setup()
    214     end
    215   },
    216 
    217   -- DAP: debugging
    218   {
    219     'mfussenegger/nvim-dap',
    220     config = function()
    221       require 'config.nvim-dap'
    222     end
    223   },
    224   {
    225     'mfussenegger/nvim-dap-python',
    226     config = function()
    227       require('dap-python').setup(vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python")
    228     end
    229   },
    230   {
    231     "rcarriga/nvim-dap-ui",
    232     dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
    233     config = function()
    234       require 'config.nvim-dap-ui'
    235     end
    236   },
    237 
    238   {
    239     'theHamsta/nvim-dap-virtual-text',
    240     dependencies = { "mfussenegger/nvim-dap", "nvim-treesitter/nvim-treesitter" },
    241     config = function()
    242       require("nvim-dap-virtual-text").setup()
    243     end
    244   },
    245 
    246   {
    247     'Eandrju/cellular-automaton.nvim',
    248     config = function()
    249       vim.keymap.set('n', 'q:', '<cmd>CellularAutomaton make_it_rain<CR>')
    250     end
    251   },
    252 
    253   {
    254     "folke/flash.nvim",
    255     event = "VeryLazy",
    256     ---@type Flash.Config
    257     opts = {
    258       search = {
    259         trigger = "\\",
    260       }
    261     },
    262     -- stylua: ignore
    263     keys = {
    264       { "<leader><leader>s", mode = { "n", "x", "o" }, function() require("flash").jump() end,              desc = "Flash" },
    265       { "<leader>S",         mode = { "n", "o", "x" }, function() require("flash").treesitter() end,        desc = "Flash Treesitter" },
    266       { "r",                 mode = "o",               function() require("flash").remote() end,            desc = "Remote Flash" },
    267       { "R",                 mode = { "o", "x" },      function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
    268       { "<c-s>",             mode = { "c" },           function() require("flash").toggle() end,            desc = "Toggle Flash Search" },
    269     },
    270   },
    271 
    272   {
    273     'mhartington/formatter.nvim',
    274     config = function()
    275       require("formatter").setup {
    276         filetype = { yaml = { require("formatter.filetypes.yaml").yamlfmt } }
    277       }
    278     end,
    279   },
    280 
    281   {
    282     "ray-x/lsp_signature.nvim",
    283     event = "VeryLazy",
    284     opts = {},
    285     config = function(_, opts) require 'lsp_signature'.setup(opts) end
    286   },
    287 
    288   -- LSP diagnostics at your corner.
    289   -- Messes up visual selection..
    290   -- { 'RaafatTurki/corn.nvim',
    291   --   opts = {},
    292   -- },
    293   {
    294     'dgagn/diagflow.nvim',
    295     opts = {},
    296     event = "VeryLazy",
    297   },
    298 
    299   {
    300     'stevearc/aerial.nvim',
    301     opts = {
    302       backends = { "lsp", "treesitter", "markdown", "man" },
    303       filter_kind = false,
    304     },
    305     -- Optional dependencies
    306     dependencies = {
    307       "nvim-treesitter/nvim-treesitter",
    308       "nvim-tree/nvim-web-devicons"
    309     },
    310     keys = {
    311       { "<leader>tt", "<cmd>AerialToggle!<cr>", desc = "Toggle tagbar" },
    312       { "<leader>to", "<cmd>AerialOpen<cr>",    desc = "Open and jump to tagbar" },
    313     },
    314   },
    315   {
    316     "nvim-treesitter/nvim-treesitter-context",
    317     dependencies = { "nvim-treesitter/nvim-treesitter" },
    318     config = function()
    319       require("treesitter-context").setup()
    320     end
    321   },
    322 
    323   -- diagnostics
    324   {
    325     "folke/trouble.nvim",
    326     branch = "dev", -- IMPORTANT!
    327     keys = {
    328       {
    329         "<leader>xx",
    330         "<cmd>Trouble diagnostics toggle<cr>",
    331         desc = "Diagnostics (Trouble)",
    332       },
    333       {
    334         "<leader>xb",
    335         "<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
    336         desc = "Buffer Diagnostics (Trouble)",
    337       },
    338       {
    339         "<leader>xs",
    340         "<cmd>Trouble symbols toggle focus=false<cr>",
    341         desc = "Symbols (Trouble)",
    342       },
    343       {
    344         "<leader>xd",
    345         "<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
    346         desc = "LSP Definitions / references / ... (Trouble)",
    347       },
    348       {
    349         "<leader>xl",
    350         "<cmd>Trouble loclist toggle<cr>",
    351         desc = "Location List (Trouble)",
    352       },
    353       {
    354         "<leader>xq",
    355         "<cmd>Trouble qflist toggle<cr>",
    356         desc = "Quickfix List (Trouble)",
    357       },
    358     },
    359     opts = {}, -- for default options, refer to the configuration section for custom setup.
    360   },
    361   {
    362     "echasnovski/mini.align",
    363     opts = {
    364       mappings = {
    365         start_with_preview = 'ga',
    366       },
    367     },
    368   },
    369   {
    370     "echasnovski/mini.ai",
    371     opts = {},
    372     event = "VeryLazy",
    373   },
    374   {
    375     "echasnovski/mini.animate",
    376     config = function()
    377       local animate = require('mini.animate')
    378       animate.setup({
    379         cursor = {
    380           enable = false,
    381         },
    382         scroll = {
    383           enable = false,
    384           timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
    385         },
    386         resize = {
    387           enable = false,
    388           timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
    389         },
    390         open = {
    391           enable = false,
    392         },
    393         close = {
    394           enable = false,
    395         },
    396       })
    397     end,
    398     version = false,
    399   },
    400   {
    401     "m00qek/baleia.nvim",
    402     version = "*",
    403     config = function()
    404       vim.g.baleia = require("baleia").setup({})
    405 
    406       -- Command to colorize the current buffer
    407       vim.api.nvim_create_user_command("BaleiaColorize", function()
    408         vim.g.baleia.once(vim.api.nvim_get_current_buf())
    409       end, { bang = true })
    410 
    411       -- Command to show logs
    412       vim.api.nvim_create_user_command("BaleiaLogs", vim.g.baleia.logger.show, { bang = true })
    413     end,
    414   },
    415   {
    416     "OXY2DEV/markview.nvim",
    417     lazy = false, -- Not needed, already handled by plugin
    418 
    419     dependencies = {
    420       "nvim-treesitter/nvim-treesitter",
    421       "nvim-tree/nvim-web-devicons"
    422     }
    423   },
    424   { -- Autoformat
    425     'stevearc/conform.nvim',
    426     event = { 'BufWritePre' },
    427     cmd = { 'ConformInfo' },
    428     keys = {
    429       {
    430         'gQ',
    431         function()
    432           require('conform').format { async = true, lsp_fallback = true }
    433         end,
    434         mode = '',
    435         desc = '[F]ormat buffer',
    436       },
    437     },
    438     opts = {
    439       notify_on_error = false,
    440       format_on_save = function(bufnr)
    441         -- Disable "format_on_save lsp_fallback" for languages that don't
    442         -- have a well standardized coding style. You can add additional
    443         -- languages here or re-enable it for the disabled ones.
    444         local disable_filetypes = { c = true, cpp = true }
    445         return {
    446           timeout_ms = 500,
    447           lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
    448         }
    449       end,
    450       formatters = {
    451         ruff_format = {
    452           inherit = true,
    453           append_args = { "--config", "~/Documents/cdmi/automation/meta-files/ruff.toml" },
    454         },
    455       },
    456       formatters_by_ft = {
    457         rust = { "rustfmt", lsp_format = "fallback" },
    458         ruby = { "rubyfmt", lsp_format = "fallback" },
    459         python = { "ruff_format", "ruff_organize_imports", lsp_format = "fallback" },
    460         -- python = { "black", lsp_format = "fallback" },
    461         --   -- lua = { 'stylua' },
    462         --   -- Conform can also run multiple formatters sequentially
    463         --   -- python = { "isort", "black" },
    464         --   --
    465         --   -- You can use 'stop_after_first' to run the first available formatter from the list
    466         --   -- javascript = { "prettierd", "prettier", stop_after_first = true },
    467       },
    468     },
    469   },
    470 }