From a0cb5e82958dc71e1e33ccab57eca012b0b5d789 Mon Sep 17 00:00:00 2001 From: Benjamin Chaussé Date: Wed, 29 May 2024 16:39:14 -0400 Subject: lazy load cmp, more lsps and treesitter stuff --- lua/plugins/colorscheme.lua | 24 +++++++++++++++++++++++- lua/plugins/lsp.lua | 42 +++++++++++++++++++++++++++++++----------- lua/plugins/orgmode.lua | 2 ++ lua/plugins/resize.lua | 7 +++++-- lua/plugins/telescope.lua | 8 ++++++-- 5 files changed, 67 insertions(+), 16 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 1b08ce3..206e904 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -5,9 +5,31 @@ return { -- No nonsense, very stoic build = ":TSUpdate", config = function() local configs = require("nvim-treesitter.configs") +---@diagnostic disable-next-line: missing-fields configs.setup({ + -- List of languages in-> :h ensure_installed = { - "c", "go", "python", "yaml", "json", "lua", "vim", "graphql" + "c", + "go", + "bash", + "lua", + "python", + "vim", + "vimdoc", + "gitignore", + "mermaid", + "markdown", + "latex", + "rnoweb", + "r", + "rust", + "dockerfile", + "graphql", + "yaml", + "json", + "xml", + "sxhkdrc", + "zathurarc", }, ignore_install = { "javascript", "typescript" diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 9ed7bb1..d0b3712 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -27,6 +27,7 @@ return { "clangd", "marksman", "dockerls", + "ruff_lsp", "docker_compose_language_service", "rust_analyzer", } @@ -38,6 +39,7 @@ return { }, { "neovim/nvim-lspconfig", + veryLazy = true, dependencies = { "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", @@ -77,6 +79,9 @@ return { vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0, desc = "Go to the method implementation"}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {buffer=0, + desc = "Go to references of the object"}) + vim.keymap.set("n", "fa", vim.lsp.buf.code_action, {buffer=0, desc = ""}) vim.keymap.set("n", "]d", vim.diagnostic.goto_next, {buffer=0, @@ -85,23 +90,34 @@ return { vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, {buffer=0, desc = "Go to the previous diagnostic/issue"}) - vim.keymap.set("n", "H", vim.diagnostic.open_float, {buffer=0, + -- S is the same as cc, I'd rather use it for something more useful + vim.keymap.set("n", "S", vim.diagnostic.open_float, {buffer=0, desc = "View diagnostics information in a floating window"}) end -- Configure every lsp installed and managed by mason -- TODO: automate this with a global myServers table - lsp["gopls"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["golangci_lint_ls"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["rust_analyzer"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["clangd"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["bashls"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["graphql"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["texlab"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["marksman"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["dockerls"].setup({ capabilities=lspCaps, on_attach=lspMaps }) - lsp["docker_compose_language_service"].setup({ capabilities=lspCaps, on_attach=lspMaps }) + local myServers = { + "gopls", + "golangci_lint_ls", + "lua_ls", + "bashls", + "dockerls", + "docker_compose_language_service", + "graphql", + "texlab", + "ruff_lsp", + "clangd", + "marksman", + } + for _, server in ipairs(myServers) do + lsp[server].setup({ + capabilities = lspCaps, + on_attach = lspMaps + }) + end + -- Non standard language settings: lsp.lua_ls.setup({ capabilities = lspCaps, @@ -121,8 +137,12 @@ return { } }, workspace = { + checkThirdParty = false, library = vim.api.nvim_get_runtime_file("", true), }, + telemetry = { + enable = false + } } } }) diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index d6f3ac0..b6259ca 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -14,6 +14,8 @@ return { -- local Menu = require("org-modern.menu") -- Setup orgmode require('orgmode').setup({ + -- win_split_mode = {'float', 0.9}, + win_split_mode = 'float', org_agenda_files = '~/Dropbox/org/**/*', org_default_notes_file = '~/Dropbox/org/index.org', emacs_config = { diff --git a/lua/plugins/resize.lua b/lua/plugins/resize.lua index 27ea5ea..b08ca4c 100644 --- a/lua/plugins/resize.lua +++ b/lua/plugins/resize.lua @@ -1,7 +1,10 @@ return { "simeji/winresizer", config = function() - vim.keymap.set("n", "", "WinResizerStartResize" ) + vim.g.winresizer_vert_resize = 13 + vim.g.winresizer_horiz_resize = 10 end, - keys = {""}, + keys = { + {"w", "WinResizerStartResize"} + } } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index ddf8a5e..4aac81d 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -12,13 +12,17 @@ return { telescope.load_extension("fzf") end, keys = { - -- P.roject F.iles + -- P.aruse F.iles { "pv", 'lua require("telescope.builtin").find_files()' }, + -- P.aruse B.uffers + { "pb", 'lua require("telescope.builtin").buffers()' }, + -- P.aruse with G.rep + { "pg", 'lua require("telescope.builtin").live_grep()' }, -- P.roject S.earch { "ps", 'lua require("telescope.builtin").grep_string({search = vim.fn.input("Grep > ")})' }, -- F.ind Q.uickfix { "qf", 'lua require("telescope.builtin").quickfix()' }, - -- F.ind G.it (files known to git / not ignored or untracked) + -- Find Git (files known to git / not ignored or untracked) { "", 'lua require("telescope.builtin").git_files()' }, -- F.ind B.ranch { "fb", 'lua require("telescope.builtin").grep_branches()' }, -- cgit v1.2.3