From 4c1a71c1dfb94ba936b0000d1acf847f3cd48f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Viau-Trudel?= Date: Sat, 15 Nov 2025 23:40:52 -0500 Subject: [PATCH] enable lsp + a bunch of other things --- REFERENCES.md | 3 +++ TODO.md | 14 ++++++++++++-- init.lua | 2 +- lazy-lock.json | 4 ++++ lua/config/keymap.lua | 16 +++++++++++++++- lua/config/lsp.lua | 0 lua/config/options.lua | 4 ++-- lua/plugins/lspconfig.lua.bak | 3 +++ lua/plugins/mason-lspconfig.lua | 14 ++++++++++++++ lua/plugins/mason.lua.bak | 4 ++++ lua/plugins/rustacean.lua | 5 +++++ 11 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 lua/config/lsp.lua create mode 100644 lua/plugins/lspconfig.lua.bak create mode 100644 lua/plugins/mason-lspconfig.lua create mode 100644 lua/plugins/mason.lua.bak create mode 100644 lua/plugins/rustacean.lua diff --git a/REFERENCES.md b/REFERENCES.md index 5a679a5..b40e6c9 100644 --- a/REFERENCES.md +++ b/REFERENCES.md @@ -1,6 +1,9 @@ ## References + - [Recent (2025-11-15) example of lsp setup](https://www.youtube.com/watch?v=oBiBEx7L000) + - [Example of rust + lsp](https://www.youtube.com/watch?v=E2mKJ73M9pg) + - [Example of rust with nvim + lsp ](https://www.youtube.com/watch?v=E2mKJ73M9pg) - https://www.youtube.com/watch?v=g1gyYttzxcI diff --git a/TODO.md b/TODO.md index 0d7a2fe..e30a01d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,17 @@ # Problems and missing features +## which packages should I use? + + - [ ] telescope: Install and learn how to use + - [ ] cmp-nvim or cmp-nvim-lsp or ... (autocompletion) + +## lsp + + - [ ] learn lsp provided capabilities and how to use it + - [ ] which shortcut should I use? + + ## Files browsing -- [ ] open oil in the current file directory -- [ ] see the current path of oil + - [ ] see the current path of oil diff --git a/init.lua b/init.lua index db3d321..02b5478 100644 --- a/init.lua +++ b/init.lua @@ -3,4 +3,4 @@ require("config.keymap") require("config.options") require("config.lazy") require("config.clipboard") - +require("config.lsp") diff --git a/lazy-lock.json b/lazy-lock.json index fe5c3c6..518cbd1 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,10 +1,14 @@ { "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, "mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" }, "mini.statusline": { "branch": "main", "commit": "e331175f10d9f400b42523b3890841aba202ce16" }, + "nvim-lspconfig": { "branch": "master", "commit": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, + "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, "smear-cursor.nvim": { "branch": "main", "commit": "abfa5835920b1d76c0e24e1465a618ad914be90a" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua index 1301f35..d3aa488 100644 --- a/lua/config/keymap.lua +++ b/lua/config/keymap.lua @@ -19,7 +19,21 @@ vim.keymap.set('n', "qq", "q!", { desc = "Force to quit without -- TERMINAL -- exit t mode km("t", "", "", { desc = "Exit terminal mode"}) -km("n", "t" , "term", { desc = "Create a terminal" } ) +km("n", "t" , function() +print("open terminal") + -- function OpenTerminal() + local dir = vim.fn.expand('%:p:h') -- if in a file + if vim.startswith(dir, 'oil://') then -- if in an Oil buffer + dir = string.sub(dir, 7) -- Strip 'oil://' prefix + if vim.api.nvim_buf_get_option(0, "buftype") == "nofile" then -- is in a float + vim.cmd.q() + end + end + vim.cmd('lcd ' .. dir) + vim.cmd('terminal') + end + , { desc = "Create a terminal in the current 'context'" } +) -- todo: this is not robust... add autocompletion and verify that file exists diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/config/options.lua b/lua/config/options.lua index 9c91c13..6db0398 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -6,8 +6,8 @@ vim.o.smartcase = true -- use vim ---vim.o.expandtab = true -- convert tab to spaces ---vim.o.shiftwidth = 4 +vim.o.expandtab = true -- convert tab to spaces +vim.o.shiftwidth = 4 vim.o.cursorline = true diff --git a/lua/plugins/lspconfig.lua.bak b/lua/plugins/lspconfig.lua.bak new file mode 100644 index 0000000..3657f57 --- /dev/null +++ b/lua/plugins/lspconfig.lua.bak @@ -0,0 +1,3 @@ +return { + "neovim/nvim-lspconfig" +} diff --git a/lua/plugins/mason-lspconfig.lua b/lua/plugins/mason-lspconfig.lua new file mode 100644 index 0000000..db48a71 --- /dev/null +++ b/lua/plugins/mason-lspconfig.lua @@ -0,0 +1,14 @@ +return { + "mason-org/mason-lspconfig.nvim", + opts = { + ensure_installed = { + "lua_ls", + "rust_analyzer", + "markdown_oxide" + }, + }, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, +} diff --git a/lua/plugins/mason.lua.bak b/lua/plugins/mason.lua.bak new file mode 100644 index 0000000..08a7e84 --- /dev/null +++ b/lua/plugins/mason.lua.bak @@ -0,0 +1,4 @@ +return { + "mason-org/mason.nvim", + opts = {} +} diff --git a/lua/plugins/rustacean.lua b/lua/plugins/rustacean.lua new file mode 100644 index 0000000..eb83332 --- /dev/null +++ b/lua/plugins/rustacean.lua @@ -0,0 +1,5 @@ +return { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy +}