dotfiles

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

plugins.lua (13670B)


      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     opts = {
    319       enable = false,
    320     },
    321     keys = {
    322       { "<leader>^", function() require('treesitter-context').toggle() end, desc = "Context" },
    323     },
    324   },
    325 
    326   -- diagnostics
    327   {
    328     "folke/trouble.nvim",
    329     branch = "dev", -- IMPORTANT!
    330     keys = {
    331       {
    332         "<leader>xx",
    333         "<cmd>Trouble diagnostics toggle<cr>",
    334         desc = "Diagnostics (Trouble)",
    335       },
    336       {
    337         "<leader>xb",
    338         "<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
    339         desc = "Buffer Diagnostics (Trouble)",
    340       },
    341       {
    342         "<leader>xs",
    343         "<cmd>Trouble symbols toggle focus=false<cr>",
    344         desc = "Symbols (Trouble)",
    345       },
    346       {
    347         "<leader>xd",
    348         "<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
    349         desc = "LSP Definitions / references / ... (Trouble)",
    350       },
    351       {
    352         "<leader>xl",
    353         "<cmd>Trouble loclist toggle<cr>",
    354         desc = "Location List (Trouble)",
    355       },
    356       {
    357         "<leader>xq",
    358         "<cmd>Trouble qflist toggle<cr>",
    359         desc = "Quickfix List (Trouble)",
    360       },
    361     },
    362     opts = {}, -- for default options, refer to the configuration section for custom setup.
    363   },
    364   {
    365     "echasnovski/mini.align",
    366     opts = {
    367       mappings = {
    368         start_with_preview = 'ga',
    369       },
    370     },
    371   },
    372   {
    373     "echasnovski/mini.ai",
    374     opts = {},
    375     event = "VeryLazy",
    376   },
    377   {
    378     "echasnovski/mini.animate",
    379     config = function()
    380       local animate = require('mini.animate')
    381       animate.setup({
    382         cursor = {
    383           enable = false,
    384         },
    385         scroll = {
    386           enable = true,
    387           timing = animate.gen_timing.linear({ duration = 50, unit = 'total' }),
    388         },
    389         resize = {
    390           enable = false,
    391         },
    392         open = {
    393           enable = false,
    394         },
    395         close = {
    396           enable = false,
    397         },
    398       })
    399     end,
    400     version = false,
    401   },
    402   {
    403     "m00qek/baleia.nvim",
    404     version = "*",
    405     config = function()
    406       vim.g.baleia = require("baleia").setup({})
    407 
    408       -- Command to colorize the current buffer
    409       vim.api.nvim_create_user_command("BaleiaColorize", function()
    410         vim.g.baleia.once(vim.api.nvim_get_current_buf())
    411       end, { bang = true })
    412 
    413       -- Command to show logs
    414       vim.api.nvim_create_user_command("BaleiaLogs", vim.g.baleia.logger.show, { bang = true })
    415     end,
    416   },
    417   { -- Autoformat
    418     'stevearc/conform.nvim',
    419     event = { 'BufWritePre' },
    420     cmd = { 'ConformInfo' },
    421     keys = {
    422       {
    423         'gQ',
    424         function()
    425           require('conform').format { async = true, lsp_fallback = true }
    426         end,
    427         mode = '',
    428         desc = '[F]ormat buffer',
    429       },
    430     },
    431     opts = {
    432       notify_on_error = false,
    433       format_on_save = function(bufnr)
    434         -- Disable "format_on_save lsp_fallback" for languages that don't
    435         -- have a well standardized coding style. You can add additional
    436         -- languages here or re-enable it for the disabled ones.
    437         local disable_filetypes = { c = true, cpp = true }
    438         return {
    439           timeout_ms = 500,
    440           lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
    441         }
    442       end,
    443       formatters = {
    444         ruff_format = {
    445           inherit = true,
    446           append_args = { "--config", "~/Documents/cdmi/automation/meta-files/ruff.toml" },
    447         },
    448       },
    449       formatters_by_ft = {
    450         rust = { "rustfmt", lsp_format = "fallback" },
    451         ruby = { "rubyfmt", lsp_format = "fallback" },
    452         python = { "ruff_format", "ruff_organize_imports", lsp_format = "fallback" },
    453         lua = { "stylua" },
    454         -- python = { "black", lsp_format = "fallback" },
    455         --   -- lua = { 'stylua' },
    456         --   -- Conform can also run multiple formatters sequentially
    457         --   -- python = { "isort", "black" },
    458         --   --
    459         --   -- You can use 'stop_after_first' to run the first available formatter from the list
    460         --   -- javascript = { "prettierd", "prettier", stop_after_first = true },
    461       },
    462     },
    463   },
    464   {
    465     'sphamba/smear-cursor.nvim',
    466     opts = {
    467       cursor_color = '#a4a4a4',
    468       legacy_computing_symbols_support = true,
    469       stiffness = 0.8,               -- 0.6      [0, 1]
    470       trailing_stiffness = 0.5,      -- 0.3      [0, 1]
    471       distance_stop_animating = 0.5, -- 0.1      > 0
    472     },
    473   },
    474   {
    475     'max397574/colortils.nvim',
    476     event = "VeryLazy",
    477     opts = {
    478       register = "0",
    479     },
    480   },
    481 }