feat(keymaps): add shortcuts to copy buffer file path to clipboard

This commit is contained in:
Axel Navarro 2026-04-16 14:48:10 -03:00
parent 83d90f339d
commit d0fcc0871c
No known key found for this signature in database
GPG key ID: 7C85B95C40FD51C4

View file

@ -94,6 +94,18 @@ map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
-- new file
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
-- copy file path
map("n", "<leader>fy", function()
local path = vim.fn.expand("%:p")
vim.fn.setreg("+", path)
vim.notify("Copied: " .. path)
end, { desc = "Copy File Path" })
map("n", "<leader>fY", function()
local path = vim.fn.expand("%:~:.")
vim.fn.setreg("+", path)
vim.notify("Copied: " .. path)
end, { desc = "Copy Relative File Path" })
-- location list
map("n", "<leader>xl", function()
local success, err = pcall(vim.fn.getloclist(0, { winid = 0 }).winid ~= 0 and vim.cmd.lclose or vim.cmd.lopen)