feat: add keymap for yanking to system clipboard

This commit is contained in:
Stevan Freeborn
2025-01-18 23:25:36 -06:00
parent 50898dcd2f
commit 6c0e06ff11
5 changed files with 78 additions and 69 deletions
+63 -62
View File
@@ -1,66 +1,67 @@
return { return {
{ {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
dependencies = { dependencies = {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets", "rafamadriz/friendly-snippets",
}, },
}, },
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
config = function() config = function()
local luasnip = require("luasnip") local luasnip = require("luasnip")
local cmp = require("cmp") local cmp = require("cmp")
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
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-u>"] = cmp.mapping.scroll_docs(-4), ["<Esc>"] = cmp.mapping.close(),
["<C-d>"] = cmp.mapping.scroll_docs(4), ["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-d>"] = cmp.mapping.scroll_docs(4),
["<CR>"] = cmp.mapping.confirm({ ["<C-Space>"] = cmp.mapping.complete(),
behavior = cmp.ConfirmBehavior.Replace, ["<CR>"] = cmp.mapping.confirm({
select = true, behavior = cmp.ConfirmBehavior.Replace,
}), select = true,
["<Tab>"] = cmp.mapping(function(fallback) }),
if cmp.visible() then ["<Tab>"] = cmp.mapping(function(fallback)
cmp.select_next_item() if cmp.visible() then
elseif luasnip.expand_or_jumpable() then cmp.select_next_item()
luasnip.expand_or_jump() elseif luasnip.expand_or_jumpable() then
else luasnip.expand_or_jump()
fallback() else
end fallback()
end, { "i", "s" }), end
["<S-Tab>"] = cmp.mapping(function(fallback) end, {}),
if cmp.visible() then ["<S-Tab>"] = cmp.mapping(function(fallback)
cmp.select_prev_item() if cmp.visible() then
elseif luasnip.jumpable(-1) then cmp.select_prev_item()
luasnip.jump(-1) elseif luasnip.jumpable(-1) then
else luasnip.jump(-1)
fallback() else
end fallback()
end, { "i", "s" }), end
}), end, {}),
sources = cmp.config.sources({ }),
{ name = "nvim_lsp" }, sources = cmp.config.sources({
{ name = "luasnip" }, { name = "nvim_lsp" },
}, { { name = "luasnip" },
{ name = "buffer" }, }, {
}), { name = "buffer" },
}) }),
end, })
}, end,
},
} }
+3 -3
View File
@@ -61,7 +61,7 @@ return {
name = "launch - netcoredbg", name = "launch - netcoredbg",
request = "launch", request = "launch",
program = function() program = function()
return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") return vim.fn.input("Path to dll: ", vim.fn.getcwd(), "file")
end, end,
}, },
} }
@@ -79,7 +79,7 @@ return {
dapui.close() dapui.close()
end end
vim.keymap.set("n", "<Leader>dt", dap.toggle_breakpoint, {}) vim.keymap.set("n", "<Leader>dt", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, {}) vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Continue" })
end, end,
} }
+4
View File
@@ -73,6 +73,10 @@ return {
capabilities = capabilities, capabilities = capabilities,
}) })
lspconfig.lemminx.setup({
capabilities = capabilities,
})
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}), group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev) callback = function(ev)
+5 -3
View File
@@ -7,8 +7,10 @@ return {
config.setup({ config.setup({
auto_install = true, auto_install = true,
indent = { enabled = true }, indent = { enabled = true },
highlight = { enabled = true }, highlight = {
enabled = true,
additional_vim_regex_highlighting = true,
},
}) })
end,
end,
} }
+3 -1
View File
@@ -2,7 +2,6 @@ vim.cmd("set expandtab")
vim.cmd("set tabstop=2") vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2") vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2") vim.cmd("set shiftwidth=2")
-- vim.cmd("set shellslash")
vim.cmd("set number") vim.cmd("set number")
vim.cmd("set shell=pwsh") vim.cmd("set shell=pwsh")
vim.cmd("let &shellcmdflag = '-NoLogo'") vim.cmd("let &shellcmdflag = '-NoLogo'")
@@ -10,3 +9,6 @@ vim.cmd("let &shellcmdflag = '-NoLogo'")
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = "\\" vim.g.maplocalleader = "\\"
vim.opt.wrap = false vim.opt.wrap = false
vim.keymap.set("n", "<leader>y", '"+y', { desc = "Yank to system clipboard" })
vim.keymap.set("v", "<leader>y", '"+y', { desc = "Yank to system clipboard" })