-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] When pressing enter on selected media file, open with xdg-open #26
Comments
I was looking over the Telescope directory when I found this extension and this issue. Based on discussion in nvim-telescope/telescope.nvim#1228, this plugin seems like the best place to implement this kind of functionality. What makes #39 nice is that additional actions could be defined, namely, copy to clipboard or insert link/path into the current file. I use the https://github.com/renerocksai/telekasten.nvim plugin, but parts of this are a fancy overlay to Telescope. If this extension could open files and insert the link to a file, or copy the path to the clipboard as in #16, then much of Telekasten's functionality could be replaced by this plugin, perhaps even reducing the scope of that extension. |
For those folks who want this functionality, I (with great difficulty) figured out how to do it by setting a special keymap for telescope environment. For some context: I am not a lua dev, but I got it 😆. So just add the following to your telescope.nvim config and you'll be able to open the currently selected/focused entry in (any?) telescope environment with Shift+Enter through netrw. defaults = {
mappings = {
i = {
["<S-CR>"] = function()
local entry = require("telescope.actions.state").get_selected_entry()
vim.api.nvim_call_function("netrw#BrowseX", { entry[1], 0 })
end,
},
},
}, In the future with neovim 0.10 release you may replace netrw with builtin function: defaults = {
mappings = {
i = {
["<S-CR>"] = function()
local entry = require("telescope.actions.state").get_selected_entry()
vim.ui.open(entry[1])
end,
},
},
}, If something doesn't work then you might also need to configure file handler. |
For a quick search I sometimes just open nvim to search interactively media files, such as pdfs, images.
If a pdf, for instance, has many pages, I would like to open the file with the appropriate application. xdg-open already does this behaviour, so I would only like to call xdg-open instead of actually opening the binary file in nvim when looking through with telescope-media-files.
I believe this would not be intrusive, as it would only open when looking for media files, and not regular files.
The text was updated successfully, but these errors were encountered: