neo-tree.nvim icon indicating copy to clipboard operation
neo-tree.nvim copied to clipboard

FEATURE: Add option to open file with system default aplication

Open gustavotr opened this issue 1 year ago • 0 comments

Did you check the docs?

  • [X] I have read all the docs.

Is your feature request related to a problem? Please describe.

Sometimes I want to quickly open an image or a folder using the corresponding application in my OS.

Describe the solution you'd like.

I want to have a mapping to trigger the OS default application if I want.

Describe alternatives you've considered.

Right now I have created a custom mapping to solve this:

window = {
        mappings = {
          ["O"] = {
            command = function(state)
              local node = state.tree:get_node()
              local filepath = node.path
              local osType = os.getenv("OS")

              local command

              if osType == "Windows_NT" then
                command = "start " .. filepath
              elseif osType == "Darwin" then
                command = "open " .. filepath
              else
                command = "xdg-open " .. filepath
              end
              os.execute(command)
            end,
            desc = "open_with_system_defaults",
          },
        },
      },

Additional Context

No response

gustavotr avatar Nov 11 '23 03:11 gustavotr