-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpaste.lua
More file actions
40 lines (29 loc) · 886 Bytes
/
Copy pathpaste.lua
File metadata and controls
40 lines (29 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- @since 26.5.6
-- The module to handle the paste command
-- Import the utilities module
local utils = require(".utils")
-- The module table
local M = {}
-- Function to handle the paste command
---@type YaziPluginEntry
function M:entry(job)
-- Get the arguments and the configuration
local args, config = require("augment-command").parse_args_and_init(job)
-- If the hovered item is not a directory or smart paste is not wanted
if
not utils.hovered_item_is_dir()
or not (config.smart_paste or utils.table_pop(args, "smart", false))
then
-- Just paste the items inside the current directory
-- and exit the function
return ya.emit("paste", args)
end
-- Otherwise, enter the directory
ya.emit("enter", {})
-- Paste the items inside the directory
ya.emit("paste", args)
-- Leave the directory
ya.emit("leave", {})
end
-- Return the module table
return M