Skip to content
ttyzeroPublic

About

a TTYBUS side-panel TUI that shows file specific details.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

peek

A type-aware preview pane for ttybus.

Vim (or fzf, or yazi) publishes a path on files. peek shows what it is — size, mode, git, checksum, and a body that depends on the type: code with the current line marked, JSON keys, CSV sample, image dimensions, directory listing, hexdump.

╭ peek ●  main.go ──────────╮
│ line 12 · size 4.2k       │
│ mode -rw-r--r-- · 2h ago  │
│ lang go · 80 lines        │
│ git M +4 −1 · a5af5fe     │
│ sha256 9f2c1a0b3e11       │
│───────────────────────────│
│    10 func inspect() {    │
│ ▸  12     return peek     │
│    13 }                   │
│ e edit  j/k  q            │
╰───────────────────────────╯

e publishes path:line on the edit channel so the editor can jump. Same $TTYTHEME as gitwing and buscope. --borderless (or $TTYBORDERLESS=1) drops the rounded frame. Startup also reads ~/.config/ttyzero/theme (ttythemer writes it). All three listen on ttybus theme:

ttybus pub theme 'THEME nord'
ttybus pub theme 'THEME catppuccin BORDERS=0'
ttybus pub theme 'BORDERS=0'

Install

curl -fsSL https://raw.githubusercontent.com/ttyzero/peek/main/install.sh | sh

Whole kit after ttybus:

curl -fsSL https://raw.githubusercontent.com/ttyzero/ttybus/main/install-kit.sh | sh

Installs to ~/.local/bin. From source:

cd ~/code/peek && make build
./peek

Handlers

Built in: code, markdown, json, csv, image (metadata; Kitty raster is next), dir, binary.

Adding a type is one file and an interface — HANDLERS.md.

Actions

Defaults (override in ~/.config/peek/config.toml):

id key what
edit e PUB edit %p:%l
open o open / xdg-open for images, pdf, xlsx

See config.toml.example. Templates: %p path, %l line, %c col, %k kind.

nvim

Publish on BufEnter (already in gitwing’s snippet). Listen for peek’s edit action:

vim.fn.jobstart({ "ttybus", "sub", "edit" }, {
  on_stdout = function(_, data)
    for _, line in ipairs(data) do
      line = vim.trim(line)
      if line ~= "" then
        local path, lnum = line:match("^(.*):(%d+)$")
        if path then
          vim.schedule(function()
            vim.cmd.edit(vim.fn.fnameescape(path))
            pcall(vim.api.nvim_win_set_cursor, 0, { tonumber(lnum), 0 })
          end)
        end
      end
    end
  end,
})

About

a TTYBUS side-panel TUI that shows file specific details.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages