Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions lua/telescope/_extensions/media_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,19 @@ function M.media_files(opts)
local sourced_file = require('plenary.debug_utils').sourced_filepath()
M.base_directory = vim.fn.fnamemodify(sourced_file, ":h:h:h:h")
opts = opts or {}
opts.attach_mappings= function(prompt_bufnr,map)
actions.select_default:replace(function()
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
if entry[1] then
local filename = entry[1]
vim.fn.setreg(vim.v.register, filename)
vim.notify("The image path has been copied!")
end
end)
return true
if not opts.attach_mappings then
opts.attach_mappings= function(prompt_bufnr,map)
actions.select_default:replace(function()
local entry = action_state.get_selected_entry()
actions.close(prompt_bufnr)
if entry[1] then
local filename = entry[1]
vim.fn.setreg(vim.v.register, filename)
vim.notify("The image path has been copied!")
end
end)
return true
end
end
opts.path_display = { "shorten" }

Expand Down