Initial commit: terminal file browser & markdown viewer

A beautiful TUI for browsing files and reading markdown/code:
- Two-pane layout with file tree and content viewer
- Markdown rendering via Glamour
- Syntax highlighting via Chroma
- Auto-detects light/dark terminal theme
- Arrow key navigation, Esc to go back
- Page Up/Down, Home/End for scrolling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Davies
2026-01-28 20:13:09 -05:00
commit 8f9c66ba46
12 changed files with 1658 additions and 0 deletions

70
keys.go Normal file
View File

@@ -0,0 +1,70 @@
package main
import "github.com/charmbracelet/bubbletea"
// Key represents a key binding
type Key struct {
Keys []string
Help string
}
func (k Key) Matches(msg tea.KeyMsg) bool {
for _, key := range k.Keys {
if msg.String() == key {
return true
}
}
return false
}
// Keybindings for the application
var (
keyUp = Key{
Keys: []string{"up"},
Help: "move up",
}
keyDown = Key{
Keys: []string{"down"},
Help: "move down",
}
keyLeft = Key{
Keys: []string{"left"},
Help: "collapse/parent",
}
keyRight = Key{
Keys: []string{"right"},
Help: "expand/open",
}
keyEnter = Key{
Keys: []string{"enter"},
Help: "open/toggle",
}
keyEscape = Key{
Keys: []string{"esc"},
Help: "back to files",
}
keyPageDown = Key{
Keys: []string{"pgdown"},
Help: "page down",
}
keyPageUp = Key{
Keys: []string{"pgup"},
Help: "page up",
}
keyHome = Key{
Keys: []string{"home"},
Help: "go to top",
}
keyEnd = Key{
Keys: []string{"end"},
Help: "go to bottom",
}
keyHelp = Key{
Keys: []string{"?"},
Help: "toggle help",
}
keyQuit = Key{
Keys: []string{"q", "ctrl+c"},
Help: "quit",
}
)