broot icon indicating copy to clipboard operation
broot copied to clipboard

Question: copy the full path to the buffer

Open OlegPQ opened this issue 3 years ago • 6 comments

Hello, thanks for the application!

I want to copy the full path to the directory or file where my cursor is located to the buffer. :print_path outputs the full path, as I need it, but will exit the broot application.

        {
            invocation: yank_full_path
            shortcut: yp
            execution: ":print_path"
            leave_broot: false
        }

Is there a solution to this?

I have such an alias in the shell, and I would like something similar for the broot:

yp='pwd | pbcopy'

#question #mac

OlegPQ avatar Nov 06 '22 21:11 OlegPQ

You may use the :copy_path internal.

(broot must be compiled with the "clipboard" feature)

Canop avatar Nov 06 '22 21:11 Canop

Wow, thx!

(broot must be compiled with the "clipboard" feature)

Yeah, at the moment I get the error "Clipboard feature not enabled at compilation"; I installed it through Homebrew and trying to figure out how to enable this feature.

OlegPQ avatar Nov 06 '22 21:11 OlegPQ

Unfortunately I can't provide precompiled binaries for Mac.

If you want to compile broot yourself you need to

  • install the rust environnement (using https://rustup.rs/)
  • fetch the repository
  • compile with cargo install --features clipboard --locked --path .

Canop avatar Nov 06 '22 21:11 Canop

Gotcha, thx.

Maybe someone has another solution that will use the standard pbcopy?

             execution: "$(echo {file} | pbcopy) ; br"
            from_shell: true

At the moment I have something like this, and it drops the cursor position, I know it's silly ^_^

OlegPQ avatar Nov 06 '22 21:11 OlegPQ

here is my solution for linux, without specifically compilling the package:

{
        invocation: "path_copy"
        execution: "echo -n {file} | xclip -selection clipboard;"     
        from_shell: true
        #leave_broot: false
    }

it rely on xclip . it won't work without from_shell: true, It's a shame because from_shell: true it NOT compatible with leave_broot: false (therefore I commented it out).

I wish I could find an xlip based solution that would NOT quit broot.

You can't simultaneously have leave_broot=false and from_shell=true

joihn avatar Nov 20 '23 10:11 joihn