Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Axel Navarro 2026-04-16 15:32:50 -03:00 committed by GitHub
parent fded1c6a19
commit b3389dc854
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -94,24 +94,22 @@ map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
-- new file
map("n", "<leader>fn", "<cmd>enew<cr>", { desc = "New File" })
local function copy_file_path(modifier)
local path = vim.fn.expand(modifier)
if path == "" then
vim.notify("No file path available for the current buffer", vim.log.levels.WARN)
return
end
vim.fn.setreg("+", path)
vim.notify("Copied: " .. path)
end
-- copy file path
map("n", "<leader>fy", function()
local path = vim.fn.expand("%:p")
if path == "" then
vim.notify("No file path available for the current buffer", vim.log.levels.WARN)
return
end
vim.fn.setreg("+", path)
vim.notify("Copied: " .. path)
copy_file_path("%:p")
end, { desc = "Copy File Path" })
map("n", "<leader>fY", function()
local path = vim.fn.expand("%:~:.")
if path == "" then
vim.notify("No file path available for the current buffer", vim.log.levels.WARN)
return
end
vim.fn.setreg("+", path)
vim.notify("Copied: " .. path)
copy_file_path("%:~:.")
end, { desc = "Copy Short File Path" })
-- location list