Keybind in "selection" mode to create a directory with the files / folders that are currently selected #2236
macintacos
started this conversation in
3. Ideas
Replies: 3 comments
-
|
I'd be interested in that as well! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
+1 on that idea |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I created a small plugin that does exactly that: Content of local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u)
end
if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url)
end
return paths
end)
local get_cwd = ya.sync(function()
return tostring(cx.active.current.cwd)
end)
local function prompt_destination()
local value, event = ya.input {
title = "Directory name for selection:",
position = { "center", w = 70, h = 20 },
}
if event ~= 1 or value == nil then
return nil
end
return get_cwd() .. "/" .. value
end
local function entry()
ya.emit("escape", { visual = true })
local selected = selected_or_hovered()
local destination = prompt_destination()
if destination ~= nil then
Command("mkdir"):arg{ "-p", destination }:status()
Command("mv"):arg(selected):arg(destination):status()
end
end
return { entry = entry }Content of [mgr]
prepend_keymap = [
{ on = "<C-s>", run = "plugin directory-from-selection" },
]
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I just want to have the following basic workflow:
Bonus points if there's a separate shortcut to make a new directory with the selected items, but copy those items instead of move them.
Is this possible today? I looked around and couldn't really find anything relevant, aside from (I guess) creating my own plugin.
Beta Was this translation helpful? Give feedback.
All reactions