Skip to content

Commit 436150e

Browse files
committed
refactor(#2831): multi instance clipboard
1 parent 98518a0 commit 436150e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: lua/nvim-tree/actions/fs/copy-paste.lua renamed to lua/nvim-tree/actions/fs/clipboard.lua

+6-6
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ end
109109

110110
---@param source string
111111
---@param dest string
112-
---@param action_type string
112+
---@param action ACTION
113113
---@param action_fn fun(source: string, dest: string)
114114
---@return boolean|nil -- success
115115
---@return string|nil -- error message
116-
local function do_single_paste(source, dest, action_type, action_fn)
116+
local function do_single_paste(source, dest, action, action_fn)
117117
local dest_stats
118118
local success, errmsg, errcode
119119
local notify_source = notify.render_path(source)
@@ -122,14 +122,14 @@ local function do_single_paste(source, dest, action_type, action_fn)
122122

123123
dest_stats, errmsg, errcode = vim.loop.fs_stat(dest)
124124
if not dest_stats and errcode ~= "ENOENT" then
125-
notify.error("Could not " .. action_type .. " " .. notify_source .. " - " .. (errmsg or "???"))
125+
notify.error("Could not " .. action .. " " .. notify_source .. " - " .. (errmsg or "???"))
126126
return false, errmsg
127127
end
128128

129129
local function on_process()
130130
success, errmsg = action_fn(source, dest)
131131
if not success then
132-
notify.error("Could not " .. action_type .. " " .. notify_source .. " - " .. (errmsg or "???"))
132+
notify.error("Could not " .. action .. " " .. notify_source .. " - " .. (errmsg or "???"))
133133
return false, errmsg
134134
end
135135

@@ -147,7 +147,7 @@ local function do_single_paste(source, dest, action_type, action_fn)
147147
vim.ui.input(input_opts, function(new_dest)
148148
utils.clear_prompt()
149149
if new_dest then
150-
do_single_paste(source, new_dest, action_type, action_fn)
150+
do_single_paste(source, new_dest, action, action_fn)
151151
end
152152
end)
153153
else
@@ -161,7 +161,7 @@ local function do_single_paste(source, dest, action_type, action_fn)
161161
vim.ui.input(input_opts, function(new_dest)
162162
utils.clear_prompt()
163163
if new_dest then
164-
do_single_paste(source, new_dest, action_type, action_fn)
164+
do_single_paste(source, new_dest, action, action_fn)
165165
end
166166
end)
167167
end

Diff for: lua/nvim-tree/explorer/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function M.setup(opts)
8989
require("nvim-tree.explorer.reload").setup(opts)
9090
require("nvim-tree.explorer.watch").setup(opts)
9191

92-
Clipboard = require "nvim-tree.actions.fs.copy-paste"
92+
Clipboard = require "nvim-tree.actions.fs.clipboard"
9393
end
9494

9595
M.Explorer = Explorer

0 commit comments

Comments
 (0)