From 6581d76a74760be5fcc5ca562d5032dcba7e5d9a Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sat, 28 Jan 2023 15:36:34 -0800 Subject: [PATCH] feat: action to copy path to entry under cursor (#50) --- lua/oil/actions.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/oil/actions.lua b/lua/oil/actions.lua index 9b7b860..b97ae37 100644 --- a/lua/oil/actions.lua +++ b/lua/oil/actions.lua @@ -184,6 +184,18 @@ M.open_cmdline = { end, } +M.copy_entry_path = { + desc = "Copy the filepath of the entry under the cursor to the + register", + callback = function() + local entry = oil.get_cursor_entry() + local dir = oil.get_current_dir() + if not entry or not dir then + return + end + vim.fn.setreg("+", dir .. entry.name) + end, +} + M.open_cmdline_dir = { desc = "Open vim cmdline with current directory as an argument", callback = function()