Skip to content

FEATURE: Add option to open file with system default aplication #1224

@gustavotr

Description

@gustavotr

Did you check the docs?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requesthow-towontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions