Files
dotfiles/television/cable/files.toml
T

34 lines
971 B
TOML

[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat", "mtime-sort"]
# Most recently modified first; tv ranks matches and frecency on top.
[source]
command = [
{ name = "Default", run = "fd -t f | mtime-sort" },
{ name = "Hidden", run = "fd -t f -H | mtime-sort" },
]
shell = "bash"
[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
# ctrl-e (edit) and ctrl-h (goto_parent_dir) are bound in config.toml.
[keybindings]
shortcut = "f1"
[actions.edit]
description = "Opens the selected entries in nvim"
# Redirect to the tty: the fish ctrl-t binding runs tv inside a command
# substitution, so stdout is a pipe there.
command = "nvim {} </dev/tty >/dev/tty"
shell = "bash"
# use `mode = "fork"` if you want to return to tv afterwards
mode = "execute"
[actions.goto_parent_dir]
description = "Re-opens tv in the parent directory"
command = "tv files .. --inline"
mode = "execute"