diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index bf795081..7dadec76 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -97,11 +97,19 @@ map("n", "fn", "enew", { desc = "New File" }) -- copy file path map("n", "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) end, { desc = "Copy File Path" }) map("n", "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) end, { desc = "Copy Relative File Path" })