From ed05721db180d8ccb337260b18d24de1de1519dc Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sun, 15 Jun 2025 19:18:36 -0700 Subject: [PATCH 1/3] Add F-key mappings to mostly match VSCode --- .config/nvim/init.lua | 22 ++++++++++++++++++++++ .config/nvim/lua/plugins/debugging.lua | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c72c318..6502efa 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -64,3 +64,25 @@ vim.keymap.set("n", "ce", ":Copilot enable", { desc = "Enable Copilo vim.keymap.set("n", "cd", ":Copilot disable", { desc = "Disable Copilot Completions" }) vim.keymap.set("n", "cc", ":CopilotChatToggle", { desc = "Toggle Copilot Chat" }) vim.keymap.set("n", "cx", ":CopilotChatReset", { desc = "Reset Copilot Chat" }) + +-- Configure f-key shortcuts +vim.keymap.set("n", "", vim.lsp.buf.hover) +vim.keymap.set("i", "", vim.lsp.buf.hover) +vim.keymap.set("n", "", vim.lsp.buf.rename) +vim.keymap.set("i", "", vim.lsp.buf.rename) +vim.keymap.set("n", "", "") +vim.keymap.set("i", "", "") +vim.keymap.set("n", "", "") +vim.keymap.set("i", "", "") +vim.keymap.set("n", "", ":BufferClose") +vim.keymap.set("i", "", ":BufferClose") +vim.keymap.set("n", "", ":Gitsigns next_hunk") +vim.keymap.set("i", "", ":Gitsigns next_hunk") +vim.keymap.set("n", "", ":Gitsigns prev_hunk") +vim.keymap.set("i", "", ":Gitsigns prev_hunk") +vim.keymap.set("n", "", vim.diagnostic.goto_next) +vim.keymap.set("i", "", vim.diagnostic.goto_next) +vim.keymap.set("n", "", vim.diagnostic.goto_prev) +vim.keymap.set("i", "", vim.diagnostic.goto_prev) +vim.keymap.set("n", "", vim.lsp.buf.definition) +vim.keymap.set("i", "", vim.lsp.buf.definition) diff --git a/.config/nvim/lua/plugins/debugging.lua b/.config/nvim/lua/plugins/debugging.lua index 5b1431e..444d39e 100644 --- a/.config/nvim/lua/plugins/debugging.lua +++ b/.config/nvim/lua/plugins/debugging.lua @@ -8,6 +8,14 @@ return { vim.keymap.set("n", "dc", dap.continue, { desc = "Start/Continue" }) vim.keymap.set("n", "do", dap.step_over, { desc = "Step Over" }) vim.keymap.set("n", "di", dap.step_into, { desc = "Step Into" }) + vim.keymap.set("n", "", dap.toggle_breakpoint) + vim.keymap.set("i", "", dap.toggle_breakpoint) + vim.keymap.set("n", "", dap.continue) + vim.keymap.set("i", "", dap.continue) + vim.keymap.set("n", "", dap.step_over) + vim.keymap.set("i", "", dap.step_over) + vim.keymap.set("n", "", dap.step_into) + vim.keymap.set("i", "", dap.step_into) vim.keymap.set("n", "dt", dap.terminate, { desc = "Terminate Session" }) end, }, From b8772ae9b4317d6af8e3e397b57c133121656848 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sun, 15 Jun 2025 19:19:53 -0700 Subject: [PATCH 2/3] Add shortcuts to navigate issues and buffer tabs --- .config/nvim/lua/plugins/chrome.lua | 2 + .config/nvim/lua/plugins/language-server.lua | 92 ++++++++++---------- 2 files changed, 49 insertions(+), 45 deletions(-) diff --git a/.config/nvim/lua/plugins/chrome.lua b/.config/nvim/lua/plugins/chrome.lua index 085f20b..4c45a7c 100644 --- a/.config/nvim/lua/plugins/chrome.lua +++ b/.config/nvim/lua/plugins/chrome.lua @@ -57,6 +57,8 @@ return { "goolord/alpha-nvim", vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }), vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }), + vim.keymap.set("n", "", ":BufferPrevious", { desc = "Previous Buffer" }), + vim.keymap.set("n", "", ":BufferNext", { desc = "Next Buffer" }), vim.keymap.set("n", "bq", ":BufferClose", { desc = "Close Buffer" }), vim.keymap.set("n", "", ":BufferClose", { desc = "Close Buffer" }), vim.keymap.set("n", "bp", ":BufferPrevious", { desc = "Previous Buffer" }), diff --git a/.config/nvim/lua/plugins/language-server.lua b/.config/nvim/lua/plugins/language-server.lua index d670176..c31df54 100644 --- a/.config/nvim/lua/plugins/language-server.lua +++ b/.config/nvim/lua/plugins/language-server.lua @@ -64,51 +64,53 @@ return { "mason-org/mason.nvim", "mason-org/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", - }, - config = function() - local capabilities = require("cmp_nvim_lsp").default_capabilities() - local lspconfig = require("lspconfig") - lspconfig.ts_ls.setup({ - capabilities = capabilities, - }) - lspconfig.lua_ls.setup({ capabilities = capabilities }) - lspconfig.bashls.setup({ - capabilities = capabilities, - cmd = { "bash-language-server", "start" }, - filetypes = { "sh", "bash" }, - }) - lspconfig.gh_actions_ls.setup({ capabilities = capabilities }) - -- lspconfig.helm_ls.setup({ capabilities = capabilities }) - lspconfig.jsonls.setup({ capabilities = capabilities }) - lspconfig.basedpyright.setup({ - capabilities = capabilities, - settings = { - basedpyright = { - analysis = { - typeCheckingMode = "off", - diagnosticSeverityOverrides = { - reportUnusedImport = false, - reportUnusedVariable = false, - }, - }, - }, - }, - }) - lspconfig.nginx_language_server.setup({ capabilities = capabilities }) - lspconfig.ruff.setup({ - capabilities = capabilities, - init_options = { - settings = { - lineLength = 79, - }, - }, - }) - lspconfig.yamlls.setup({ capabilities = capabilities }) - vim.keymap.set("n", "vd", vim.lsp.buf.hover, { desc = "View Docstring" }) - vim.keymap.set("n", "gt", vim.lsp.buf.definition, { desc = "Go To Definition" }) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" }) + }, + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities() + local lspconfig = require("lspconfig") + lspconfig.ts_ls.setup({ + capabilities = capabilities, + }) + lspconfig.lua_ls.setup({ capabilities = capabilities }) + lspconfig.bashls.setup({ + capabilities = capabilities, + cmd = { "bash-language-server", "start" }, + filetypes = { "sh", "bash" }, + }) + lspconfig.gh_actions_ls.setup({ capabilities = capabilities }) + -- lspconfig.helm_ls.setup({ capabilities = capabilities }) + lspconfig.jsonls.setup({ capabilities = capabilities }) + lspconfig.basedpyright.setup({ + capabilities = capabilities, + settings = { + basedpyright = { + analysis = { + typeCheckingMode = "off", + diagnosticSeverityOverrides = { + reportUnusedImport = false, + reportUnusedVariable = false, + }, + }, + }, + }, + }) + lspconfig.nginx_language_server.setup({ capabilities = capabilities }) + lspconfig.ruff.setup({ + capabilities = capabilities, + init_options = { + settings = { + lineLength = 79, + }, + }, + }) + lspconfig.yamlls.setup({ capabilities = capabilities }) + vim.keymap.set("n", "vd", vim.lsp.buf.hover, { desc = "View Docstring" }) + vim.keymap.set("n", "gt", vim.lsp.buf.definition, { desc = "Go To Definition" }) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" }) vim.keymap.set("n", "cr", vim.lsp.buf.rename, { desc = "Refactor Name" }) vim.keymap.set("n", "vr", vim.lsp.buf.references, { desc = "View References" }) - end, - }, + vim.keymap.set("n", "pp", vim.diagnostic.goto_prev, { desc = "Previous Issue" }) + vim.keymap.set("n", "pn", vim.diagnostic.goto_next, { desc = "Next Issue" }) + end, + }, } From b9d65bd05a3c25874cf061fa364b04790114a563 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Sun, 15 Jun 2025 20:37:59 -0700 Subject: [PATCH 3/3] Install luasnip for LSP support Install and configure LSP for helm and ansible --- .config/nvim/lua/plugins/completions.lua | 84 ++++++++++---------- .config/nvim/lua/plugins/language-server.lua | 10 ++- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua index 615a8f5..a22bb3a 100644 --- a/.config/nvim/lua/plugins/completions.lua +++ b/.config/nvim/lua/plugins/completions.lua @@ -1,45 +1,45 @@ return { --- { --- "L3MON4D3/LuaSnip", --- dependencies = { --- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp --- "rafamadriz/friendly-snippets", -- Collection of snippets --- }, --- }, - { - "hrsh7th/nvim-cmp", - config = function() --- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets - local cmp = require("cmp") + { + "L3MON4D3/LuaSnip", + -- dependencies = { + -- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp + -- "rafamadriz/friendly-snippets", -- Collection of snippets + -- }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + -- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets + local cmp = require("cmp") - cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require("luasnip").lsp_expand(args.body) -- For `luasnip` users. - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- Show suggestions from LSP - { name = "luasnip" }, -- For luasnip users. - }, { - { name = "buffer" }, - }), - }) - end, - }, - { - "hrsh7th/cmp-nvim-lsp", - }, + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- Show suggestions from LSP + { name = "luasnip" }, -- For luasnip users. + }, { + { name = "buffer" }, + }), + }) + end, + }, + { + "hrsh7th/cmp-nvim-lsp", + }, } diff --git a/.config/nvim/lua/plugins/language-server.lua b/.config/nvim/lua/plugins/language-server.lua index c31df54..24488c3 100644 --- a/.config/nvim/lua/plugins/language-server.lua +++ b/.config/nvim/lua/plugins/language-server.lua @@ -16,6 +16,8 @@ return { "hadolint", "yamllint", "gh-actions-language-server", + "ansible-language-server", + "ansible-lint", }, }) end, @@ -28,7 +30,7 @@ return { ensure_installed = { "lua_ls", "bashls", - --"helm_ls", + "helm_ls", "jsonls", "nginx_language_server", "basedpyright", @@ -78,7 +80,10 @@ return { filetypes = { "sh", "bash" }, }) lspconfig.gh_actions_ls.setup({ capabilities = capabilities }) - -- lspconfig.helm_ls.setup({ capabilities = capabilities }) + lspconfig.helm_ls.setup({ + capabilities = capabilities, + filetypes = { "tpl", "helm"}, + }) lspconfig.jsonls.setup({ capabilities = capabilities }) lspconfig.basedpyright.setup({ capabilities = capabilities, @@ -104,6 +109,7 @@ return { }, }) lspconfig.yamlls.setup({ capabilities = capabilities }) + lspconfig.ansiblels.setup({ capabilities = capabilities }) vim.keymap.set("n", "vd", vim.lsp.buf.hover, { desc = "View Docstring" }) vim.keymap.set("n", "gt", vim.lsp.buf.definition, { desc = "Go To Definition" }) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" })