From 0d78f3b576a2e99875b3e2c7d42f7beb6bf7632d Mon Sep 17 00:00:00 2001 From: Zam Kokott Date: Wed, 10 Dec 2025 14:46:41 +0000 Subject: [PATCH] Add which-key, lsp and dap and multiple keybinds --- init.lua | 5 ++++- lazy-lock.json | 2 ++ lua/plugins/linter.lua | 6 +++--- lua/plugins/lsp.lua | 18 +++++++++++++++++- lua/plugins/telescope.lua | 13 ++++++++++--- lua/plugins/which-key.lua | 2 +- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/init.lua b/init.lua index c9b7a35..41d8905 100644 --- a/init.lua +++ b/init.lua @@ -49,8 +49,9 @@ vim.api.nvim_create_autocmd('TermOpen', { local builtin = require("telescope.builtin") vim.keymap.set('n', 'fg', builtin.live_grep, { desc = "Telescope live grep" }) vim.keymap.set('n', 'gl', builtin.lsp_references, { desc = "Telescope show references" }) -vim.keymap.set('n', 'd', builtin.diagnostics, { desc = "Telescope open diagnostics" }) +vim.keymap.set('n', 'fx', builtin.diagnostics, { desc = "Telescope open diagnostics" }) vim.keymap.set('n', 'ff', builtin.find_files, { desc = "Telescope find files" }) +vim.keymap.set('n', 'fb', builtin.buffers, { desc = "Telescope open buffers" }) -- Formating vim.keymap.set("n", "gf", function() @@ -69,6 +70,8 @@ end, { desc = "Neotest open summary" }) vim.keymap.set("n", "to", neotest.output.open, { desc = "Neotest open output" }) vim.keymap.set("n", "td", function() neotest.run.run({ suite = false, strategy = "dap" }) end, { desc = "Neotest debug closest test" }) +vim.keymap.set("n", "tr", function() neotest.run.run({ suite = false }) end, + { desc = "Neotest run closest test" }) -- Debugging local dap = require("dap") diff --git a/lazy-lock.json b/lazy-lock.json index f4cda2e..d1314c0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,6 +25,8 @@ "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "ripgrep": { "branch": "master", "commit": "cd1f981beafaeb9b61537e47e91314cea125400b" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "08e65d82d48416ab140b3dea26eea4fb9739bc47" }, diff --git a/lua/plugins/linter.lua b/lua/plugins/linter.lua index 38800db..873fbb5 100644 --- a/lua/plugins/linter.lua +++ b/lua/plugins/linter.lua @@ -6,11 +6,11 @@ return { python = { 'dmypy' } } + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { + group = lint_augroup, callback = function() - -- try_lint without arguments runs the linters defined in `linters_by_ft` - -- for the current filetype - require("lint").try_lint() + lint.try_lint() end, }) end diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index fcfb7b6..635d8c3 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,7 +1,23 @@ return { "neovim/nvim-lspconfig", config = function() - vim.lsp.enable({ "lua_ls", "jedi_language_server", "gopls", "html", "yamlls", "svelte-language-server", "clangd", + vim.lsp.enable({ "lua_ls", "basedpyright", "gopls", "html", "yamlls", "svelte-language-server", "clangd", "ansiblels", "vtsls" }) + + -- Testing basedpyright atm, change to jedi idk + vim.lsp.config("basedpyright", { + settings = { + ['basedpyright'] = { + analysis = { + typeCheckingMode = "basic", + inlayHints = { + variableTypes = true, + genericTypes = true, + }, + autoFormatStrings = true, + } + } + } + }) end } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 41583bb..31760c8 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -2,12 +2,17 @@ return { { 'nvim-telescope/telescope.nvim', tag = '0.1.6', - dependencies = { 'nvim-lua/plenary.nvim' }, + dependencies = { + 'nvim-lua/plenary.nvim', + 'BurntSushi/ripgrep', + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' } + }, }, { 'nvim-telescope/telescope-ui-select.nvim', config = function() - require("telescope").setup({ + local telescope = require("telescope") + telescope.setup({ extensions = { ["ui-select"] = { require("telescope.themes").get_dropdown { @@ -15,7 +20,9 @@ return { } } }) - require("telescope").load_extension("ui-select") + + telescope.load_extension("ui-select") + telescope.load_extension("fzf") end } } diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua index 52806d5..62125fe 100644 --- a/lua/plugins/which-key.lua +++ b/lua/plugins/which-key.lua @@ -19,7 +19,7 @@ return { local wk = require("which-key") wk.add({ { "d", group = "Debug" }, - { "f", group = "Files" }, + { "f", group = "Telescope" }, { "t", group = "Test" }, { "c", group = "Code" }, })