refactor(plugins): use astrocore

This commit is contained in:
Nicolas Goudry 2024-06-04 08:00:42 +02:00
parent 8a438a9449
commit a36a9c8de0
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44
2 changed files with 4 additions and 14 deletions

View file

@ -51,6 +51,7 @@
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L136-L168
copy_selector.__raw = ''
function(state)
local notify = require("astrocore").notify
local node = state.tree:get_node()
local filepath = node:get_id()
local filename = node.name
@ -68,6 +69,7 @@
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
if vim.tbl_isempty(options) then
notify("No values to copy", vim.log.levels.WARN)
return
end
table.sort(options)
@ -77,6 +79,7 @@
}, function(choice)
local result = vals[choice]
if result then
notify(("Copied: `%s`"):format(result))
vim.fn.setreg("+", result)
end
end)