Add notifications and neotree copy options

This commit is contained in:
Saeed Afzal
2024-01-03 14:30:28 +00:00
parent e62faa0b94
commit c094afe79c
7 changed files with 44 additions and 26 deletions

View File

@@ -10,7 +10,42 @@ return {
cmd = "Neotree",
opts = {
window = {
position = "current"
position = "current",
mappings = {
["Y"] = function(state)
local node = state.tree:get_node()
local filepath = node:get_id()
local filename = node.name
local modify = vim.fn.fnamemodify
local results = {
filepath,
modify(filepath, ':.'),
modify(filepath, ':~'),
filename,
modify(filename, ':r'),
modify(filename, ':e'),
}
vim.ui.select({
'1. Absolute path: ' .. results[1],
'2. Path relative to CWD: ' .. results[2],
'3. Path relative to HOME: ' .. results[3],
'4. Filename: ' .. results[4],
'5. Filename without extension: ' .. results[5],
'6. Extension of the filename: ' .. results[6],
}, { prompt = 'Choose to copy to clipboard:' }, function(choice)
if choice then
local i = tonumber(choice:sub(1, 1))
local result = results[i]
vim.fn.setreg('"+', result)
vim.notify("Copied: " .. result)
end
end)
end
}
}
}
}