From 61ebc723550f2996acd27711d4ee0c2b15cb57f2 Mon Sep 17 00:00:00 2001 From: alexandre pasmantier Date: Wed, 28 May 2025 00:46:39 +0200 Subject: [PATCH] WIP --- cable/unix/files.toml | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cable/unix/files.toml diff --git a/cable/unix/files.toml b/cable/unix/files.toml new file mode 100644 index 0000000..849aa52 --- /dev/null +++ b/cable/unix/files.toml @@ -0,0 +1,46 @@ +[metadata] +name = "files" +description = "A channel to select files and directories" +requirements = ["fd", "bat"] + +[source] +command = "fd -t f" +interactive = false + +[entry] +# only show the last path segment ('/a/b/c' -> 'c') +template = "{split:/-1}" +ansi = false + +[output] +# output the entire path when selecting entries +template = "{}" + +[preview] +command = "bat -n --color=always {}" +env = { "BAT_THEME" = "ansi" } + +[ui] +layout = "landscape" +scale = 100 +show_help = false +show_preview = true +input_position = "bottom" + +[keymap] +quit = ["esc", "ctrl-c"] +select_next_entry = ["down", "ctrl-n", "ctrl-j"] +select_prev_entry = ["up", "ctrl-p", "ctrl-k"] +confirm_selection = "enter" + +[actions.'open in $EDITOR'] +command = "$EDITOR {}" +mode = "become" # "become" / "spawn" / "transform" + +[actions.'remove'] +command = "rm {}" +mode = "spawn" + +[actions.'rename'] +command = "read -p \"New name: \" new_name && mv {} $new_name" +mode = "spawn"