✨ feat: fzf README preview with glow support
- Show README.md in the right 40% of the fzf picker on hover - Render with glow (CLICOLOR_FORCE=1 for colors in non-TTY pipe) when available, fall back to cat - Preview command uses sh -c for fish/zsh/bash compatibility - Bump version to 0.10.0 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
parent
8aa341080d
commit
d3380c668a
@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## [0.10.0] - 2026-03-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- fzf preview panel: hovering over a project shows its `README.md` in the right 40% of the screen
|
||||||
|
- Uses `glow` for rendered markdown when available, falls back to `cat`
|
||||||
|
- `CLICOLOR_FORCE=1` ensures glow outputs full ANSI colors even in fzf's non-TTY preview pipe
|
||||||
|
- Preview command runs via `sh -c '...' -- {}` for compatibility with fish, zsh, and bash
|
||||||
|
|
||||||
## [0.9.2] - 2026-03-04
|
## [0.9.2] - 2026-03-04
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -293,9 +293,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
|
checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
@ -570,18 +570,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.44"
|
version = "1.0.45"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "r-efi"
|
name = "r-efi"
|
||||||
version = "5.3.0"
|
version = "6.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
@ -809,7 +809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0"
|
checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastrand",
|
"fastrand",
|
||||||
"getrandom 0.4.1",
|
"getrandom 0.4.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix",
|
"rustix",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
@ -857,7 +857,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tmuxido"
|
name = "tmuxido"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1133,9 +1133,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.7.14"
|
version = "0.7.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tmuxido"
|
name = "tmuxido"
|
||||||
version = "0.9.2"
|
version = "0.10.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@ -17,7 +17,7 @@ A Rust-based tool to quickly find and open projects in tmux using fzf. No extern
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Search for git repositories in configurable paths
|
- Search for git repositories in configurable paths
|
||||||
- Interactive selection using fzf
|
- Interactive selection using fzf with live `README.md` preview (rendered via `glow` when available)
|
||||||
- Native tmux session creation (no tmuxinator required!)
|
- Native tmux session creation (no tmuxinator required!)
|
||||||
- Support for project-specific `.tmuxido.toml` configs
|
- Support for project-specific `.tmuxido.toml` configs
|
||||||
- Smart session switching (reuses existing sessions)
|
- Smart session switching (reuses existing sessions)
|
||||||
|
|||||||
26
src/main.rs
26
src/main.rs
@ -116,8 +116,34 @@ fn main() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn readme_preview_command() -> String {
|
||||||
|
let glow_available = Command::new("sh")
|
||||||
|
.args(["-c", "command -v glow"])
|
||||||
|
.output()
|
||||||
|
.map(|o| o.status.success())
|
||||||
|
.unwrap_or(false);
|
||||||
|
// CLICOLOR_FORCE=1 tells termenv (used by glow/glamour) to enable ANSI
|
||||||
|
// colors even when stdout is not a TTY (fzf preview runs in a pipe).
|
||||||
|
// Without it, glow falls back to bold-only "notty" style with no colors.
|
||||||
|
// Use `sh -c '...' -- {}` so the command runs in POSIX sh regardless of
|
||||||
|
// the user's $SHELL (fish, zsh, bash, etc.).
|
||||||
|
let viewer_cmd = if glow_available {
|
||||||
|
"CLICOLOR_FORCE=1 glow -s dark"
|
||||||
|
} else {
|
||||||
|
"cat"
|
||||||
|
};
|
||||||
|
format!(
|
||||||
|
r#"sh -c 'readme="$1/README.md"; [ -f "$readme" ] && {viewer_cmd} "$readme" || echo "No README.md"' -- {{}}"#
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn select_project_with_fzf(projects: &[PathBuf]) -> Result<PathBuf> {
|
fn select_project_with_fzf(projects: &[PathBuf]) -> Result<PathBuf> {
|
||||||
|
let preview_cmd = readme_preview_command();
|
||||||
let mut child = Command::new("fzf")
|
let mut child = Command::new("fzf")
|
||||||
|
.arg("--preview")
|
||||||
|
.arg(&preview_cmd)
|
||||||
|
.arg("--preview-window")
|
||||||
|
.arg("right:40%")
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user