Television

repository·main·Indexed 27 days ago

https://github.com/alexpasmantier/television

A fast, portable, and hackable fuzzy finder for the terminal (tv) that enables real-time searching through files, git repositories, and environment variables. It features a powerful TOML-based custom channel system, a flexible template engine for data transformation, shell integration for Zsh and Bash, and plugins for Neovim, Vim, VSCode, Zed, and JetBrains IDEs.

Tokens
32.8K
Snippets
90
Records
210
Agent score
91%

What's inside television

  1. Overview of Television features

    main
    Television is a fast, portable, and hackable fuzzy finder designed for the terminal. It allows for real-time searching through various data sources using built-in 'channels' (e.g., finding files, searching git repositories, browsing environment variables) or custom-defined channels for any data source.
  2. Overview of available Television Channels

    main

    Television includes a wide variety of built-in channels for navigating different data sources and system components. Some notable channels include:

    • System & Shell: procs (manage running processes), sesh (session manager), ssh (ssh hosts), distrobox (manage containers), path (select PATH directories).
    • Development Tools: git (diff, log, reflog), gh (GitHub), kubernetes (deployments, pods, services), justfile (Justfile recipes), tldr (tldr pages), man (man pages).
    • Cloud & Infrastructure: aws (Buckets and Instances).
    • Package Managers: guix (Guix packages).
    • File System: files (includes goto_parent_dir action).
  3. Create a custom channel

    main

    To create a new channel, create a TOML file in your television cable directory (typically ~/.config/television/cable/). A minimal channel requires a [metadata] section with a name and a [source] section with a command.

    Example of a minimal channel file:

    [metadata]
    name = "my-awesome-channel"
    
    [source]
    command = "aws s3 ls my-bucket"
  4. Use default input editing keybindings

    main

    When editing input within Television, the following default keybindings are available:

    • Backspace: Delete the previous character
    • Ctrl + w: Delete the previous word
    • Ctrl + u: Delete the current line
    • Delete: Delete the next character
    • / : Move the cursor left / right
    • Home / End: Move to the start / end of input
    • Ctrl + a / e: Move to the start / end of input
  5. Extend Television with Custom Cable Channels

    main

    Television supports custom cable channels which can be used to define your own data sources.

    Key capabilities:

    • Overriding Builtins: Custom cable channels can be configured to override built-in channels.
    • Action Support: You can add support for exec actions within your channels.
    • Preview Integration: Use builtin previewers inside cable channel prototypes. You can also make previews optional for specific cable channels.
  6. Create custom channels with TOML

    main

    You can create custom channels for any workflow by defining a TOML file in ~/.config/television/cable/. A channel definition includes metadata, a source command, a preview command, and optional keybindings and actions.

    Example tldr.toml configuration:

    # ~/.config/television/cable/tldr.toml
    [metadata]
    name = "tldr"
    description = "Browse TLDR pages"
    
    [source]
    command = "tldr --list"
    
    [preview]
    command = "tldr '{}'"
    
    [keybindings]
    ctrl-e = "actions:open"
    
    [actions.open]
    command = "tldr '{}'"
    mode = "execute"
  7. Debug templates with --source-command and --preview-command

    main

    To debug complex templates, use the tv CLI flags to test your templates against controlled input.

    • --source-command: Provides the input string that the template will process.
    • --preview-command: Allows you to see how the template expands in a preview context.

    Example Debugging Command:

    tv --source-command "echo 'a:b:c'" --preview-command "echo 'Field 0: {split:\::0}, Field 1: {split:\::1}'"
  8. Browse system manual pages with man-pages channel

    main

    The man-pages channel lets you browse and preview system manual pages using apropos and man.

    Requirements: apropos, man

    Usage:

    • Use enter to open the selected man page in your system pager.
    [metadata]
    name = "man-pages"
    description = "Browse and preview system manual pages"
    requirements = [ "apropos", "man",]
    
    [source]
    command = "apropos ."
    
    [preview]
    command = "man '{0}'"
    
    [keybindings]
    enter = "actions:open"
    
    [ui]
    layout = "portrait"
    
    [preview.env]
    MANWIDTH = "80"
    
    [actions.open]
    description = "Open the selected man page in the system pager"
    command = "man '{0}'"
    mode = "execute"
    
    [ui.preview_panel]
    header = "{0}"
  9. Locate the television configuration file

    main

    Television uses a single configuration file in TOML format. The application looks for this file in the following locations depending on your platform:

    • Linux: $HOME/.config/television/config.toml
    • macOS: $HOME/.config/television/config.toml
    • Windows: %LocalAppData%\television\config\config.toml

    If $XDG_CONFIG_HOME is set, the application will look in $XDG_CONFIG_HOME/television/config.toml.

    You can override the default configuration path by setting the TELEVISION_CONFIG environment variable to the directory containing your config.toml (e.g., TELEVISION_CONFIG=/path/to/dir will cause the app to look for /path/to/dir/config.toml).