broot icon indicating copy to clipboard operation
broot copied to clipboard

zoxide and similar navigation commands integration

Open Martin1887 opened this issue 2 years ago • 10 comments

Integrate zoxide (commands z and zi) and similar navigation commands in broot would be great!

I think it could be done with custom verbs but I'm not sure. The command navigation would happen inside broot, so it would be a focus in the directory indicated by the command.

Thanks!

Martin1887 avatar Aug 28 '23 08:08 Martin1887

Add action config:

  • for powershell
{
    invocation: zoxide
    shortcut: z
    key: "alt-z"
    external: "br (zoxide query -i)"
    from_shell: true
    leave_broot: true
}
  • linux shell
{
    invocation: zoxide
    shortcut: z
    key: "alt-z"
    external: "br $(zoxide query -i)"
    from_shell: true
    leave_broot: true
}

lost22git avatar Mar 11 '24 01:03 lost22git

1

lost22git avatar Mar 11 '24 01:03 lost22git

It looks awesome, thanks! Sadly, it does not work using the br function of the blog post introduced in https://github.com/Canop/broot/issues/152, which avoids using eval to enter in a directory (when the command is executed broot says broot must be used as br although it is but using this new function).

Thanks!

Martin1887 avatar Mar 11 '24 08:03 Martin1887

You can try this if you can not use br

{
    invocation: zoxide
    shortcut: z
    key: "alt-z"
    external: "sh -c \"broot $(zoxide query -i)\""
    from_shell: false
    leave_broot: true
  }

lost22git avatar Mar 11 '24 10:03 lost22git

Thanks! I would like to use br, but it is a different zsh function that do not use eval to change the directory. I don't know why broot is complaining about it, but there is surely an easy solution to use it, maybe changing something in the br zsh function or maybe using as external zsh -c br $(zoxide query -i).

I'm thinking the problem may be it is only a zsh function but not a sh function, so broot uses sh or bash when using from_shell and this is why it cannot found it. But reading the documentation broot uses the parent shell, so the problem seems that the br zsh function is not compatible with from_shell.

Martin1887 avatar Mar 11 '24 10:03 Martin1887

I don't use zsh on linux, so I'm sorry I can't help you. 😅

lost22git avatar Mar 11 '24 10:03 lost22git