Compare commits

...

3 commits

Author SHA1 Message Date
b9d65bd05a Install luasnip for LSP support
Install and configure LSP for helm and ansible
2025-06-15 20:37:59 -07:00
b8772ae9b4 Add shortcuts to navigate issues and buffer tabs 2025-06-15 19:19:53 -07:00
ed05721db1 Add F-key mappings to mostly match VSCode 2025-06-15 19:18:36 -07:00
5 changed files with 128 additions and 88 deletions

View file

@ -64,3 +64,25 @@ vim.keymap.set("n", "<leader>ce", ":Copilot enable<CR>", { desc = "Enable Copilo
vim.keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Disable Copilot Completions" }) vim.keymap.set("n", "<leader>cd", ":Copilot disable<CR>", { desc = "Disable Copilot Completions" })
vim.keymap.set("n", "<leader>cc", ":CopilotChatToggle<CR>", { desc = "Toggle Copilot Chat" }) vim.keymap.set("n", "<leader>cc", ":CopilotChatToggle<CR>", { desc = "Toggle Copilot Chat" })
vim.keymap.set("n", "<leader>cx", ":CopilotChatReset<CR>", { desc = "Reset Copilot Chat" }) vim.keymap.set("n", "<leader>cx", ":CopilotChatReset<CR>", { desc = "Reset Copilot Chat" })
-- Configure f-key shortcuts
vim.keymap.set("n", "<F1>", vim.lsp.buf.hover)
vim.keymap.set("i", "<F1>", vim.lsp.buf.hover)
vim.keymap.set("n", "<F2>", vim.lsp.buf.rename)
vim.keymap.set("i", "<F2>", vim.lsp.buf.rename)
vim.keymap.set("n", "<F3>", "<c-i>")
vim.keymap.set("i", "<F3>", "<c-i>")
vim.keymap.set("n", "<S-F3>", "<c-o>")
vim.keymap.set("i", "<S-F3>", "<c-o>")
vim.keymap.set("n", "<F4>", ":BufferClose<CR>")
vim.keymap.set("i", "<F4>", ":BufferClose<CR>")
vim.keymap.set("n", "<F7>", ":Gitsigns next_hunk<CR>")
vim.keymap.set("i", "<F7>", ":Gitsigns next_hunk<CR>")
vim.keymap.set("n", "<S-F7>", ":Gitsigns prev_hunk<CR>")
vim.keymap.set("i", "<S-F7>", ":Gitsigns prev_hunk<CR>")
vim.keymap.set("n", "<F8>", vim.diagnostic.goto_next)
vim.keymap.set("i", "<F8>", vim.diagnostic.goto_next)
vim.keymap.set("n", "<S-F8>", vim.diagnostic.goto_prev)
vim.keymap.set("i", "<S-F8>", vim.diagnostic.goto_prev)
vim.keymap.set("n", "<F12>", vim.lsp.buf.definition)
vim.keymap.set("i", "<F12>", vim.lsp.buf.definition)

View file

@ -57,6 +57,8 @@ return {
"goolord/alpha-nvim", "goolord/alpha-nvim",
vim.keymap.set("n", "<A-left>", ":BufferPrevious<CR>", { desc = "Previous Buffer" }), vim.keymap.set("n", "<A-left>", ":BufferPrevious<CR>", { desc = "Previous Buffer" }),
vim.keymap.set("n", "<A-right>", ":BufferNext<CR>", { desc = "Next Buffer" }), vim.keymap.set("n", "<A-right>", ":BufferNext<CR>", { desc = "Next Buffer" }),
vim.keymap.set("n", "<A-h>", ":BufferPrevious<CR>", { desc = "Previous Buffer" }),
vim.keymap.set("n", "<A-l>", ":BufferNext<CR>", { desc = "Next Buffer" }),
vim.keymap.set("n", "<leader>bq", ":BufferClose<CR>", { desc = "Close Buffer" }), vim.keymap.set("n", "<leader>bq", ":BufferClose<CR>", { desc = "Close Buffer" }),
vim.keymap.set("n", "<A-q>", ":BufferClose<CR>", { desc = "Close Buffer" }), vim.keymap.set("n", "<A-q>", ":BufferClose<CR>", { desc = "Close Buffer" }),
vim.keymap.set("n", "<leader>bp", ":BufferPrevious<CR>", { desc = "Previous Buffer" }), vim.keymap.set("n", "<leader>bp", ":BufferPrevious<CR>", { desc = "Previous Buffer" }),

View file

@ -1,45 +1,45 @@
return { return {
-- { {
-- "L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
-- dependencies = { -- dependencies = {
-- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp -- "saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp
-- "rafamadriz/friendly-snippets", -- Collection of snippets -- "rafamadriz/friendly-snippets", -- Collection of snippets
-- }, -- },
-- }, },
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
config = function() config = function()
-- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets -- require("luasnip.loaders.from_vscode").lazy_load() -- Load snippets from friendly-snippets
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = { snippet = {
-- REQUIRED - you must specify a snippet engine -- REQUIRED - you must specify a snippet engine
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users. require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end, end,
}, },
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<C-PageUp>"] = cmp.mapping.scroll_docs(-4), ["<C-PageUp>"] = cmp.mapping.scroll_docs(-4),
["<C-PageDown>"] = cmp.mapping.scroll_docs(4), ["<C-PageDown>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- Show suggestions from LSP { name = "nvim_lsp" }, -- Show suggestions from LSP
{ name = "luasnip" }, -- For luasnip users. { name = "luasnip" }, -- For luasnip users.
}, { }, {
{ name = "buffer" }, { name = "buffer" },
}), }),
}) })
end, end,
}, },
{ {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
} }

View file

@ -8,6 +8,14 @@ return {
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Start/Continue" }) vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Start/Continue" })
vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" }) vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" })
vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" }) vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" })
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint)
vim.keymap.set("i", "<F9>", dap.toggle_breakpoint)
vim.keymap.set("n", "<F5>", dap.continue)
vim.keymap.set("i", "<F5>", dap.continue)
vim.keymap.set("n", "<F10>", dap.step_over)
vim.keymap.set("i", "<F10>", dap.step_over)
vim.keymap.set("n", "<F11>", dap.step_into)
vim.keymap.set("i", "<F11>", dap.step_into)
vim.keymap.set("n", "<Leader>dt", dap.terminate, { desc = "Terminate Session" }) vim.keymap.set("n", "<Leader>dt", dap.terminate, { desc = "Terminate Session" })
end, end,
}, },

View file

@ -16,6 +16,8 @@ return {
"hadolint", "hadolint",
"yamllint", "yamllint",
"gh-actions-language-server", "gh-actions-language-server",
"ansible-language-server",
"ansible-lint",
}, },
}) })
end, end,
@ -28,7 +30,7 @@ return {
ensure_installed = { ensure_installed = {
"lua_ls", "lua_ls",
"bashls", "bashls",
--"helm_ls", "helm_ls",
"jsonls", "jsonls",
"nginx_language_server", "nginx_language_server",
"basedpyright", "basedpyright",
@ -64,51 +66,57 @@ return {
"mason-org/mason.nvim", "mason-org/mason.nvim",
"mason-org/mason-lspconfig.nvim", "mason-org/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
}, },
config = function() config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
lspconfig.ts_ls.setup({ lspconfig.ts_ls.setup({
capabilities = capabilities, capabilities = capabilities,
}) })
lspconfig.lua_ls.setup({ capabilities = capabilities }) lspconfig.lua_ls.setup({ capabilities = capabilities })
lspconfig.bashls.setup({ lspconfig.bashls.setup({
capabilities = capabilities, capabilities = capabilities,
cmd = { "bash-language-server", "start" }, cmd = { "bash-language-server", "start" },
filetypes = { "sh", "bash" }, filetypes = { "sh", "bash" },
}) })
lspconfig.gh_actions_ls.setup({ capabilities = capabilities }) lspconfig.gh_actions_ls.setup({ capabilities = capabilities })
-- lspconfig.helm_ls.setup({ capabilities = capabilities }) lspconfig.helm_ls.setup({
lspconfig.jsonls.setup({ capabilities = capabilities }) capabilities = capabilities,
lspconfig.basedpyright.setup({ filetypes = { "tpl", "helm"},
capabilities = capabilities, })
settings = { lspconfig.jsonls.setup({ capabilities = capabilities })
basedpyright = { lspconfig.basedpyright.setup({
analysis = { capabilities = capabilities,
typeCheckingMode = "off", settings = {
diagnosticSeverityOverrides = { basedpyright = {
reportUnusedImport = false, analysis = {
reportUnusedVariable = false, typeCheckingMode = "off",
}, diagnosticSeverityOverrides = {
}, reportUnusedImport = false,
}, reportUnusedVariable = false,
}, },
}) },
lspconfig.nginx_language_server.setup({ capabilities = capabilities }) },
lspconfig.ruff.setup({ },
capabilities = capabilities, })
init_options = { lspconfig.nginx_language_server.setup({ capabilities = capabilities })
settings = { lspconfig.ruff.setup({
lineLength = 79, capabilities = capabilities,
}, init_options = {
}, settings = {
}) lineLength = 79,
lspconfig.yamlls.setup({ capabilities = capabilities }) },
vim.keymap.set("n", "<leader>vd", vim.lsp.buf.hover, { desc = "View Docstring" }) },
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.definition, { desc = "Go To Definition" }) })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" }) lspconfig.yamlls.setup({ capabilities = capabilities })
lspconfig.ansiblels.setup({ capabilities = capabilities })
vim.keymap.set("n", "<leader>vd", vim.lsp.buf.hover, { desc = "View Docstring" })
vim.keymap.set("n", "<leader>gt", vim.lsp.buf.definition, { desc = "Go To Definition" })
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Show Code Actions" })
vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, { desc = "Refactor Name" }) vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, { desc = "Refactor Name" })
vim.keymap.set("n", "<leader>vr", vim.lsp.buf.references, { desc = "View References" }) vim.keymap.set("n", "<leader>vr", vim.lsp.buf.references, { desc = "View References" })
end, vim.keymap.set("n", "<leader>pp", vim.diagnostic.goto_prev, { desc = "Previous Issue" })
}, vim.keymap.set("n", "<leader>pn", vim.diagnostic.goto_next, { desc = "Next Issue" })
end,
},
} }