From 4c1b83a9cf7c3708a8e95c8c5978768177c7f1b1 Mon Sep 17 00:00:00 2001 From: kkard2 Date: Sun, 30 Jul 2023 22:13:49 +0200 Subject: mostly done nvim i think? --- nvim/lazy-lock.json | 10 ++++++++ nvim/lua/kkard2/lazy.lua | 58 +++++++++++++++++++++++++++++++++++++++++--- nvim/lua/kkard2/lazy/lsp.lua | 19 +++++++++++++++ 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 nvim/lua/kkard2/lazy/lsp.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index e8a470f..50309a5 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,9 +1,19 @@ { + "LuaSnip": { "branch": "master", "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" }, "catppuccin": { "branch": "main", "commit": "057c34f849cf21059487d849e2f3b3efcd4ee0eb" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, + "lsp-zero.nvim": { "branch": "v2.x", "commit": "73bc33fe9ad5a1d4501536fdd4755b3aa18c3392" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, + "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, + "mini.trailspace": { "branch": "main", "commit": "c41ab1035d184ff20c1aebd76639320c055afebe" }, + "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, + "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, "nvim-treesitter": { "branch": "master", "commit": "e8648569d82c7bb46dc511cda9dbec687774461f" }, + "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, + "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" } } \ No newline at end of file diff --git a/nvim/lua/kkard2/lazy.lua b/nvim/lua/kkard2/lazy.lua index 3061152..9b73d64 100644 --- a/nvim/lua/kkard2/lazy.lua +++ b/nvim/lua/kkard2/lazy.lua @@ -1,5 +1,5 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then vim.fn.system({ "git", "clone", @@ -25,8 +25,9 @@ require("lazy").setup({ lazy = false, config = require("kkard2.lazy.treesitter"), }, - { - "mbbill/undotree", keys = { + { + "mbbill/undotree", + keys = { { "ut", "UndotreeToggleh" }, } }, @@ -39,5 +40,54 @@ require("lazy").setup({ "nvim-telescope/telescope.nvim", tag = "0.1.2", dependencies = { "nvim-lua/plenary.nvim" }, - } + keys = { + { "", "Telescope find_files" }, + { "fg", "Telescope live_grep" }, + { "fh", "Telescope help_tags" }, + }, + }, + { + "VonHeikemen/lsp-zero.nvim", + branch = "v2.x", + dependencies = { + -- LSP Support + { "neovim/nvim-lspconfig" }, -- Required + { "williamboman/mason.nvim" }, -- Optional + { "williamboman/mason-lspconfig.nvim" }, -- Optional + + -- Autocompletion + { "hrsh7th/nvim-cmp" }, -- Required + { "hrsh7th/cmp-nvim-lsp" }, -- Required + { "L3MON4D3/LuaSnip" }, -- Required + }, + config = require("kkard2.lazy.lsp"), + }, + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = { + icons = false, + fold_open = "-", -- icon used for open folds + fold_closed = "+", -- icon used for closed folds + indent_lines = false, -- add an indent guide below the fold icons + signs = { + -- icons / text used for a diagnostic + error = "E", + warning = "W", + hint = "H", + information = "I" + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + }, + keys = { + { "xx", function() require("trouble").open() end }, + { "xw", function() require("trouble").open("workspace_diagnostics") end }, + { "xd", function() require("trouble").open("document_diagnostics") end }, + }, + }, + { + lazy = false, + "echasnovski/mini.trailspace", + config = function() require("mini.trailspace").setup() end, + }, }) diff --git a/nvim/lua/kkard2/lazy/lsp.lua b/nvim/lua/kkard2/lazy/lsp.lua new file mode 100644 index 0000000..08d22d1 --- /dev/null +++ b/nvim/lua/kkard2/lazy/lsp.lua @@ -0,0 +1,19 @@ +return function() + local lsp = require("lsp-zero").preset({}) + + lsp.on_attach(function(_, bufnr) + -- see :help lsp-zero-keybindings + -- to learn the available actions + lsp.default_keymaps({ buffer = bufnr }) + end) + + -- (Optional) Configure lua language server for neovim + require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls()) + + lsp.setup() + + vim.keymap.set("n", "gh", vim.diagnostic.open_float) + vim.keymap.set("n", "lr", vim.lsp.buf.rename) + vim.keymap.set("n", "", vim.lsp.buf.code_action) + vim.keymap.set("n", "lf", vim.lsp.buf.format) +end -- cgit v1.3.1