mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
docs(docs): add television documentation and update shell docs for TV integration
This commit is contained in:
1 parent
3c4af515fa
commit
7c786f9349
11 files changed
+198
-57
No files matched your search
+37
-14
@@ -3,13 +3,14 @@ title: bash and zsh
|
||||
description: Secondary shells that share fish's aliases, starship prompt, atuin history, and cd-style helper functions.
|
||||
---
|
||||
|
||||
bash and zsh are set up so a shell other than fish feels the same: the same aliases, the same starship prompt, atuin history, and ports of the fish helpers that have to change the shell's own directory. zsh also gets ports of the fish key bindings.
|
||||
bash and zsh are set up so a shell other than fish feels the same: the same aliases, the same starship prompt, atuin history, ports of the fish helpers that have to change the shell's own directory, and the same picker key bindings.
|
||||
|
||||
| Source (repo) | Target |
|
||||
| --- | --- |
|
||||
| `dot_bashrc` | `~/.bashrc` |
|
||||
| `dot_zshrc` | `~/.zshrc` |
|
||||
| `dot_config/zsh/keybinds.zsh` | `~/.config/zsh/keybinds.zsh` |
|
||||
| `dot_config/bash/keybinds.bash` | `~/.config/bash/keybinds.bash` |
|
||||
| `dot_config/shell/aliases.sh.tmpl` | `~/.config/shell/aliases.sh` (template) |
|
||||
| `dot_config/bash/functions/*.bash` | `~/.config/bash/functions/` |
|
||||
| `dot_config/zsh/functions/*.zsh` | `~/.config/zsh/functions/` |
|
||||
@@ -24,7 +25,7 @@ bash is part of the base system. zsh itself is not listed in `.chezmoidata/packa
|
||||
|
||||
Interactive shells only (`[[ $- != *i* ]] && return`). In order:
|
||||
|
||||
1. **PATH.** Prepends `~/.local/bin` if missing, sources `~/.cargo/env` if present, and appends `~/.maestro/bin` if it exists.
|
||||
1. **PATH.** Prepends `~/.local/bin` if missing, sources `~/.cargo/env` if present, and appends `~/.maestro/bin` if it exists. Exports `GHQ_ROOT` and `CODE_ROOT` as `~/Code`.
|
||||
2. **Go.** `GOPATH=~/.local/share/go`, `GOBIN=$GOPATH/bin`, and `GOBIN` prepended to `PATH`. mise provides `GOROOT`.
|
||||
3. **Android SDK.** `ANDROID_HOME` and `ANDROID_SDK_ROOT` set to `~/.local/share/android`. `platform-tools`, `cmdline-tools/latest/bin`, and `emulator` are appended if they exist.
|
||||
4. **Aliases.** Sources `~/.config/shell/aliases.sh`.
|
||||
@@ -32,38 +33,40 @@ Interactive shells only (`[[ $- != *i* ]] && return`). In order:
|
||||
6. **Flyline.** If `~/.local/lib/libflyline.so` exists, loads it with `enable -f … flyline` for richer line editing.
|
||||
7. Sources `~/.config/envman/load.sh` if it is non-empty.
|
||||
8. **Prompt.** `eval "$(starship init bash)"` if starship is installed.
|
||||
9. **atuin.** Sources `~/.atuin/bin/env`, then `eval "$(atuin init bash)"`.
|
||||
|
||||
bash has no custom key bindings. atuin's init binds <kbd>ctrl-r</kbd> and <kbd>up</kbd>.
|
||||
9. **television.** `eval "$(tv init bash)"` if `tv` is installed (the `_tv` completion), then sources `~/.config/bash/keybinds.bash`.
|
||||
10. **atuin.** Sources `~/.atuin/bin/env`, then `eval "$(atuin init bash)"`. atuin comes after tv, so it keeps <kbd>ctrl-r</kbd> and <kbd>up</kbd>.
|
||||
|
||||
## ~/.zshrc
|
||||
|
||||
1. **History.** `HISTFILE=~/.zsh_history`, `HISTSIZE=10000`, `SAVEHIST=10000`, `setopt SHARE_HISTORY HIST_IGNORE_DUPS`.
|
||||
2. **Completion.** `autoload -Uz compinit && compinit`.
|
||||
3. The same PATH, Go, and Android blocks as `.bashrc`.
|
||||
3. The same PATH, Go, and Android blocks as `.bashrc`, including `GHQ_ROOT` and `CODE_ROOT`.
|
||||
4. Sources `~/.config/shell/aliases.sh`.
|
||||
5. Sources every `~/.config/zsh/functions/*.zsh`.
|
||||
6. Sources `~/.config/zsh/keybinds.zsh`.
|
||||
7. `eval "$(suv init zsh)"` if suvadu is installed.
|
||||
8. Sources `~/.config/envman/load.sh` if it is non-empty.
|
||||
9. `eval "$(starship init zsh)"` if starship is installed.
|
||||
10. **Syntax highlighting.** Sources the first `zsh-syntax-highlighting.zsh` found in `/usr/share/zsh/plugins/zsh-syntax-highlighting/`, `/opt/homebrew/share/zsh-syntax-highlighting/`, or `/usr/local/share/zsh-syntax-highlighting/`. The comment says this must stay last, because it wraps every zle widget defined before it.
|
||||
11. **atuin.** Sources `~/.atuin/bin/env` and runs `eval "$(atuin init zsh)"`. These lines come after the syntax-highlighting block, so despite the comment, syntax highlighting is not actually last.
|
||||
10. `eval "$(tv init zsh)"` if `tv` is installed (<kbd>ctrl-t</kbd> smart autocomplete).
|
||||
11. **Syntax highlighting.** Sources the first `zsh-syntax-highlighting.zsh` found in `/usr/share/zsh/plugins/zsh-syntax-highlighting/`, `/opt/homebrew/share/zsh-syntax-highlighting/`, or `/usr/local/share/zsh-syntax-highlighting/`. The comment says this must stay last, because it wraps every zle widget defined before it.
|
||||
12. **atuin.** Sources `~/.atuin/bin/env` and runs `eval "$(atuin init zsh)"`. These lines come after the syntax-highlighting block, so despite the comment, syntax highlighting is not actually last. atuin loads after tv, so it keeps <kbd>ctrl-r</kbd>.
|
||||
|
||||
## zsh key bindings
|
||||
|
||||
`keybinds.zsh` ports `fish_user_key_bindings.fish` to zle. Unlike fish, zsh uses the **emacs** keymap: `bindkey -e` pins it so that `$EDITOR=nvim` does not switch zsh into vi mode. `unsetopt flow_control` frees <kbd>ctrl-q</kbd> and <kbd>ctrl-s</kbd> from the terminal.
|
||||
|
||||
A generic widget `_zle-run` is registered as `run-<cmd>` for `purple`, `clip-last`, `gho`, `pj`, `omp`, `yy`, and `lazygit`. It clears the pending display (`zle -I`), runs the command with the tty on stdin, then `zle reset-prompt`. Widgets run in the shell process, so directory changes made by `gho` and `yy` persist.
|
||||
A generic widget `_zle-run` is registered as `run-<cmd>` for `purple`, `clip-last`, `gho`, `pj`, `omp`, `yy`, and `lazygit`. It clears the pending display (`zle -I`), runs the command with the tty on stdin, then `zle reset-prompt`. Widgets run in the shell process, so directory changes made by `gho` and `yy` persist. `tv-git-files` runs `tv git-files` the same way, and `pj-down` handles <kbd>down</kbd>.
|
||||
|
||||
| Key | Action |
|
||||
| --- | --- |
|
||||
| <kbd>ctrl-e</kbd> | `yy` (yazi, cd to its exit dir) |
|
||||
| <kbd>ctrl-e</kbd> | `tv git-files` (pick a file, open it in nvim) |
|
||||
| <kbd>ctrl-f</kbd> | `yy` |
|
||||
| <kbd>ctrl-b</kbd> | `purple` (an external command; this repo does not provide it) |
|
||||
| <kbd>ctrl-y</kbd> | `clip-last` |
|
||||
| <kbd>ctrl-o</kbd> | `gho` (repo or vault picker, cd) |
|
||||
| <kbd>ctrl-p</kbd> | `pj` (task runner) |
|
||||
| <kbd>ctrl-o</kbd> | `gho` (`ghq-repos` cable, cd) |
|
||||
| <kbd>ctrl-p</kbd> | `pj` (`pj` cable) |
|
||||
| <kbd>ctrl-t</kbd> | tv smart autocomplete (from `tv init zsh`) |
|
||||
| <kbd>down</kbd> | `pj-down`: `PJ_QUIET=1 pj` on an empty prompt, otherwise `down-line-or-history` (bound to `^[[B` and `^[OB`) |
|
||||
| <kbd>ctrl-a</kbd> | `omp` |
|
||||
| <kbd>ctrl-g</kbd> | `lazygit` |
|
||||
| <kbd>ctrl-q</kbd> | `exit` |
|
||||
@@ -71,7 +74,27 @@ A generic widget `_zle-run` is registered as `run-<cmd>` for `purple`, `clip-las
|
||||
|
||||
<kbd>ctrl-c</kbd> is the tty interrupt character, so `bindkey '^C'` would never fire. The binding is a `TRAPINT` function instead. At the prompt it runs `zle .kill-buffer`, prints the clear sequence, and runs `zle .reset-prompt`. While a command is running, SIGINT keeps its normal behavior (returns `128+SIGINT`).
|
||||
|
||||
The fish-only binds <kbd>ctrl-w</kbd> (atuin AI), <kbd>down</kbd> (`pj`), and <kbd>?</kbd> have no zsh equivalent. <kbd>ctrl-h/j/k/l</kbd> belong to kitty ([kitty](/terminal/kitty)) and are not bound here.
|
||||
The fish-only binds <kbd>ctrl-w</kbd> (atuin AI) and <kbd>?</kbd> have no zsh equivalent. <kbd>ctrl-h/j/k/l</kbd> belong to kitty ([kitty](/terminal/kitty)) and are not bound here. The cables are described on the [television](/tools/television) page.
|
||||
|
||||
## bash key bindings
|
||||
|
||||
`keybinds.bash` gives bash the same picker keys as fish and zsh. bash keeps readline's default emacs keymap.
|
||||
|
||||
| Key | Action |
|
||||
| --- | --- |
|
||||
| <kbd>ctrl-o</kbd> | `gho` (`ghq-repos` cable, cd) |
|
||||
| <kbd>ctrl-e</kbd> | `tv git-files` |
|
||||
| <kbd>ctrl-p</kbd> | `pj` (`pj` cable) |
|
||||
| <kbd>down</kbd> | `pj` cable on an empty prompt (`PJ_QUIET=1`), otherwise `history-search-forward` |
|
||||
| <kbd>ctrl-t</kbd> | `_kb_tv_autocomplete`: runs `tv --autocomplete-prompt` on the text left of the cursor and inserts the picks there, each `printf %q`-quoted |
|
||||
|
||||
Each picker key is a readline macro `\C-xN \C-m \C-x0` built by `_kb_bind KEY SLOT COMMAND…`:
|
||||
|
||||
1. `\C-xN` is a `bind -x` for `_kb_run`, which stashes `READLINE_LINE` and runs the command in the shell process, so the `cd` done by `gho` persists.
|
||||
2. `\C-m` accepts the now-empty line, so bash prints a fresh prompt for the new cwd. Nothing reaches history.
|
||||
3. `\C-x0` runs `_kb_restore`, which puts the typed text back.
|
||||
|
||||
<kbd>down</kbd> (`\e[B` and `\eOB`) is the macro `\C-x4\C-x5`. `bind -x` cannot call readline functions, so `_kb_down` (`\C-x4`) rebinds `\C-x5` to `history-search-forward` when the line is non-empty, or runs `pj` and rebinds `\C-x5` to `redraw-current-line`. The slots used are `\C-x0` through `\C-x5`.
|
||||
|
||||
## Shared aliases: aliases.sh
|
||||
|
||||
@@ -118,7 +141,7 @@ Each directory holds one function per file. bash and zsh source every file at st
|
||||
| `clip-last` | Re-runs the previous history entry (`fc -ln -1 -1`, skipping itself if the line editor already recorded `clip-last`), pipes the output to `wl-copy` or `pbcopy`, and sends a `notify-send -a shell` notification if available |
|
||||
| `ghg <repo>` | `ghg-clone "$@"`, cd into the printed path, `clear && onefetch` |
|
||||
| `ghn <name>` | `command ghn "$@"`, cd into the printed path |
|
||||
| `gho` | `command gho`, cd into the printed path, `clear`, and `onefetch` if it is a git repo |
|
||||
| `gho` | `dir=$(tv ghq-repos)`, return if empty, cd into it, `clear`, and `onefetch` if it is a git repo |
|
||||
| `yy [args]` | `yazi --cwd-file=<tmp>`, then cd to the directory written there if it changed |
|
||||
|
||||
The `ghg` helper script is named `ghg-clone` because an unrelated cargo binary already uses the name `ghg`. The [Scripts](/shell/scripts#why-some-helpers-are-shell-functions) page explains why these helpers are shell functions and not scripts.
|
||||
+9
-7
@@ -179,16 +179,16 @@ The header comment says the file should stay empty, but it holds the following:
|
||||
|
||||
| Key | Action |
|
||||
| --- | --- |
|
||||
| <kbd>ctrl-e</kbd> | `yy`: yazi, then cd to the directory yazi exited in |
|
||||
| <kbd>ctrl-f</kbd> | `yy` (same as <kbd>ctrl-e</kbd>) |
|
||||
| <kbd>ctrl-e</kbd> | `tv git-files`, then repaint: pick a file in the repo and open it in nvim ([television](/tools/television#git-files)) |
|
||||
| <kbd>ctrl-f</kbd> | `yy`: yazi, then cd to the directory yazi exited in |
|
||||
| <kbd>ctrl-b</kbd> | `purple`, then repaint (an external command; this repo does not provide it) |
|
||||
| <kbd>ctrl-y</kbd> | `clip-last`: re-run the last command and copy its output |
|
||||
| <kbd>ctrl-o</kbd> | `gho`: pick a ghq repo or Obsidian vault and cd into it |
|
||||
| <kbd>ctrl-p</kbd> | `pj`: fzf task runner ([Scripts](/shell/scripts#pj)) |
|
||||
| <kbd>ctrl-o</kbd> | `gho`: pick a ghq repo or Obsidian vault from the `ghq-repos` cable and cd into it |
|
||||
| <kbd>ctrl-p</kbd> | `pj`: task runner on the `pj` cable ([Scripts](/shell/scripts#pj)) |
|
||||
| <kbd>ctrl-a</kbd> | `omp` (the coding agent, see [AI agents](/ai)) |
|
||||
| <kbd>ctrl-w</kbd> | `atuin ai inline`: natural-language command overlay |
|
||||
| <kbd>ctrl-g</kbd> | `lazygit` |
|
||||
| <kbd>down</kbd> | `_pj_bind_down`: runs `pj` on an idle, empty prompt, otherwise fish's `down-or-search` |
|
||||
| <kbd>down</kbd> | `_pj_bind_down`: opens the `pj` cable on an idle, empty prompt, otherwise fish's `down-or-search` |
|
||||
| <kbd>ctrl-c</kbd> | Clears the command line, runs `clear` (screen and kitty scrollback), repaints |
|
||||
| <kbd>ctrl-q</kbd> | `exit` |
|
||||
|
||||
@@ -203,6 +203,8 @@ Bindings added by tool init scripts:
|
||||
|
||||
`_pj_bind_down` hands the key to `down-or-search` when the buffer is non-empty, the completion pager is open, or history search is active. Otherwise it runs `PJ_QUIET=1 pj`, so pressing down outside a project does nothing and prints no error.
|
||||
|
||||
zsh and bash bind <kbd>ctrl-o</kbd>, <kbd>ctrl-e</kbd>, <kbd>ctrl-p</kbd>, <kbd>down</kbd>, and <kbd>ctrl-t</kbd> the same way ([bash and zsh](/shell/bash-zsh)). Inside television, <kbd>ctrl-e</kbd> runs the channel's `edit` action and <kbd>ctrl-h</kbd> its `goto_parent_dir` action (`television/config.toml`). The config and cables are on the [television](/tools/television) page.
|
||||
|
||||
:::note
|
||||
Under kitty, <kbd>ctrl-g</kbd> (lazygit overlay), <kbd>ctrl-a</kbd> (omp split), <kbd>ctrl-y</kbd> (yazi split), and <kbd>ctrl-h/j/k/l</kbd> (split navigation) are mapped in `kitty.conf` and never reach fish. The fish binds for those keys only apply in other terminals. See [kitty](/terminal/kitty).
|
||||
:::
|
||||
@@ -253,7 +255,7 @@ Every file in `functions/` is autoloaded by name. Several also exist as POSIX sc
|
||||
| `_nvm_list` | nvm.fish internal: lists installed Node versions plus `system` |
|
||||
| `_nvm_version_activate` | nvm.fish internal: sets `nvm_current_version` and prepends its `bin` to `PATH` |
|
||||
| `_nvm_version_deactivate` | nvm.fish internal: removes a version's `bin` from `PATH` |
|
||||
| `_pj_bind_down` | Down-arrow handler: `pj` on an empty idle prompt, else `down-or-search` |
|
||||
| `_pj_bind_down` | Down-arrow handler: `pj` (tv cable) on an empty idle prompt, else `down-or-search` |
|
||||
| `ai` | `gum choose` among `claude`, `opencode`, `codex`, `hermes`, `fractal`. `claude` runs with `--dangerously-skip-permissions` |
|
||||
| `c` | `clear` with no argument, `cd <dir>` with one |
|
||||
| `c2p` | fzf-pick a `.hbs` template under `~/.config/code2prompt` and run `code2prompt --template` |
|
||||
@@ -270,7 +272,7 @@ Every file in `functions/` is autoloaded by name. Several also exist as POSIX sc
|
||||
| `gh-sonr-org-migrate` | Script body (see the warning below) that moves every repo from `*sonr*` GitHub orgs into `sonr-io` and deletes the emptied orgs |
|
||||
| `ghg <repo>` | `ghg-clone <repo>` (ghq get), cd into the clone, `clear`, `onefetch` |
|
||||
| `ghn <name>` | Runs `~/.local/bin/ghn` to create and clone a private repo, then cds into it |
|
||||
| `gho` | Runs `~/.local/bin/gho` (repo/vault picker), cds into the result, `clear`, and `onefetch` inside git repos |
|
||||
| `gho` | `tv ghq-repos` (repo/vault picker); returns if nothing was picked, else cds into the result, `clear`, and `onefetch` inside git repos |
|
||||
| `git-summary [flags]` | `code2prompt` over the repo root, including only `AGENTS.md` files, using `~/.config/code2prompt/agents-md.hbs`. Extra flags pass through |
|
||||
| `gtm [repo]` | Migrates GitHub repos to a prad.codes (Gitea) org with `tea repos migrate`. With no argument, fzf multi-selects from `gh repo list`. You pick the target org and migration options (wiki, issues, labels, pull-requests, releases, milestones, lfs, mirror) with gum, private repos stay private, and it offers to clone the results with `ghg-clone`. Fish only |
|
||||
| `launch_omp_livediff_overlay` | Uses `kitty @` to overlay `omp` on the current window with a `livediff` vsplit beside it. Needs `KITTY_LISTEN_ON` |
|
||||
|
||||
@@ -10,9 +10,9 @@ fish is the main interactive shell. bash and zsh are set up to feel the same: th
|
||||
| Page | Covers |
|
||||
| --- | --- |
|
||||
| [fish](/shell/fish) | `~/.config/fish`: `config.fish`, every `conf.d/` file (PATH, env, aliases, ssh-agent, tool init, secrets by name), vi-mode key bindings, the cyberdream theme, completions, the nvm.fish plugin, and every function in `functions/` |
|
||||
| [bash and zsh](/shell/bash-zsh) | `~/.bashrc`, `~/.zshrc`, zsh key bindings, `~/.config/shell/aliases.sh`, per-shell function ports |
|
||||
| [bash and zsh](/shell/bash-zsh) | `~/.bashrc`, `~/.zshrc`, zsh and bash key bindings, `~/.config/shell/aliases.sh`, per-shell function ports |
|
||||
| [Aliases](/shell/aliases) | Every alias from `.chezmoidata/aliases.yaml` plus the fish-only and shell-specific ones |
|
||||
| [Scripts](/shell/scripts) | Every general-purpose executable in `~/.local/bin` (`pj`, `gho`, `ghn`, `gop`, `atuin-pick`, …) |
|
||||
| [Scripts](/shell/scripts) | Every general-purpose executable in `~/.local/bin` (`pj`, `ghn`, `gop`, `mtime-sort`, `atuin-pick`, …) |
|
||||
| [Starship](/shell/starship) | `~/.config/starship.toml`: format, modules, symbols, cyberdream palette |
|
||||
| [atuin](/shell/atuin) | `~/.config/atuin`: history search settings, AI inline integration, cyberdream theme |
|
||||
|
||||
|
||||
+31
-28
@@ -19,10 +19,10 @@ A script runs as a child process, and a child cannot change its parent shell's w
|
||||
| `yy` (and fish's `y`) | cds into the directory yazi exited in |
|
||||
| `c` | cds when given an argument |
|
||||
| `cd` | Replaces the `cd` builtin with a zoxide fallback |
|
||||
| `ghg`, `ghn`, `gho` | cd into a repo that the script picked or cloned |
|
||||
| `ghg`, `ghn`, `gho` | cd into a repo that was picked or cloned |
|
||||
| `clip-last` | Reads the shell's own history (`$history[1]` in fish, `fc` in bash/zsh) |
|
||||
|
||||
For `ghg`, `ghn`, and `gho`, the work lives in a script that prints a directory on stdout (and everything else on stderr). The shell function captures that path and cds into it. `ghg`'s script is named `ghg-clone` because an unrelated cargo binary already uses the name `ghg`.
|
||||
For `ghg` and `ghn`, the work lives in a script that prints a directory on stdout (and everything else on stderr). The shell function captures that path and cds into it. `ghg`'s script is named `ghg-clone` because an unrelated cargo binary already uses the name `ghg`. `gho` has no script: the function reads the path from `tv ghq-repos` ([television](/tools/television#ghq-repos)).
|
||||
|
||||
Several scripts below also exist as fish functions of the same name (`ai`, `c2p`, `extract_agents`, `fab`, `gdc`, `git-summary`, `lc-elir`, `mdcp`, `mdp`, `launch_omp_livediff_overlay`, `gh-sonr-org-migrate`). In fish the function runs instead of the script. Both versions behave the same. See [fish functions](/shell/fish#functions).
|
||||
|
||||
@@ -39,14 +39,14 @@ Several scripts below also exist as fish functions of the same name (`ai`, `c2p`
|
||||
| [`gh-sonr-org-migrate`](#gh-sonr-org-migrate) | bash | Consolidate `*sonr*` GitHub orgs into `sonr-io` |
|
||||
| [`ghg-clone`](#ghg-clone) | sh | `ghq get` and print the clone path |
|
||||
| [`ghn`](#ghn) | sh | Create a private repo, clone it, print the path |
|
||||
| [`gho`](#gho) | sh | Pick a ghq repo or Obsidian vault, print the path |
|
||||
| [`git-summary`](#git-summary) | sh | Aggregate a repo's `AGENTS.md` files with code2prompt |
|
||||
| [`gop`](#gop) | sh | Open the current repo's web page |
|
||||
| [`launch_omp_livediff_overlay`](#launch_omp_livediff_overlay) | sh | omp overlay plus a livediff split in kitty |
|
||||
| [`lc-elir`](#lc-elir) | sh | Run `/leetcode-eli5` via omp on picked solutions |
|
||||
| [`mdcp`](#mdcp) | sh | Fetch a URL as Markdown, copy it, preview it |
|
||||
| [`mdp`](#mdp) | sh | fzf Markdown picker with mdfried preview |
|
||||
| [`pj`](#pj) | bash | fzf task runner across every project task source |
|
||||
| [`mtime-sort`](#mtime-sort) | sh + perl | Sort path lines newest-first by mtime |
|
||||
| [`pj`](#pj) | bash | Task runner across every project task source, on a tv cable |
|
||||
| [`yazi-nvim-open`](#yazi-nvim-open) | sh | yazi opener that targets the host Neovim |
|
||||
|
||||
## ai
|
||||
@@ -148,7 +148,7 @@ Accepts `https://…`, `ssh://…`, `git@host:user/repo`, `host/user/repo`, or `
|
||||
|
||||
**Used by:** the `ghg` shell function, which cds into the path, clears the screen, and runs `onefetch`. The fish function `gtm` also uses it to clone migrated repos.
|
||||
|
||||
**Needs:** `ghq` (`GHQ_ROOT=~/Code` in fish), optional `zoxide`.
|
||||
**Needs:** `ghq` (`GHQ_ROOT=~/Code`, exported by fish, zsh, and bash), optional `zoxide`.
|
||||
|
||||
## ghn
|
||||
|
||||
@@ -165,23 +165,6 @@ You pick the host with `gum choose`. The script prints the clone directory, and
|
||||
|
||||
**Needs:** `gum`, `ghq`, and `tea` or `gh`.
|
||||
|
||||
## gho
|
||||
|
||||
```sh
|
||||
gho
|
||||
```
|
||||
|
||||
An fzf picker with two lists. <kbd>tab</kbd> switches between them:
|
||||
|
||||
- `repo:`: `ghq list` plus the chezmoi source tree, listed as `github.com/prdlk/dotfiles` and mapped back to `~/.local/share/chezmoi`. `--tiebreak=end` favors matches at the end of the name.
|
||||
- `vault:`: the Obsidian vaults `~/Documents/Obsidian/Personal`, `Walletbase`, and `Research`.
|
||||
|
||||
It prints the chosen directory. fzf's bind snippets run under `SHELL=/bin/sh`, so they behave the same whatever the login shell. The `gho` shell function cds into the result, clears the screen, and runs `onefetch` in git repos.
|
||||
|
||||
**Launched by:** <kbd>ctrl-o</kbd> in fish and zsh.
|
||||
|
||||
**Needs:** `ghq`, `fzf`, `onefetch` (for the wrapper).
|
||||
|
||||
## git-summary
|
||||
|
||||
```sh
|
||||
@@ -245,13 +228,25 @@ Lists `*.md` files up to 3 directories deep with `fd`. fzf shows an `mdfried` pr
|
||||
|
||||
**Needs:** `fd`, `fzf`, `mdfried`.
|
||||
|
||||
## mtime-sort
|
||||
|
||||
```sh
|
||||
… | mtime-sort [--repo]
|
||||
```
|
||||
|
||||
Reads lines on stdin and prints them newest-first by the mtime of each line's last tab-separated field (the whole line when it has no tab). With `--repo`, it stats `<path>/.git/index` first, so a repo sorts by its last git activity. Lines whose path does not exist are dropped. Ties keep input order.
|
||||
|
||||
**Used by:** every custom [television](/tools/television) cable and `pj --list`. tv layers match quality and frecency on top of this order.
|
||||
|
||||
**Needs:** `perl`.
|
||||
|
||||
## pj
|
||||
|
||||
```sh
|
||||
pj [extra args…]
|
||||
```
|
||||
|
||||
A task runner that searches every task source in the project and lets you pick one with fzf.
|
||||
A task runner that searches every task source in the project and lets you pick one in the `pj` [television](/tools/television#pj) cable.
|
||||
|
||||
**Sources.** Each is listed only when its runner is installed:
|
||||
|
||||
@@ -271,15 +266,23 @@ A task runner that searches every task source in the project and lets you pick o
|
||||
|
||||
**Scanning.** Walks from `$PWD` up to the git toplevel, inclusive. Outside a repo it stops at the first directory that produced tasks.
|
||||
|
||||
**Picker.** Rows are tagged with the tool (`npm`, `pnpm`, `bun`, `make`, `just`, `mise`, `poe`, `py`, …), so typing a tool name filters to it. A directory column appears when more than one project contributed tasks. The header shows the nearest project root. The preview (top, 6 lines) shows the task body: the npm script string, the Make recipe, `just --show`, `mise tasks info`, the devbox script, or the pyproject entry.
|
||||
**Picker.** `pj` writes the records to a temp file and runs `tv pj --source-command "cat <tmp>" --input-header <project root>`. Rows are tagged with the tool (`npm`, `pnpm`, `bun`, `make`, `just`, `mise`, `poe`, `py`, …), so typing a tool name filters to it. A directory column appears when more than one project contributed tasks. Tasks are sorted by their manifest's mtime, newest first, through `mtime-sort`. The preview shows the task body: the npm script string, the Make recipe, `just --show`, `mise tasks info`, the devbox script, or the pyproject entry.
|
||||
|
||||
**Run.** cds into the task's directory and `exec`s the runner. Extra arguments are forwarded, with `--` inserted for `npm run`, `mise`, and `devbox`. Tasks named `dev`, `start`, `serve`, `watch`, or namespaced variants like `dev:web` are wrapped in `openlogs` (found on `PATH`, via `mise which`, or in mise's node installs) for a live log tail. Without openlogs they run unwrapped, with a note.
|
||||
**Entry points.** The cable calls back into the script:
|
||||
|
||||
**Env.** `PJ_QUIET=1` suppresses the "no task sources found" error. The fish <kbd>down</kbd> binding uses it.
|
||||
| Command | Does |
|
||||
| --- | --- |
|
||||
| `pj --list` | Prints tab-separated records: display, kind, target, root, runner, manifest |
|
||||
| `pj --preview KIND TARGET ROOT FILE` | Prints the task body for the preview pane |
|
||||
| `pj --run KIND TARGET ROOT RUNNER` | Runs the task (enter) |
|
||||
|
||||
**Launched by:** <kbd>ctrl-p</kbd> in fish and zsh, and <kbd>down</kbd> on an empty fish prompt.
|
||||
**Run.** cds into the task's directory and `exec`s the runner. Extra arguments given to `pj` travel to the task through `$PJ_EXTRA` (shell-quoted), with `--` inserted for `npm run`, `mise`, and `devbox`. Tasks named `dev`, `start`, `serve`, `watch`, or namespaced variants like `dev:web` are wrapped in `openlogs` (found on `PATH`, via `mise which`, or in mise's node installs) for a live log tail. Without openlogs they run unwrapped, with a note.
|
||||
|
||||
**Needs:** `bash`, `fzf`, `jq`, `python3` 3.11+ (for `tomllib`), plus whichever runners the project uses.
|
||||
**Env.** `PJ_QUIET=1` suppresses the "no task sources found" error (exit status stays 1). The <kbd>down</kbd> bindings use it.
|
||||
|
||||
**Launched by:** <kbd>ctrl-p</kbd>, and <kbd>down</kbd> on an empty prompt, in fish, zsh, and bash.
|
||||
|
||||
**Needs:** `bash`, `tv`, `mtime-sort`, `jq`, `python3` 3.11+ (for `tomllib`), plus whichever runners the project uses.
|
||||
|
||||
## yazi-nvim-open
|
||||
|
||||
|
||||
Reference in new issue
Block a user