From caa5457b6865c2f03d9c160c0f92062272b4e39d Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Sat, 22 Jul 2023 15:40:45 +0200 Subject: [PATCH] Refactor neovim config --- nvim/lazy-lock.json | 5 +- nvim/lua/plugins.lua | 139 +++++++++++++++++++++++-------------------- 2 files changed, 77 insertions(+), 67 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 78b46b4..3dde187 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -20,11 +20,10 @@ "nvim-dap": { "branch": "master", "commit": "d17d1bba23ec72a157bd183c57840c39e323f515" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, "nvim-lspconfig": { "branch": "master", "commit": "dd11ba7b3c8f82d51b6d4dd7d68fce2d78bf78a0" }, - "nvim-treesitter": { "branch": "master", "commit": "a8ac8419c420f3564e5212ecbeba3283cfa9e78e" }, + "nvim-treesitter": { "branch": "master", "commit": "7b04e8b67eec7d92daadf9f0717dd272ddfc81a3" }, "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, - "typst.vim": { "branch": "main", "commit": "6a99324a138c2da69589a8ab2e49375774e43d77" } + "telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" } } \ No newline at end of file diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 5bde932..3c03c20 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -22,6 +22,17 @@ return { end, }, + -- File tree + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + }, + -- Telescope { "nvim-telescope/telescope.nvim", @@ -38,6 +49,24 @@ return { end, }, + -- Git diffviewer + { + "sindrets/diffview.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + }, + }, + + -- Git signs + { + "lewis6991/gitsigns.nvim", + config = function() + local gitsigns = require("gitsigns") + gitsigns.setup() + end, + }, + -- Discord presence { "andweeb/presence.nvim", @@ -103,149 +132,131 @@ return { -- Snippet engine { - "saadparwaiz1/cmp_luasnip", - dependencies = { - "L3MON4D3/LuaSnip", - } + "L3MON4D3/LuaSnip", + version = "2.*", }, + -- Completion { "hrsh7th/nvim-cmp", - config = require "configs/cmp", dependencies = { "hrsh7th/cmp-cmdline", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", "saadparwaiz1/cmp_luasnip", }, + config = require("configs/cmp"), }, - { - "hrsh7th/cmp-nvim-lsp", - }, - -- DAP + + -- Debugger adapter support { "mfussenegger/nvim-dap", config = function() - local dap = require "dap" + local dap = require("dap") vim.keymap.set('n', "b", dap.toggle_breakpoint) end, }, + + -- Debugger UI { "rcarriga/nvim-dap-ui", - config = require "configs/debugging", + config = require("configs/debugging"), dependencies = { "mfussenegger/nvim-dap", }, }, + -- Mason { "williamboman/mason.nvim", config = function() - require("mason").setup() + local mason = require("mason") + mason.setup() end, }, + + -- Automatic language server install { "williamboman/mason-lspconfig.nvim", + dependencies = { + "williamboman/mason.nvim", + "neovim/nvim-lspconfig", + }, config = function() - local mason = require "mason-lspconfig" - mason.setup({ + local config = require("mason-lspconfig") + config.setup({ automatic_installation = true, + -- NOTE + -- Haskell: Use GHCup installation instead of hls ensure_installed = { "lua_ls", -- Lua "rust_analyzer", -- Rust - -- "hls", -- use GHCup instead "html", -- HTML "cssls", -- CSS / SCSS "tsserver", -- TypeScript "astro", -- Astro "svelte", -- Svelte "pyright", -- Python - "typst_lsp", -- Typst "rnix", -- Nix }, }) - local lsp = require "lspconfig" + local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").default_capabilities() - mason.setup_handlers({ + config.setup_handlers({ function(server) - lsp[server].setup({ + lspconfig[server].setup({ single_file_support = true, capabilities = capabilities, }) end, ["lua_ls"] = function() - lsp.lua_ls.setup({ + lspconfig.lua_ls.setup({ single_file_support = true, capabilities = capabilities, - settings = { - Lua = { diagnostics = { globals = { "vim" } } } - }, + settings = { Lua = { diagnostics = { globals = { "vim" } } } }, }) end, }) end, - dependencies = { - "williamboman/mason.nvim", - "neovim/nvim-lspconfig", - }, }, + + -- Automatic debugger install { "jay-babu/mason-nvim-dap.nvim", + dependencies = { + "mfussenegger/nvim-dap", + "williamboman/mason.nvim", + }, config = function() - require("mason-nvim-dap").setup({ + local config = require("mason-nvim-dap") + config.setup({ automatic_installation = true, ensure_installed = { "codelldb", -- Rust }, }) end, - dependencies = { - "mfussenegger/nvim-dap", - "williamboman/mason.nvim", - }, }, - -- Rust tools + + -- Tools for Rust { "simrat39/rust-tools.nvim", - config = require "configs/rust-tools", + ft = "rust", + config = require("configs/rust-tools"), }, - -- Haskell tools + + -- Tools for Haskell { "mrcjkb/haskell-tools.nvim", + branch = "1.x.x", + ft = "haskell", dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope.nvim", }, - branch = "1.x.x", - }, - -- Typst - { - "kaarmu/typst.vim", - ft = "typst", - }, - -- File tree - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - }, - -- Git - { - "sindrets/diffview.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - }, - { - "lewis6991/gitsigns.nvim", - config = function() - require("gitsigns").setup() - end, }, + }