Skip to content
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

Transformers without output? #943

Open
n0bra1n3r opened this issue Sep 13, 2024 · 4 comments
Open

Transformers without output? #943

n0bra1n3r opened this issue Sep 13, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@n0bra1n3r
Copy link

n0bra1n3r commented Sep 13, 2024

Hello, I was wondering if it's possible to use preview transformers without any output, and just run an external command whenever a preview should be rendered (for both directories and files)? I was thinking something like:

[[preview_transformers]]
  input_extensions = [ "*" ]
  mode = "none"
  command = [
    "nvim",
    "--server",
    "$NVIM",
    "--remote-expr",
    "v:lua.fn.open_explorer_preview(\"{file}\")",
  ]

I wanted this to call into the remote neovim instance and show a preview for a file inside neovim itself.

@n0bra1n3r n0bra1n3r added the enhancement New feature or request label Sep 13, 2024
@n0bra1n3r n0bra1n3r changed the title Transformers with any input? Transformers with any output? Sep 13, 2024
@n0bra1n3r n0bra1n3r changed the title Transformers with any output? Transformers without output? Sep 13, 2024
@Canop
Copy link
Owner

Canop commented Sep 13, 2024

You mean you want to display nvim in the preview panel, or just that you want to run that command (which then doesn't really involve previews or preview transformers) ?

@n0bra1n3r
Copy link
Author

Yes I just want to run the command. If there is an existing mechanism to run a command when a preview should be rendered that would be ideal.

@Canop
Copy link
Owner

Canop commented Sep 14, 2024

Well, you can always override the preview key shortcut:

{
    key: ctrl-right
    external: "nvim +{line} {file}"
    extensions: ["md", "rs"]
    leave_broot: false
}

but you'll miss many features of broot, for example when searching (see https://dystroy.org/blog/broot-c-search/ )

@n0bra1n3r
Copy link
Author

I see. I also just tried overriding the up and down keys with a cmd, but ya that still doesn't cover preview after a search.

Would be really cool to be able to "hook" into features like this to completely customise behavior of broot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants