From b0d68eb24609a43273813fbe53c2f561831645f5 Mon Sep 17 00:00:00 2001 From: Sebastian Lenzlinger Date: Thu, 11 Jun 2026 11:07:40 +0200 Subject: [PATCH] TELEVISION: add some cable channels --- .../dot-config/television/cable/alias.toml | 14 + .../television/cable/bash-history.toml | 10 + .../television/cable/brew-packages.toml | 30 +++ .../television/cable/cargo-commands.toml | 22 ++ .../dot-config/television/cable/channels.toml | 18 ++ .../dot-config/television/cable/dirs.toml | 13 + .../television/cable/distrobox-list.toml | 42 +++ .../television/cable/docker-containers.toml | 56 ++++ .../television/cable/docker-images.toml | 34 +++ .../dot-config/television/cable/dotfiles.toml | 18 ++ .../television/cable/downloads.toml | 31 +++ .../dot-config/television/cable/env.toml | 17 ++ .../dot-config/television/cable/files.toml | 27 ++ .../television/cable/gh-issues.toml | 32 +++ .../dot-config/television/cable/gh-prs.toml | 32 +++ .../television/cable/git-branch.toml | 37 +++ .../dot-config/television/cable/git-diff.toml | 33 +++ .../dot-config/television/cable/git-log.toml | 34 +++ .../television/cable/git-reflog.toml | 28 ++ .../television/cable/git-repos.toml | 30 +++ .../television/cable/git-stash.toml | 37 +++ .../dot-config/television/cable/git-tags.toml | 26 ++ .../television/cable/git-worktrees.toml | 24 ++ .../television/cable/just-recipes.toml | 18 ++ .../television/cable/k8s-contexts.toml | 27 ++ .../television/cable/k8s-deployments.toml | 37 +++ .../dot-config/television/cable/k8s-pods.toml | 51 ++++ .../television/cable/k8s-services.toml | 37 +++ .../television/cable/make-targets.toml | 18 ++ .../television/cable/man-pages.toml | 25 ++ .../dot-config/television/cable/mounts.toml | 19 ++ .../television/cable/npm-scripts.toml | 22 ++ .../television/cable/nu-history.toml | 9 + .../dot-config/television/cable/path.toml | 10 + .../television/cable/pdf-files.toml | 24 ++ .../television/cable/pip-packages.toml | 27 ++ .../dot-config/television/cable/ports.toml | 14 + .../dot-config/television/cable/procs.toml | 38 +++ .../television/cable/recent-files.toml | 22 ++ .../television/cable/ssh-hosts.toml | 18 ++ .../television/cable/systemd-units.toml | 49 ++++ .../dot-config/television/cable/text.toml | 28 ++ .../dot-config/television/cable/tldr.toml | 21 ++ .../television/cable/todo-comments.toml | 25 ++ .../dot-config/television/cable/unicode.toml | 43 +++ .../television/cable/zsh-history.toml | 11 + television/dot-config/television/config.toml | 247 ++++++++++++++++++ 47 files changed, 1485 insertions(+) create mode 100644 television/dot-config/television/cable/alias.toml create mode 100644 television/dot-config/television/cable/bash-history.toml create mode 100644 television/dot-config/television/cable/brew-packages.toml create mode 100644 television/dot-config/television/cable/cargo-commands.toml create mode 100644 television/dot-config/television/cable/channels.toml create mode 100644 television/dot-config/television/cable/dirs.toml create mode 100644 television/dot-config/television/cable/distrobox-list.toml create mode 100644 television/dot-config/television/cable/docker-containers.toml create mode 100644 television/dot-config/television/cable/docker-images.toml create mode 100644 television/dot-config/television/cable/dotfiles.toml create mode 100644 television/dot-config/television/cable/downloads.toml create mode 100644 television/dot-config/television/cable/env.toml create mode 100644 television/dot-config/television/cable/files.toml create mode 100644 television/dot-config/television/cable/gh-issues.toml create mode 100644 television/dot-config/television/cable/gh-prs.toml create mode 100644 television/dot-config/television/cable/git-branch.toml create mode 100644 television/dot-config/television/cable/git-diff.toml create mode 100644 television/dot-config/television/cable/git-log.toml create mode 100644 television/dot-config/television/cable/git-reflog.toml create mode 100644 television/dot-config/television/cable/git-repos.toml create mode 100644 television/dot-config/television/cable/git-stash.toml create mode 100644 television/dot-config/television/cable/git-tags.toml create mode 100644 television/dot-config/television/cable/git-worktrees.toml create mode 100644 television/dot-config/television/cable/just-recipes.toml create mode 100644 television/dot-config/television/cable/k8s-contexts.toml create mode 100644 television/dot-config/television/cable/k8s-deployments.toml create mode 100644 television/dot-config/television/cable/k8s-pods.toml create mode 100644 television/dot-config/television/cable/k8s-services.toml create mode 100644 television/dot-config/television/cable/make-targets.toml create mode 100644 television/dot-config/television/cable/man-pages.toml create mode 100644 television/dot-config/television/cable/mounts.toml create mode 100644 television/dot-config/television/cable/npm-scripts.toml create mode 100644 television/dot-config/television/cable/nu-history.toml create mode 100644 television/dot-config/television/cable/path.toml create mode 100644 television/dot-config/television/cable/pdf-files.toml create mode 100644 television/dot-config/television/cable/pip-packages.toml create mode 100644 television/dot-config/television/cable/ports.toml create mode 100644 television/dot-config/television/cable/procs.toml create mode 100644 television/dot-config/television/cable/recent-files.toml create mode 100644 television/dot-config/television/cable/ssh-hosts.toml create mode 100644 television/dot-config/television/cable/systemd-units.toml create mode 100644 television/dot-config/television/cable/text.toml create mode 100644 television/dot-config/television/cable/tldr.toml create mode 100644 television/dot-config/television/cable/todo-comments.toml create mode 100644 television/dot-config/television/cable/unicode.toml create mode 100644 television/dot-config/television/cable/zsh-history.toml create mode 100644 television/dot-config/television/config.toml diff --git a/television/dot-config/television/cable/alias.toml b/television/dot-config/television/cable/alias.toml new file mode 100644 index 0000000..68be046 --- /dev/null +++ b/television/dot-config/television/cable/alias.toml @@ -0,0 +1,14 @@ +[metadata] +name = "alias" +description = "A channel to select from shell aliases" + +[source] +# you may need to adjust the command depending on your shell +command = "$SHELL -ic 'alias'" +output = "{split:=:0}" + +[preview] +command = "$SHELL -ic 'alias' | grep -E '^(alias )?{split:=:0}='" + +[ui.preview_panel] +size = 30 diff --git a/television/dot-config/television/cable/bash-history.toml b/television/dot-config/television/cable/bash-history.toml new file mode 100644 index 0000000..47d57da --- /dev/null +++ b/television/dot-config/television/cable/bash-history.toml @@ -0,0 +1,10 @@ +# UNTESTED +[metadata] +name = "bash-history" +description = "A channel to select from your bash history" +requirements = ["bash"] + +[source] +command = "sed '1!G;h;$!d' ${HISTFILE:-${HOME}/.bash_history}" +no_sort = true +frecency = false diff --git a/television/dot-config/television/cable/brew-packages.toml b/television/dot-config/television/cable/brew-packages.toml new file mode 100644 index 0000000..18086ca --- /dev/null +++ b/television/dot-config/television/cable/brew-packages.toml @@ -0,0 +1,30 @@ +[metadata] +name = "brew-packages" +description = "List and manage Homebrew packages" +requirements = ["brew"] + +[source] +command = [ + "brew list --formula", + "brew list --cask", +] + +[preview] +command = "brew info '{}'" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-u = "actions:upgrade" +ctrl-d = "actions:uninstall" + +[actions.upgrade] +description = "Upgrade the selected package" +command = "brew upgrade '{}'" +mode = "execute" + +[actions.uninstall] +description = "Uninstall the selected package" +command = "brew uninstall '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/cargo-commands.toml b/television/dot-config/television/cable/cargo-commands.toml new file mode 100644 index 0000000..de483af --- /dev/null +++ b/television/dot-config/television/cable/cargo-commands.toml @@ -0,0 +1,22 @@ +[metadata] +name = "cargo-commands" +description = "List available cargo commands and extensions" +requirements = ["cargo"] + +[source] +command = "cargo --list 2>/dev/null | tail -n +2 | awk '{print $1}'" + +[preview] +command = "cargo {} --help 2>/dev/null | head -50" + +[ui] +layout = "portrait" +preview_panel = { size = 60 } + +[keybindings] +enter = "actions:run" + +[actions.run] +description = "Run the selected cargo command" +command = "cargo '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/channels.toml b/television/dot-config/television/cable/channels.toml new file mode 100644 index 0000000..dc9bbd1 --- /dev/null +++ b/television/dot-config/television/cable/channels.toml @@ -0,0 +1,18 @@ +[metadata] +name = "channels" +description = "Select a television channel" +requirements = ["tv", "bat"] + +[source] +command = ["tv list-channels"] + +[preview] +command = "bat -pn --color always ${XDG_CONFIG_HOME:-$HOME/.config}/television/cable/**/{}.toml" + +[keybindings] +enter = "actions:channel-enter" + +[actions.channel-enter] +description = "Enter a television channel" +command = "tv {}" +mode = "execute" diff --git a/television/dot-config/television/cable/dirs.toml b/television/dot-config/television/cable/dirs.toml new file mode 100644 index 0000000..75b6deb --- /dev/null +++ b/television/dot-config/television/cable/dirs.toml @@ -0,0 +1,13 @@ +[metadata] +name = "dirs" +description = "A channel to select from directories" +requirements = ["fd"] + +[source] +command = ["fd -t d", "fd -t d --hidden"] + +[preview] +command = "ls -la --color=always '{}'" + +[keybindings] +shortcut = "f2" diff --git a/television/dot-config/television/cable/distrobox-list.toml b/television/dot-config/television/cable/distrobox-list.toml new file mode 100644 index 0000000..8678e0f --- /dev/null +++ b/television/dot-config/television/cable/distrobox-list.toml @@ -0,0 +1,42 @@ +[metadata] +name = "distrobox-list" +description = "A channel to select a container from distrobox" +requirements = ["distrobox", "bat"] + +[source] +command = ["distrobox list | awk -F '|' '{ gsub(/ /, \"\", $2); print $2}' | tail --lines=+2"] + +[preview] +command = "(distrobox list | column -t -s '|' | awk -v selected_name={} 'NR==1 || $0 ~ selected_name') && echo && distrobox enter -d {} | bat --plain --color=always -lbash" + +[keybindings] +ctrl-e = "actions:distrobox-enter" +ctrl-l = "actions:distrobox-list" +ctrl-r = "actions:distrobox-rm" +ctrl-s = "actions:distrobox-stop" +ctrl-u = "actions:distrobox-upgrade" + +[actions.distrobox-enter] +description = "Enter a distrobox" +command = "distrobox enter {}" +mode = "execute" + +[actions.distrobox-list] +description = "List a distrobox" +command = "distrobox list | column -t -s '|' | awk -v selected_name={} 'NR==1 || $0 ~ selected_name'" +mode = "execute" + +[actions.distrobox-rm] +description = "Remove a distrobox" +command = "distrobox rm {}" +mode = "execute" + +[actions.distrobox-stop] +description = "Stop a distrobox" +command = "distrobox stop {}" +mode = "execute" + +[actions.distrobox-upgrade] +description = "Upgrade a distrobox" +command = "distrobox upgrade {}" +mode = "execute" diff --git a/television/dot-config/television/cable/docker-containers.toml b/television/dot-config/television/cable/docker-containers.toml new file mode 100644 index 0000000..0131acc --- /dev/null +++ b/television/dot-config/television/cable/docker-containers.toml @@ -0,0 +1,56 @@ +[metadata] +name = "docker-containers" +description = "List and manage Docker containers" +requirements = ["docker"] + +[source] +command = [ + "docker ps --format '{{.Names}}\\t{{.Image}}\\t{{.Status}}'", + "docker ps -a --format '{{.Names}}\\t{{.Image}}\\t{{.Status}}'", +] +display = "{split:\\t:0} ({split:\\t:2})" +output = "{split:\\t:0}" + +[preview] +command = "docker inspect '{split:\\t:0}' | jq -C '.[0] | {Name, State, Config: {Image: .Config.Image, Cmd: .Config.Cmd}, NetworkSettings: {IPAddress: .NetworkSettings.IPAddress}}'" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-s = "actions:start" +f2 = "actions:stop" +ctrl-r = "actions:restart" +ctrl-l = "actions:logs" +ctrl-e = "actions:exec" +ctrl-d = "actions:remove" + +[actions.start] +description = "Start the selected container" +command = "docker start '{split:\\t:0}'" +mode = "fork" + +[actions.stop] +description = "Stop the selected container" +command = "docker stop '{split:\\t:0}'" +mode = "fork" + +[actions.restart] +description = "Restart the selected container" +command = "docker restart '{split:\\t:0}'" +mode = "fork" + +[actions.logs] +description = "Follow logs of the selected container" +command = "docker logs -f '{split:\\t:0}'" +mode = "execute" + +[actions.exec] +description = "Execute shell in the selected container" +command = "docker exec -it '{split:\\t:0}' /bin/sh" +mode = "execute" + +[actions.remove] +description = "Remove the selected container" +command = "docker rm '{split:\\t:0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/docker-images.toml b/television/dot-config/television/cable/docker-images.toml new file mode 100644 index 0000000..a7948ab --- /dev/null +++ b/television/dot-config/television/cable/docker-images.toml @@ -0,0 +1,34 @@ +[metadata] +name = "docker-images" +description = "A channel to select from Docker images" +requirements = ["docker", "jq"] + +[source] +command = "docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}'" +output = "{split: :-1}" + +[preview] +command = "docker image inspect '{split: :-1}' | jq -C" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-r = "actions:run" +ctrl-d = "actions:remove" +ctrl-s = "actions:shell" + +[actions.run] +description = "Run a container from the selected image" +command = "docker run -it '{split: :-1}'" +mode = "execute" + +[actions.shell] +description = "Run a shell in the selected image" +command = "docker run -it '{split: :-1}' /bin/sh" +mode = "execute" + +[actions.remove] +description = "Remove the selected image" +command = "docker rmi '{split: :-1}'" +mode = "execute" diff --git a/television/dot-config/television/cable/dotfiles.toml b/television/dot-config/television/cable/dotfiles.toml new file mode 100644 index 0000000..1d76a93 --- /dev/null +++ b/television/dot-config/television/cable/dotfiles.toml @@ -0,0 +1,18 @@ +[metadata] +name = "dotfiles" +description = "A channel to select from your user's dotfiles" +requirements = ["fd", "bat"] + +[source] +command = "fd -t f . $HOME/.config" + +[preview] +command = "bat -n --color=always '{}'" + +[keybindings] +enter = "actions:edit" + +[actions.edit] +description = "Edit the selected dotfile" +command = "${EDITOR:-vim} '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/downloads.toml b/television/dot-config/television/cable/downloads.toml new file mode 100644 index 0000000..9495077 --- /dev/null +++ b/television/dot-config/television/cable/downloads.toml @@ -0,0 +1,31 @@ +[metadata] +name = "downloads" +description = "Browse recent files in Downloads folder" +requirements = ["fd", "bat"] + +[source] +command = "fd -t f . ~/Downloads --changed-within 30d 2>/dev/null | head -200" + +[preview] +command = "bat -n --color=always '{}' 2>/dev/null || file '{}'" +env = { BAT_THEME = "ansi" } + +[keybindings] +enter = "actions:open" +ctrl-d = "actions:delete" +ctrl-m = "actions:move" + +[actions.open] +description = "Open the selected file with default application" +command = "xdg-open '{}' 2>/dev/null || open '{}'" +mode = "fork" + +[actions.delete] +description = "Delete the selected file" +command = "rm -i '{}'" +mode = "execute" + +[actions.move] +description = "Move the selected file to current directory" +command = "mv '{}' ." +mode = "fork" diff --git a/television/dot-config/television/cable/env.toml b/television/dot-config/television/cable/env.toml new file mode 100644 index 0000000..46a1c83 --- /dev/null +++ b/television/dot-config/television/cable/env.toml @@ -0,0 +1,17 @@ +[metadata] +name = "env" +description = "A channel to select from environment variables" + +[source] +command = "printenv" +output = "{split:=:1..}" # output the value + +[preview] +command = "echo '{split:=:1..}'" + +[ui] +layout = "portrait" +preview_panel = { size = 20, header = "{split:=:0}" } + +[keybindings] +shortcut = "f3" diff --git a/television/dot-config/television/cable/files.toml b/television/dot-config/television/cable/files.toml new file mode 100644 index 0000000..63c5b84 --- /dev/null +++ b/television/dot-config/television/cable/files.toml @@ -0,0 +1,27 @@ +[metadata] +name = "files" +description = "A channel to select files and directories" +requirements = ["fd", "bat"] + +[source] +command = ["fd -t f", "fd -t f -H"] + +[preview] +command = "bat -n --color=always '{}'" +env = { BAT_THEME = "ansi" } + +[keybindings] +shortcut = "f1" +f12 = "actions:edit" +ctrl-up = "actions:goto_parent_dir" + +[actions.edit] +description = "Opens the selected entries with the default editor (falls back to vim)" +command = "${EDITOR:-vim} '{}'" +# 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 .." +mode = "execute" diff --git a/television/dot-config/television/cable/gh-issues.toml b/television/dot-config/television/cable/gh-issues.toml new file mode 100644 index 0000000..2ebfa8a --- /dev/null +++ b/television/dot-config/television/cable/gh-issues.toml @@ -0,0 +1,32 @@ +[metadata] +name = "gh-issues" +description = "List GitHub issues for the current repo" +requirements = ["gh", "jq"] + +[source] +command = '''gh issue list --state open --limit 100 --json number,title,createdAt,author,labels | jq -r 'sort_by(.createdAt) | reverse | .[] | " \u001b[32m#\(.number)\u001b[39m \(.title) \u001b[33m@\(.author.login)\u001b[39m" + (if (.labels | length) > 0 then " " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end)' +''' +ansi = true +output = "{strip_ansi|split:#:1|split: :0}" + +[ui] +layout = "portrait" +preview_panel = { header = '{strip_ansi|split:#:1|split: :0}' } + +[preview] +command = '''gh issue view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,author,createdAt,updatedAt,labels,assignees | jq -r ' +" " + .title, +" #" + (.number | tostring), +"", +" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m", +" \u001b[36mAuthor:\u001b[39m \u001b[33m" + .author.login + "\u001b[39m", +" \u001b[36mCreated:\u001b[39m " + (.createdAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end), +" \u001b[36mUpdated:\u001b[39m " + (.updatedAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end), +(if (.labels | length) > 0 then " \u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end), +(if (.assignees | length) > 0 then " \u001b[36mAssignees:\u001b[39m " + ([.assignees[].login] | join(", ")) else "" end), +"", +" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m", +"", +(.body // "")' +''' + diff --git a/television/dot-config/television/cable/gh-prs.toml b/television/dot-config/television/cable/gh-prs.toml new file mode 100644 index 0000000..cfaa0ab --- /dev/null +++ b/television/dot-config/television/cable/gh-prs.toml @@ -0,0 +1,32 @@ +[metadata] +name = "gh-prs" +description = "List GitHub PRs for the current repo" +requirements = ["gh", "jq"] + +[source] +command = '''gh pr list --state open --limit 100 --json number,title,createdAt,author,labels | jq -r 'sort_by(.createdAt) | reverse | .[] | " \u001b[32m#\(.number)\u001b[39m \(.title) \u001b[33m@\(.author.login)\u001b[39m" + (if (.labels | length) > 0 then " " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end)' +''' +output = '{strip_ansi|split:#:1|split: :0}' +ansi = true + +[ui] +layout = "portrait" + +[preview] +command = '''gh pr view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,headRefName,baseRefName,author,createdAt,updatedAt,mergeable,changedFiles,additions,deletions,labels,assignees,reviewDecision,headRepository,headRepositoryOwner | jq -r ' +" " + .title, +" #" + (.number | tostring), +"", +" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m " + .baseRefName + " ← " + .headRefName, +" \u001b[36mRepo:\u001b[39m \u001b[34m" + (.headRepositoryOwner.login) + "/" + (.headRepository.name) + "\u001b[39m", +" \u001b[36mAuthor:\u001b[39m \u001b[33m" + .author.login + "\u001b[39m", +" \u001b[36mCreated:\u001b[39m " + (.createdAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end), +" \u001b[36mUpdated:\u001b[39m " + (.updatedAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end), +(if (.labels | length) > 0 then " \u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end), +" \u001b[36mMerge Status:\u001b[39m " + (if .mergeable == "MERGEABLE" then "\u001b[32m✓ Clean\u001b[39m" elif .mergeable == "CONFLICTING" then "\u001b[31m✗ Dirty\u001b[39m" else "\u001b[33m? Unknown\u001b[39m" end), +" \u001b[36mChanges:\u001b[39m " + (.changedFiles | tostring) + " files \u001b[32m+" + (.additions | tostring) + "\u001b[39m \u001b[31m-" + (.deletions | tostring) + "\u001b[39m", +"", +" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m", +"", +(.body // "")' +''' diff --git a/television/dot-config/television/cable/git-branch.toml b/television/dot-config/television/cable/git-branch.toml new file mode 100644 index 0000000..d1e2032 --- /dev/null +++ b/television/dot-config/television/cable/git-branch.toml @@ -0,0 +1,37 @@ +[metadata] +name = "git-branch" +description = "A channel to select from git branches" +requirements = ["git"] + +[source] +command = "git --no-pager branch --all --format=\"%(refname:short)\"" +output = "{split: :0}" + +[preview] +command = "git show -p --stat --pretty=fuller --color=always '{0}'" + +[keybindings] +enter = "actions:checkout" +ctrl-d = "actions:delete" +ctrl-m = "actions:merge" +ctrl-r = "actions:rebase" + +[actions.checkout] +description = "Checkout the selected branch" +command = "git checkout '{0}'" +mode = "execute" + +[actions.delete] +description = "Delete the selected branch" +command = "git branch -d '{0}'" +mode = "execute" + +[actions.merge] +description = "Merge the selected branch into current branch" +command = "git merge '{0}'" +mode = "execute" + +[actions.rebase] +description = "Rebase current branch onto the selected branch" +command = "git rebase '{0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-diff.toml b/television/dot-config/television/cable/git-diff.toml new file mode 100644 index 0000000..f4ab9e1 --- /dev/null +++ b/television/dot-config/television/cable/git-diff.toml @@ -0,0 +1,33 @@ +[metadata] +name = "git-diff" +description = "A channel to select files from git diff commands" +requirements = ["git"] + +[source] +command = "git diff --name-only HEAD" + +[preview] +command = "git diff HEAD --color=always -- '{}'" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-s = "actions:stage" +ctrl-r = "actions:restore" +ctrl-e = "actions:edit" + +[actions.stage] +description = "Stage the selected file" +command = "git add '{}'" +mode = "fork" + +[actions.restore] +description = "Discard changes in the selected file" +command = "git restore '{}'" +mode = "fork" + +[actions.edit] +description = "Open the selected file in editor" +command = "${EDITOR:-vim} '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-log.toml b/television/dot-config/television/cable/git-log.toml new file mode 100644 index 0000000..9f80a9f --- /dev/null +++ b/television/dot-config/television/cable/git-log.toml @@ -0,0 +1,34 @@ +[metadata] +name = "git-log" +description = "A channel to select from git log entries" +requirements = ["git"] + +[source] +command = "git log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color=always" +output = "{strip_ansi|split: :1}" +ansi = true +no_sort = true +frecency = false + +[preview] +command = "git show -p --stat --pretty=fuller --color=always '{strip_ansi|split: :1}' | head -n 1000" + +[keybindings] +ctrl-y = "actions:cherry-pick" +ctrl-r = "actions:revert" +ctrl-o = "actions:checkout" + +[actions.cherry-pick] +description = "Cherry-pick the selected commit" +command = "git cherry-pick '{strip_ansi|split: :1}'" +mode = "execute" + +[actions.revert] +description = "Revert the selected commit" +command = "git revert '{strip_ansi|split: :1}'" +mode = "execute" + +[actions.checkout] +description = "Checkout the selected commit" +command = "git checkout '{strip_ansi|split: :1}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-reflog.toml b/television/dot-config/television/cable/git-reflog.toml new file mode 100644 index 0000000..e16dff1 --- /dev/null +++ b/television/dot-config/television/cable/git-reflog.toml @@ -0,0 +1,28 @@ +[metadata] +name = "git-reflog" +description = "A channel to select from git reflog entries" +requirements = ["git"] + +[source] +command = "git reflog --decorate --color=always" +output = "{0|strip_ansi}" +ansi = true +no_sort = true +frecency = false + +[preview] +command = "git show -p --stat --pretty=fuller --color=always '{0|strip_ansi}'" + +[keybindings] +ctrl-o = "actions:checkout" +ctrl-r = "actions:reset" + +[actions.checkout] +description = "Checkout the selected reflog entry" +command = "git checkout '{0|strip_ansi}'" +mode = "execute" + +[actions.reset] +description = "Reset --hard to the selected reflog entry" +command = "git reset --hard '{0|strip_ansi}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-repos.toml b/television/dot-config/television/cable/git-repos.toml new file mode 100644 index 0000000..c0d9b71 --- /dev/null +++ b/television/dot-config/television/cable/git-repos.toml @@ -0,0 +1,30 @@ +[metadata] +name = "git-repos" +requirements = ["fd", "git"] +description = """ +A channel to select from git repositories on your local machine. + +This channel uses `fd` to find directories that contain a `.git` subdirectory, and then allows you to preview the git log of the selected repository. +""" + +[source] +# this is a macos version of the command. While perfectly usable on linux, you may want to tweak it a bit. +command = "fd -g .git -HL -t d -d 10 --prune ~ -E 'Library' -E 'Application Support' --exec dirname '{}'" +display = "{split:/:-1}" + +[preview] +command = "cd '{}'; git log -n 200 --pretty=medium --all --graph --color" + +[keybindings] +enter = "actions:cd" +ctrl-e = "actions:edit" + +[actions.cd] +description = "Open a new shell in the selected repository" +command = "cd '{}' && $SHELL" +mode = "execute" + +[actions.edit] +description = "Open the repository in editor" +command = "${EDITOR:-vim} '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-stash.toml b/television/dot-config/television/cable/git-stash.toml new file mode 100644 index 0000000..bcd6719 --- /dev/null +++ b/television/dot-config/television/cable/git-stash.toml @@ -0,0 +1,37 @@ +[metadata] +name = "git-stash" +description = "Browse and manage git stash entries" +requirements = ["git"] + +[source] +command = "git stash list --color=always" +ansi = true +output = "{strip_ansi|split:\\::0}" +no_sort = true +frecency = false + +[preview] +command = "git stash show -p --color=always '{strip_ansi|split:\\::0}'" + +[ui] +layout = "portrait" + +[keybindings] +enter = "actions:apply" +ctrl-p = "actions:pop" +ctrl-d = "actions:drop" + +[actions.apply] +description = "Apply the selected stash" +command = "git stash apply '{strip_ansi|split:\\::0}'" +mode = "execute" + +[actions.pop] +description = "Pop the selected stash (apply and remove)" +command = "git stash pop '{strip_ansi|split:\\::0}'" +mode = "execute" + +[actions.drop] +description = "Drop the selected stash" +command = "git stash drop '{strip_ansi|split:\\::0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-tags.toml b/television/dot-config/television/cable/git-tags.toml new file mode 100644 index 0000000..c544885 --- /dev/null +++ b/television/dot-config/television/cable/git-tags.toml @@ -0,0 +1,26 @@ +[metadata] +name = "git-tags" +description = "Browse and checkout git tags" +requirements = ["git"] + +[source] +command = "git tag --sort=-creatordate" +no_sort = true +frecency = false + +[preview] +command = "git show --color=always '{}'" + +[keybindings] +enter = "actions:checkout" +ctrl-d = "actions:delete" + +[actions.checkout] +description = "Checkout the selected tag" +command = "git checkout '{}'" +mode = "execute" + +[actions.delete] +description = "Delete the selected tag" +command = "git tag -d '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/git-worktrees.toml b/television/dot-config/television/cable/git-worktrees.toml new file mode 100644 index 0000000..32311f2 --- /dev/null +++ b/television/dot-config/television/cable/git-worktrees.toml @@ -0,0 +1,24 @@ +[metadata] +name = "git-worktrees" +description = "List and switch between git worktrees" +requirements = ["git"] + +[source] +command = "git worktree list --porcelain | grep '^worktree' | cut -d' ' -f2-" + +[preview] +command = "cd '{}' && git log --oneline -10 --color=always && echo && git status --short" + +[keybindings] +enter = "actions:cd" +ctrl-d = "actions:remove" + +[actions.cd] +description = "Change to the selected worktree" +command = "cd '{}' && $SHELL" +mode = "execute" + +[actions.remove] +description = "Remove the selected worktree" +command = "git worktree remove '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/just-recipes.toml b/television/dot-config/television/cable/just-recipes.toml new file mode 100644 index 0000000..69b2fd2 --- /dev/null +++ b/television/dot-config/television/cable/just-recipes.toml @@ -0,0 +1,18 @@ +[metadata] +name = "just-recipes" +description = "A channel to select recipes from Justfiles" +requirements = ["just"] + +[source] +command = ["just --summary | tr '[:blank:]' '\n'"] + +[preview] +command = "just -s {}" + +[keybindings] +f5 = "actions:execute-recipe" + +[actions.execute-recipe] +description = "Execute a justfile recipe" +command = "just {}" +mode = "execute" diff --git a/television/dot-config/television/cable/k8s-contexts.toml b/television/dot-config/television/cable/k8s-contexts.toml new file mode 100644 index 0000000..38b07f3 --- /dev/null +++ b/television/dot-config/television/cable/k8s-contexts.toml @@ -0,0 +1,27 @@ +[metadata] +name = "k8s-contexts" +description = "List and switch kubectl contexts" +requirements = ["kubectl"] + +[source] +command = "kubectl config get-contexts -o name" + +[preview] +command = "kubectl config view --minify --context='{}' -o yaml" + +[ui] +layout = "portrait" + +[keybindings] +enter = "actions:use" +ctrl-d = "actions:delete" + +[actions.use] +description = "Switch to the selected context" +command = "kubectl config use-context '{}'" +mode = "execute" + +[actions.delete] +description = "Delete the selected context" +command = "kubectl config delete-context '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/k8s-deployments.toml b/television/dot-config/television/cable/k8s-deployments.toml new file mode 100644 index 0000000..23a4248 --- /dev/null +++ b/television/dot-config/television/cable/k8s-deployments.toml @@ -0,0 +1,37 @@ +[metadata] +name = "k8s-deployments" +description = '''List and preview Deployments in a Kubernetes Cluster. + +The first source lists only from the current namespace, while the second lists from all. + +Keybindings + +Press `ctrl-d` to delete the selected Deployment. +''' +requirements = ["kubectl"] + +[source] +command = [ + ''' + kubectl get deployments -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' + ''', + ''' + kubectl get deployments -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces + ''', +] +output = "{1}" + +[preview] +command = "kubectl describe -n {0} deployments/{1}" + +[ui] +layout = "portrait" +preview_panel = { size = 60 } + +[keybindings] +ctrl-d = "actions:delete" + +[actions.delete] +description = "Delete the selected Deployment" +command = "kubectl delete -n {0} deployments/{1}" +mode = "execute" diff --git a/television/dot-config/television/cable/k8s-pods.toml b/television/dot-config/television/cable/k8s-pods.toml new file mode 100644 index 0000000..9197b9e --- /dev/null +++ b/television/dot-config/television/cable/k8s-pods.toml @@ -0,0 +1,51 @@ +[metadata] +name = "k8s-pods" +description = '''List and preview Pods in a Kubernetes Cluster. + +The first source lists only from the current namespace, while the second lists from all. + +Keybindings + +Press `ctrl-e` to execute shell inside the selected Pod. +Press `ctrl-d` to delete the selected Pod. +Press `ctrl-l` to print and follow the logs of the selected Pod. +''' +requirements = ["kubectl"] + +[source] +command = [ + ''' + kubectl get pods -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' + ''', + ''' + kubectl get pods -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces + ''', +] +output = "{1}" + +[preview] +command = "kubectl describe -n {0} pods/{1}" + +[ui] +layout = "portrait" +preview_panel = { size = 60 } + +[keybindings] +ctrl-d = "actions:delete" +ctrl-e = "actions:exec" +ctrl-l = "actions:logs" + +[actions.exec] +description = "Execute shell inside the selected Pod" +command = "kubectl exec -i -t -n {0} pods/{1} -- /bin/sh" +mode = "execute" + +[actions.delete] +description = "Delete the selected Pod" +command = "kubectl delete -n {0} pods/{1}" +mode = "execute" + +[actions.logs] +description = "Follow logs of the selected Pod" +command = "kubectl logs -f -n {0} pods/{1}" +mode = "execute" diff --git a/television/dot-config/television/cable/k8s-services.toml b/television/dot-config/television/cable/k8s-services.toml new file mode 100644 index 0000000..2b912af --- /dev/null +++ b/television/dot-config/television/cable/k8s-services.toml @@ -0,0 +1,37 @@ +[metadata] +name = "k8s-services" +description = '''List and preview Services in a Kubernetes Cluster. + +The first source lists only from the current namespace, while the second lists from all. + +keybindings + +Press `ctrl-d` to delete the selected Service. +''' +requirements = ["kubectl"] + +[source] +command = [ + ''' + kubectl get services -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' + ''', + ''' + kubectl get services -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces + ''', +] +output = "{1}" + +[preview] +command = "kubectl describe -n {0} services/{1}" + +[ui] +layout = "portrait" +preview_panel = { size = 60 } + +[keybindings] +ctrl-d = "actions:delete" + +[actions.delete] +description = "Delete the selected Service" +command = "kubectl delete -n {0} services/{1}" +mode = "execute" diff --git a/television/dot-config/television/cable/make-targets.toml b/television/dot-config/television/cable/make-targets.toml new file mode 100644 index 0000000..dbf78aa --- /dev/null +++ b/television/dot-config/television/cable/make-targets.toml @@ -0,0 +1,18 @@ +[metadata] +name = "make-targets" +description = "List and run Makefile targets" +requirements = ["make", "awk"] + +[source] +command = "make -pRrq 2>/dev/null | awk -F: '/^[a-zA-Z0-9][^$#\\/\\t=]*:([^=]|$)/ {split($1,a,\" \"); print a[1]}' | sort -u | grep -v '^Makefile$'" + +[preview] +command = "awk '/^{}[[:space:]]*:/{found=1} found{print; if(/^[^\\t]/ && NR>1 && !/^{}[[:space:]]*:/) exit}' Makefile" + +[keybindings] +enter = "actions:run" + +[actions.run] +description = "Run the selected make target" +command = "make {}" +mode = "execute" diff --git a/television/dot-config/television/cable/man-pages.toml b/television/dot-config/television/cable/man-pages.toml new file mode 100644 index 0000000..aac216a --- /dev/null +++ b/television/dot-config/television/cable/man-pages.toml @@ -0,0 +1,25 @@ +[metadata] +name = "man-pages" +description = "Browse and preview system manual pages" +requirements = ["apropos", "man", "col"] + +[source] +# List all man pages using apropos +command = "apropos ." + +[preview] +# Show the man page for the selected entry +command = "man '{0}' | col -bx" +env = { "MANWIDTH" = "80" } + +[keybindings] +enter = "actions:open" + +[actions.open] +description = "Open the selected man page in the system pager" +command = "man '{0}'" +mode = "execute" + +[ui] +layout = "portrait" +preview_panel = { header = "{0}" } diff --git a/television/dot-config/television/cable/mounts.toml b/television/dot-config/television/cable/mounts.toml new file mode 100644 index 0000000..02f62b7 --- /dev/null +++ b/television/dot-config/television/cable/mounts.toml @@ -0,0 +1,19 @@ +[metadata] +name = "mounts" +description = "List mounted filesystems" +requirements = ["df", "awk"] + +[source] +command = "df -h --output=target,fstype,size,used,avail,pcent 2>/dev/null | tail -n +2" +display = "{split: :0}" + +[preview] +command = "df -h '{}' && echo && ls -la '{}' 2>/dev/null | head -20" + +[keybindings] +enter = "actions:cd" + +[actions.cd] +description = "Open a shell in the selected mount point" +command = "cd '{}' && $SHELL" +mode = "execute" diff --git a/television/dot-config/television/cable/npm-scripts.toml b/television/dot-config/television/cable/npm-scripts.toml new file mode 100644 index 0000000..8c966c2 --- /dev/null +++ b/television/dot-config/television/cable/npm-scripts.toml @@ -0,0 +1,22 @@ +[metadata] +name = "npm-scripts" +description = "List and run npm scripts from package.json" +requirements = ["jq"] + +[source] +command = "jq -r '.scripts | to_entries[] | \"\\(.key)\\t\\(.value)\"' package.json 2>/dev/null" +display = "{split:\\t:0}" + +[preview] +command = "jq -r '.scripts[\"{split:\\t:0}\"]' package.json" + +[ui.preview_panel] +size = 30 + +[keybindings] +enter = "actions:run" + +[actions.run] +description = "Run the selected npm script" +command = "npm run '{split:\\t:0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/nu-history.toml b/television/dot-config/television/cable/nu-history.toml new file mode 100644 index 0000000..f6d9899 --- /dev/null +++ b/television/dot-config/television/cable/nu-history.toml @@ -0,0 +1,9 @@ + +[metadata] +name = "nu-history" +description = "A channel to select from your nu history" + +[source] +command = "nu -c 'open $nu.history-path | lines | uniq | reverse | to text'" +no_sort = true +frecency = false diff --git a/television/dot-config/television/cable/path.toml b/television/dot-config/television/cable/path.toml new file mode 100644 index 0000000..ccb0519 --- /dev/null +++ b/television/dot-config/television/cable/path.toml @@ -0,0 +1,10 @@ +[metadata] +name = "path" +description = "Investigate PATH contents" +requirements = ["fd", "bat"] + +[source] +command = "printf '%s\n' \"$PATH\" | tr ':' '\n'" + +[preview] +command = "fd -tx -d1 . \"{}\" -X printf \"%s\n\" \"{/}\" | sort -f | bat -n --color=always" diff --git a/television/dot-config/television/cable/pdf-files.toml b/television/dot-config/television/cable/pdf-files.toml new file mode 100644 index 0000000..018aad4 --- /dev/null +++ b/television/dot-config/television/cable/pdf-files.toml @@ -0,0 +1,24 @@ +[metadata] +name = "pdf-files" +description = "Browse PDF files" +requirements = ["fd", "pdftotext"] + +[source] +command = [ + "fd -t f -e pdf .", + "fd -t f -e pdf -H .", +] + +[preview] +command = "pdftotext -l 2 -layout '{}' - 2>/dev/null | head -100 || file '{}'" + +[ui] +layout = "portrait" + +[keybindings] +enter = "actions:open" + +[actions.open] +description = "Open the selected PDF with default viewer" +command = "xdg-open '{}' 2>/dev/null || open '{}'" +mode = "fork" diff --git a/television/dot-config/television/cable/pip-packages.toml b/television/dot-config/television/cable/pip-packages.toml new file mode 100644 index 0000000..ba9287f --- /dev/null +++ b/television/dot-config/television/cable/pip-packages.toml @@ -0,0 +1,27 @@ +[metadata] +name = "pip-packages" +description = "List installed Python packages" +requirements = ["pip"] + +[source] +command = "pip list --format=freeze 2>/dev/null | cut -d= -f1" + +[preview] +command = "pip show '{}'" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-u = "actions:upgrade" +ctrl-d = "actions:uninstall" + +[actions.upgrade] +description = "Upgrade the selected package" +command = "pip install --upgrade '{}'" +mode = "execute" + +[actions.uninstall] +description = "Uninstall the selected package" +command = "pip uninstall '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/ports.toml b/television/dot-config/television/cable/ports.toml new file mode 100644 index 0000000..2690f48 --- /dev/null +++ b/television/dot-config/television/cable/ports.toml @@ -0,0 +1,14 @@ +[metadata] +name = "ports" +description = "List listening ports and associated processes" +requirements = ["ss", "awk"] + +[source] +command = "ss -tlnp 2>/dev/null | tail -n +2 | awk '{gsub(/.*:/,\"\",$4); print $4, $1, $6}' | sed 's/users:((\"//; s/\".*//'" +display = "{split: :0} ({split: :2})" + +[preview] +command = "ss -tlnp 2>/dev/null | grep ':{split: :0} ' | head -20" + +[ui.preview_panel] +size = 40 diff --git a/television/dot-config/television/cable/procs.toml b/television/dot-config/television/cable/procs.toml new file mode 100644 index 0000000..de87ff7 --- /dev/null +++ b/television/dot-config/television/cable/procs.toml @@ -0,0 +1,38 @@ +[metadata] +name = "procs" +description = "A channel to find and manage running processes" +requirements = ["ps", "awk"] + +[source] +command = "ps -e -o pid=,ucomm= | awk '{print $1, $2}'" +display = "{split: :1}" +output = "{split: :0}" + +[preview] +command = "ps -p '{split: :0}' -o user,pid,ppid,state,%cpu,%mem,command | fold" + +[keybindings] +ctrl-k = "actions:kill" +f2 = "actions:term" +ctrl-s = "actions:stop" +ctrl-c = "actions:cont" + +[actions.kill] +description = "Kill the selected process (SIGKILL)" +command = "kill -9 {split: :0}" +mode = "execute" + +[actions.term] +description = "Terminate the selected process (SIGTERM)" +command = "kill -15 {split: :0}" +mode = "execute" + +[actions.stop] +description = "Stop/pause the selected process (SIGSTOP)" +command = "kill -STOP {split: :0}" +mode = "fork" + +[actions.cont] +description = "Continue/resume the selected process (SIGCONT)" +command = "kill -CONT {split: :0}" +mode = "fork" diff --git a/television/dot-config/television/cable/recent-files.toml b/television/dot-config/television/cable/recent-files.toml new file mode 100644 index 0000000..8493d2c --- /dev/null +++ b/television/dot-config/television/cable/recent-files.toml @@ -0,0 +1,22 @@ +[metadata] +name = "recent-files" +description = "List recently modified files (via git or filesystem)" +requirements = ["git", "bat"] + +[source] +command = [ + "git diff --name-only HEAD~10 HEAD 2>/dev/null || find . -type f -mtime -7 -not -path '*/.*' 2>/dev/null | head -100", + "find . -type f -mmin -60 -not -path '*/.*' 2>/dev/null | head -100", +] + +[preview] +command = "bat -n --color=always '{}'" +env = { BAT_THEME = "ansi" } + +[keybindings] +enter = "actions:edit" + +[actions.edit] +description = "Open the selected file in editor" +command = "${EDITOR:-vim} '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/ssh-hosts.toml b/television/dot-config/television/cable/ssh-hosts.toml new file mode 100644 index 0000000..046b7e1 --- /dev/null +++ b/television/dot-config/television/cable/ssh-hosts.toml @@ -0,0 +1,18 @@ +[metadata] +name = "ssh-hosts" +description = "A channel to select hosts from your SSH config" +requirements = ["grep", "tr", "cut", "awk"] + +[source] +command = "grep -E '^Host(name)? ' $HOME/.ssh/config | tr -s ' ' | cut -d' ' -f2- | tr ' ' '\n' | grep -v '^$'" + +[preview] +command = "awk '/^Host / { found=0 } /^Host (.*[[:space:]])?'{}'([[:space:]].*)?$/ { found=1 } found' $HOME/.ssh/config" + +[keybindings] +enter = "actions:connect" + +[actions.connect] +description = "SSH into the selected host" +command = "ssh '{}'" +mode = "execute" diff --git a/television/dot-config/television/cable/systemd-units.toml b/television/dot-config/television/cable/systemd-units.toml new file mode 100644 index 0000000..cd137c8 --- /dev/null +++ b/television/dot-config/television/cable/systemd-units.toml @@ -0,0 +1,49 @@ +[metadata] +name = "systemd-units" +description = "List and manage systemd services" +requirements = ["systemctl"] + +[source] +command = [ + "systemctl list-units --type=service --no-pager --no-legend --plain", + "systemctl list-units --type=service --all --no-pager --no-legend --plain", +] +display = "{split: :0}" + +[preview] +command = "systemctl status '{split: :0}' --no-pager" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-s = "actions:start" +f2 = "actions:stop" +ctrl-r = "actions:restart" +ctrl-e = "actions:enable" +ctrl-d = "actions:disable" + +[actions.start] +description = "Start the selected service" +command = "sudo systemctl start '{split: :0}'" +mode = "execute" + +[actions.stop] +description = "Stop the selected service" +command = "sudo systemctl stop '{split: :0}'" +mode = "execute" + +[actions.restart] +description = "Restart the selected service" +command = "sudo systemctl restart '{split: :0}'" +mode = "execute" + +[actions.enable] +description = "Enable the selected service" +command = "sudo systemctl enable '{split: :0}'" +mode = "execute" + +[actions.disable] +description = "Disable the selected service" +command = "sudo systemctl disable '{split: :0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/text.toml b/television/dot-config/television/cable/text.toml new file mode 100644 index 0000000..d1ae186 --- /dev/null +++ b/television/dot-config/television/cable/text.toml @@ -0,0 +1,28 @@ +[metadata] +name = "text" +description = "A channel to find and select text from files" +requirements = ["rg", "bat"] + +[source] +command = [ + "rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always", + "rg . --no-heading --line-number --hidden --colors 'match:fg:white' --colors 'path:fg:blue' --color=always", +] +ansi = true +output = "{strip_ansi|split:\\::..2}" + +[preview] +command = "bat -n --color=always '{strip_ansi|split:\\::0}'" +env = { BAT_THEME = "ansi" } +offset = '{strip_ansi|split:\::1}' + +[ui] +preview_panel = { header = '{strip_ansi|split:\::..2}' } + +[keybindings] +enter = "actions:edit" + +[actions.edit] +description = "Open file in editor at line" +command = "${EDITOR:-vim} '+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/tldr.toml b/television/dot-config/television/cable/tldr.toml new file mode 100644 index 0000000..884b453 --- /dev/null +++ b/television/dot-config/television/cable/tldr.toml @@ -0,0 +1,21 @@ +[metadata] +name = "tldr" +description = "Browse and preview TLDR help pages for command-line tools" +requirements = ["tldr"] + +[source] +command = "tldr --list" + +[preview] +command = "tldr '{0}' --color always" + +[ui] +layout = "portrait" + +[keybindings] +ctrl-e = "actions:open" + +[actions.open] +description = "Open the selected TLDR page" +command = "tldr '{0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/todo-comments.toml b/television/dot-config/television/cable/todo-comments.toml new file mode 100644 index 0000000..d87066c --- /dev/null +++ b/television/dot-config/television/cable/todo-comments.toml @@ -0,0 +1,25 @@ +[metadata] +name = "todo-comments" +description = "Find TODO, FIXME, HACK, and XXX comments in codebase" +requirements = ["rg", "bat"] + +[source] +command = "rg -n --color=always '(TODO|FIXME|HACK|XXX|BUG|WARN):?'" +ansi = true +output = "{strip_ansi|split:\\::..2}" + +[preview] +command = "bat -n --color=always --highlight-line '{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'" +env = { BAT_THEME = "ansi" } +offset = "{strip_ansi|split:\\::1}" + +[ui] +preview_panel = { header = "{strip_ansi|split:\\::..2}" } + +[keybindings] +enter = "actions:edit" + +[actions.edit] +description = "Open file in editor at the comment" +command = "${EDITOR:-vim} '+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'" +mode = "execute" diff --git a/television/dot-config/television/cable/unicode.toml b/television/dot-config/television/cable/unicode.toml new file mode 100644 index 0000000..c96a6cf --- /dev/null +++ b/television/dot-config/television/cable/unicode.toml @@ -0,0 +1,43 @@ +[metadata] +name = "unicode" +description = '''Search and insert unicode characters + +The UnicodeData.txt file is included by many packages. + +In addition to: + +Alpine Linux: unicode-character-database +Arch: unicode-character-database +Debian/Ubuntu: unicode-data +Fedora / RHEL / CentOS unicode-ucd +Gentoo: app-i18n/unicode-data +NixOS: unicode/unicode-data +openSUSE: unicode-ucd + +UnicodData.txt may also aleady be provided by: + +1) Many java packages +2) Latex packages +3) Still others + +It may in some cases be necessary to alter UNICODE_FILE below. + +''' +requirements = ["awk", "perl"] + +[source] +command = ''' +UNICODE_FILE="/usr/share/unicode/ucd/UnicodeData.txt" +awk -F';' ' + $2 !~ /^" if not specified) +prompt = ">" +# header = "{}" +# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0} +border_type = "rounded" # https://docs.rs/ratatui/latest/ratatui/widgets/block/enum.BorderType.html#variants + +[ui.status_bar] +# Status bar separators (bubble): +#separator_open = "" +#separator_close = "" +# Status bar separators (box): +separator_open = "" +separator_close = "" +hidden = false + +[ui.results_panel] +border_type = "rounded" +# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0} + +[ui.preview_panel] +# Preview panel size (percentage of screen width/height) +size = 50 +#header = "" +#footer = "" +scrollbar = true +border_type = "rounded" +# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0} +hidden = false + +[ui.help_panel] +# Whether to split the help panel by categories +show_categories = true +hidden = true + +[ui.remote_control] +# Whether to show channel descriptions in remote control mode +show_channel_descriptions = true +# Whether to sort channels alphabetically +sort_alphabetically = true +# disabled = false + +# Theme color overrides +# --------------------- +# You can override specific colors from the selected theme by adding them here. +# This allows you to customize the appearance without creating a full theme file. +# Colors can be specified as ANSI color names (e.g., "red", "bright-blue") or +# as hex values (e.g., "#ff0000", "#1e1e2e"). +# +# Example overrides: +# [ui.theme_overrides] +# background = "#000000" +# text_fg = "#ffffff" +# selection_bg = "#444444" +# match_fg = "#ff0000" + +# Keybindings and Events +# ---------------------------------------------------------------------------- +# +[keybindings] +# Application control +# ------------------ +esc = "quit" +ctrl-c = "quit" + +# Navigation and selection +# ----------------------- +down = "select_next_entry" +ctrl-n = "select_next_entry" +ctrl-j = "select_next_entry" +up = "select_prev_entry" +ctrl-p = "select_prev_entry" +ctrl-k = "select_prev_entry" + +# History navigation +# ----------------- +ctrl-up = "select_prev_history" +ctrl-down = "select_next_history" + +# Multi-selection +# -------------- +tab = "toggle_selection_down" +backtab = "toggle_selection_up" +enter = "confirm_selection" + +# Preview panel control +# -------------------- +pagedown = "scroll_preview_half_page_down" +pageup = "scroll_preview_half_page_up" +ctrl-f = "cycle_previews" + +# Data operations +# -------------- +ctrl-y = "copy_entry_to_clipboard" +ctrl-r = "reload_source" +ctrl-s = "cycle_sources" + +# UI Features +# ---------- +ctrl-t = "toggle_remote_control" +ctrl-x = "toggle_action_picker" +ctrl-o = "toggle_preview" +ctrl-h = "toggle_help" +f12 = "toggle_status_bar" +ctrl-l = "toggle_layout" + +# Input field actions +# ---------------------------------------- +backspace = "delete_prev_char" +ctrl-w = "delete_prev_word" +ctrl-u = "delete_line" +delete = "delete_next_char" +left = "go_to_prev_char" +right = "go_to_next_char" +home = "go_to_input_start" +ctrl-a = "go_to_input_start" +end = "go_to_input_end" +ctrl-e = "go_to_input_end" + +# Shell integration +# ---------------------------------------------------------------------------- +# +# The shell integration feature allows you to use television as a picker for +# your shell commands (as well as your shell history with ). +# E.g. typing `git checkout ` will open television with a list of +# branches to choose from. + +[shell_integration] +# This specifies the default fallback channel if no other channel is matched. +fallback_channel = "files" + +[shell_integration.channel_triggers] +# Add your channel triggers here. Each key is a channel that will be triggered +# by the corresponding commands. +# Example: say you want the following commands to trigger the following channels +# when pressing : +# `git checkout` should trigger the `git-branches` channel +# `ls` should trigger the `dirs` channel +# `cat` and `cp` should trigger the `files` channel +# +# You would add the following to your configuration file: +# ``` +# [shell_integration.channel_triggers] +# "git-branches" = ["git checkout"] +# "dirs" = ["ls"] +# "files" = ["cat", "cp"] +# ``` +"alias" = ["alias", "unalias"] +"env" = ["export", "unset"] +"dirs" = ["cd", "ls", "rmdir", "z"] +"files" = [ + "cat", + "less", + "head", + "tail", + "vim", + "nano", + "bat", + "cp", + "mv", + "rm", + "touch", + "chmod", + "chown", + "ln", + "tar", + "zip", + "unzip", + "gzip", + "gunzip", + "xz", +] +"git-diff" = ["git add", "git restore"] +"git-branch" = [ + "git checkout", + "git branch", + "git merge", + "git rebase", + "git pull", + "git push", +] +"git-log" = ["git log", "git show"] +"docker-images" = ["docker run"] +"git-repos" = ["nvim", "code", "hx", "git clone"] + + +[shell_integration.keybindings] +# controls which key binding should trigger tv +# for shell autocomplete +"smart_autocomplete" = "ctrl-t" +# controls which keybinding should trigger tv +# for command history +"command_history" = "ctrl-r"