Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

[FEAT]: Clickable directory Entries #88

Open
3 tasks done
thattomperson opened this issue Aug 31, 2023 · 0 comments
Open
3 tasks done

[FEAT]: Clickable directory Entries #88

thattomperson opened this issue Aug 31, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@thattomperson
Copy link

thattomperson commented Aug 31, 2023

Requirements

  • This feature isn't just a vague idea and can have a good practical solution.
  • I'm completely sure that this feature fits into this plugin.
  • I'm willing to implement this through a PR.

Problem

It would be nice to be able to click on the directories and have a callback fire

an example use-case would be to open nerdtree or oil.nvim to that directory

Solution Suggestion

adding an additional onClick to the Entry class should be simple,
I'm not sure how you would want to implement it though

the current to = {} stuff could be made generic to to use the same click handlers with a default implementation

configuration could be done pretty simply with a table

function Entry:navigate()
  local handler = config.onclick[entry.type] or function (entry)
    vim.cmd.mark("'")

    vim.api.nvim_set_current_win(entry.to.win)
    vim.api.nvim_win_set_cursor(entry.to.win, entry.to.pos)
  end
  handler(self)
end

require('barbecue').setup({
  onclick = {
    dir = function (entry) 
      require('nerdtree').focus(entry.filepath)
    end,
  }
})

some additional parameters would be required on the Entry to make this useable, like the filepath one above

Workaround

No response

@thattomperson thattomperson added the enhancement New feature or request label Aug 31, 2023
@thattomperson thattomperson changed the title [FEAT]: [FEAT]: Clickable directory Entries Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant