###############################################################
# This file contains the verb definitions for broot
#
# Some verbs here are examples and not enabled by default: you
#  need to uncomment them if you want to use them.
#
# Documentation at https://dystroy.org/broot/verbs/
###############################################################

verbs: [

    # You should customize this standard opening of text files.
    # If you edit text files in your terminal (vi, emacs, helix, eg.), then
    #  you'll find it convenient to change the 'key' from 'ctrl-e' to 'enter'.
    #
    # If $EDITOR isn't set on your computer, you should either set it using
    #  something similar to
    #    export EDITOR=/usr/local/bin/nvim
    #  or just replace it with your editor of choice in the 'execution'
    #  pattern.
    # If your editor is able to open a file on a specific line, use {line}
    #  so that you may jump directly at the right line from a preview or
    #  a content search.
    # Examples depending on your favourite editor:
    #    execution: "nvim +{line} {file}"
    #    execution: "helix {file}:{line}"
    {
        invocation: edit
        shortcut: e
        key: ctrl-e
        apply_to: text_file
        execution: "$EDITOR {file}"
        leave_broot: false
    }

    # Example 1: launching `tail -n` on the selected file (leaving broot)
    # {
    #     name: tail_lines
    #     invocation: tl {lines_count}
    #     execution: "tail -f -n {lines_count} {file}"
    # }

    # Example 2: creating a new file without leaving broot
    # {
    #     name: touch
    #     invocation: touch {new_file}
    #     execution: "touch {directory}/{new_file}"
    #     leave_broot: false
    # }

    # A convenient shortcut to create new text files in
    #  the current directory or below
    {
        invocation: create {subpath}
        execution: "$EDITOR {directory}/{subpath}"
        leave_broot: false
    }

    {
        invocation: git_diff
        shortcut: gd
        leave_broot: false
        execution: "git difftool -y {file}"
    }

    # On ctrl-b, propose the creation of a copy of the selection.
    # While this might occasionally be useful, this verb is mostly here
    # as an example to demonstrate rare standard groups like {file-stem}
    # and {file-dot-extension} and the auto_exec verb property which
    # allows verbs to stay unexecuted until you hit enter
    {
        invocation: "backup {version}"
        key: ctrl-b
        leave_broot: false
        auto_exec: false
        execution: "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}"
    }

    # By default, `rm` does the system rm, and completely removes
    # the file. If you prefer to have the file moved to the system
    # trash, you may use the ':trash' internal with the verb below:
    # {
    #     invocation: "rm"
    #     internal: "trash"
    #     leave_broot: false
    # }

    # This verb lets you launch a terminal on ctrl-T
    # (on exit you'll be back in broot)
    {
        invocation: terminal
        key: ctrl-t
        execution: "$SHELL"
        set_working_dir: true
        leave_broot: false
    }

    # Here's an example of a verb needing the shell capabilities.
    # It copies all children of the currently selected directory
    #  to a destination you type.
    # It uses a star, which needs the shell for expansion. That's
    #  why such verb must have the `from_shell: true` parameter.
    # {
    #     invocation: "cpa {dest}"
    #     external: "cp -r {directory}/* {dest}"
    #     from_shell: true
    # }

    # Here's an example of a shortcut bringing you to your home directory
    # {
    #     invocation: home
    #     key: ctrl-home
    #     execution: ":focus ~"
    # }

    # Here's going to the work-dir root of the current git repository
    # {
    #     invocation: gtr
    #     execution: ":focus {git-root}"
    # }

    # A popular set of shortcuts for going up and down:
    #
    # {
    #     key: ctrl-k
    #     execution: ":line_up"
    # }
    # {
    #     key: ctrl-j
    #     execution: ":line_down"
    # }
    # {
    #     key: ctrl-u
    #     execution: ":page_up"
    # }
    # {
    #     key: ctrl-d
    #     execution: ":page_down"
    # }

    # If you develop using git, you might like to often switch
    # to the git status filter:
    # {
    #     key: alt-g
    #     execution: ":toggle_git_status"
    # }

    # You can reproduce the bindings of Norton Commander
    # on copying or moving to the other panel:
    # {
    #     key: F5
    #     external: "cp -r {file} {other-panel-directory}"
    #     leave_broot: false
    # }
    # {
    #     key: F6
    #     external: "mv {file} {other-panel-directory}"
    #     leave_broot: false
    # }
]

