Skip to content

Open the path under cursor in a floating terminal #2853

Closed

Description

@sadtab

Is this a question? No
Please start a new Q&A discussion instead of raising a feature request.

Can this functionality be implemented utilising API?
nvim-tree exposes extensive API (see :h nvim-tree-api). Can it be used to achieve your goal? Is there a missing API that would make it possible? probably, maybe, I don't know
Given stable status of nvim-tree it's preferred to add new API than new functionality.

Is your feature request related to a problem? Please describe.
It happens very usual I need to do file operations (tar, untar, etc) on a file, it will be useful if I can open a floating terminal after bnavigatong on my file in the tree inside vim, its actullay adding a new layer on top of nvim from the nvimtree gateway

Describe the solution you'd like
A clear and concise description of what you want to happen. Title says it all, open the path under cursor in a floating terminal, something like system open, but open in a floating terminal instead

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered. Terminal in a new tab, split, v split etc

Additional context
Add any other context or screenshots about the feature request here.

Activity

  1. alex-courtis commented on Jul 27, 2024

    @alex-courtis
    Member

    Right now you can use . to execute a vim or shell command on the node e.g.

    . on foo
    type !cat
    :!cat foo is executed

    That follows prior art from plugins such as fugitive, showing the more-able output.

  2. alex-courtis commented on Jul 27, 2024

    @alex-courtis
    Member

    It would be very possible to open a floating terminal at the path with an on_attach mapping something like:

      vim.keymap.set("n", "Z", function()
        local node = api.tree.get_node_under_cursor()
        local path = vim.fn.fnamemodify(node.absolute_path, ":p:h")
        print("do something with " .. path)
      end, opts("do something with"))

    Please do share the recipe for whatever you come up with.

  3. locked and limited conversation to collaborators on Jul 27, 2024
  4. converted this issue into a discussion #2854 on Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions