From cc390f17eb083cd1e7eaff234c8a36685084aad7 Mon Sep 17 00:00:00 2001 From: Fey Naomi Schrewe Date: Sun, 8 Sep 2024 11:05:13 +0200 Subject: [PATCH] feat: add plugins --- default.nix | 2 +- lazy-lock.json | 34 ++++++----- lua/plugins.lua | 149 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 150 insertions(+), 35 deletions(-) diff --git a/default.nix b/default.nix index f8eba66..a5e626b 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ { pkgs ? import {} }: with pkgs; mkShell { - buildInputs = [ lua-language-server ]; + buildInputs = [ lua-language-server stylua ]; } diff --git a/lazy-lock.json b/lazy-lock.json index 85eb45c..c6c0aad 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,5 +1,5 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, @@ -7,23 +7,29 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "diffview.nvim": { "branch": "main", "commit": "72c6983f422689f310b379a04fd555799b0d7cfc" }, + "conform.nvim": { "branch": "master", "commit": "0ebe875d9c306f5fc829db38492ffff2a70d8e9d" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "direnv.vim": { "branch": "master", "commit": "ab2a7e08dd630060cd81d7946739ac7442a4f269" }, "drex.nvim": { "branch": "main", "commit": "acccc1225e61a3977d86a590420b868e708cc64a" }, - "lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" }, - "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, + "gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" }, + "lazy.nvim": { "branch": "main", "commit": "48b52b5cfcf8f88ed0aff8fde573a5cc20b1306d" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, "neogit": { "branch": "master", "commit": "bc0c609e3568a171e0549b449aa1b2b4b5b20e8c" }, - "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-dap": { "branch": "master", "commit": "5a2f7121869394502521c52b2bc581ab22c69447" }, - "nvim-lspconfig": { "branch": "master", "commit": "eadcee1573ca9d0e0cd36a49f620186a8dfdc607" }, - "nvim-surround": { "branch": "main", "commit": "79aaa42da1f698ed31bcbe7f83081f69dca7ba17" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-dap": { "branch": "master", "commit": "20a4859ebde1c9bc8e96f8cc11a20667e7fdd516" }, + "nvim-lspconfig": { "branch": "master", "commit": "bdbc65aadc708ce528efb22bca5f82a7cca6b54d" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, "nvim-test": { "branch": "main", "commit": "e06f3d029ee161f3ead6193cf27354d1eb8723c3" }, - "nvim-treesitter": { "branch": "master", "commit": "30de5e7e9486fb1b1b8c2a1e71052b13f94f1cb0" }, - "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "nvim-treesitter": { "branch": "master", "commit": "00f128dd73086aa578dc3d9142de06c633b7c685" }, + "nvim-web-devicons": { "branch": "master", "commit": "9793801f974bba70e4ac5d7eae6c4f5659993d8e" }, + "plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rose-pine": { "branch": "main", "commit": "b6fe88c3282cf9f117a3e836d761c2d78d02f417" }, + "rose-pine": { "branch": "main", "commit": "8b1fd252255a7f2c41b4192a787ab62660b29f72" }, "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, "suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" }, - "telescope.nvim": { "branch": "master", "commit": "4aed63995a69e343b068c7469491a8d1592c339f" } -} \ No newline at end of file + "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" } +} diff --git a/lua/plugins.lua b/lua/plugins.lua index d2a7395..21f4bb2 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,3 +1,21 @@ +local version = vim.version() + +local function hasversion(major, minor, patch) + if version.major < major then + return false + end + if minor == nil then + return true + end + if version.minor < minor then + return false + end + if patch == nil then + return true + end + return version.patch <= patch +end + return { { 'rose-pine/neovim', @@ -7,7 +25,11 @@ return { { "L3MON4D3/LuaSnip", version = "v2.*", - build = "make install_jsregexp" + build = "make install_jsregexp", + dependencies = { "rafamadriz/friendly-snippets" }, + config = function () + require("luasnip.loaders.from_vscode").lazy_load() + end }, 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp', @@ -19,15 +41,23 @@ return { config = function() require 'cmp-setup' end }, "lukas-reineke/cmp-under-comparator", - 'folke/neodev.nvim', - { 'neovim/nvim-lspconfig', config = function() require 'lsp-setup' end, after = 'neodev.nvim' }, + { 'neovim/nvim-lspconfig', config = function() require 'lsp-setup' end, dependencies = 'neodev.nvim' }, + { + "folke/neodev.nvim", + config = function() require 'neodev'.setup({ + override = function(_, library) + library.enabled = true + library.plugins = true + end, + }) end, + enabled = not hasversion(0, 10), + lazy = false + }, 'simrat39/rust-tools.nvim', 'mfussenegger/nvim-dap', { 'numToStr/Comment.nvim', - config = function() - require('Comment').setup() - end + opts = {} }, { "NeogitOrg/neogit", @@ -40,19 +70,17 @@ return { config = true, }, { - "ahmedkhalf/project.nvim", - config = function() - require("project_nvim").setup { - } - end + "ahmedkhalf/project.nvim", + opts = {}, + config = function (_, opts) + require 'gitsigns'.setup(opts) + end }, 'lambdalisue/suda.vim', { "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - config = function() - require("nvim-surround").setup({}) - end + version = "*", + opts = {} }, { 'nvim-treesitter/nvim-treesitter', @@ -66,10 +94,10 @@ return { }, { 'theblob42/drex.nvim', - dependencies = 'kyazdani42/nvim-web-devicons', - config = function() - vim.keymap.set('n', '', ':DrexDrawerToggle') - end + dependencies = 'nvim-tree/nvim-web-devicons', + keys = { + { '', ':DrexDrawerToggle', desc = 'Files', mode = 'n' } + } }, { "klen/nvim-test", @@ -77,5 +105,86 @@ return { require('nvim-test').setup() end }, - 'direnv/direnv.vim' + 'direnv/direnv.vim', + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + delay = function(ctx) + return ctx.plugin and 100 or 200 + end, + }, + keys = { + { + "?", + function() + require("which-key").show({ global = false }) + end, + desc = "Buffer Local Keymaps (which-key)", + }, + }, + }, + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require 'lualine'.setup() + end + }, + { + 'stevearc/conform.nvim', + config = function () + require("conform").setup({ + formatters_by_ft = { + lua = { 'stylua' }, + rust = { 'rustfmt', lsp_format = 'fallback' }, + -- javascript = { '', stop_after_first = true }, + }, + }) + end, + enabled = hasversion(0, 10), + }, + { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, + }, + { + 'lewis6991/gitsigns.nvim', + opts = { + current_line_blame = true + } + } }