hntui README

项目的 README,来自 github.com/ahmd-sh/hntui。合并为一个 markdown 文件:README.md。

hntui: Hacker News in your terminal!

A sleek and elegant tui for browsing one of the best tech news sources.

hntui — Hacker News in your terminal

curl -fsSL https://raw.githubusercontent.com/ahmd-sh/hntui/main/install.sh | sh
hntui

What it does

Requirements

Any modern terminal with truecolor, mouse support, and UTF-8 will work. I've tested it in Ghostty on MacOS. Linux/Windows is supported by OpenTUI but I haven't tried it (yet).

The prebuilt binaries have no dependencies. Installing through npm (or hacking on the code) needs Bun 1.2 or newer.

Install

curl -fsSL https://raw.githubusercontent.com/ahmd-sh/hntui/main/install.sh | sh

Installs a self-contained binary to ~/.local/bin. You can also grab a binary for your platform directly from the releases page. Binaries cover macOS (Apple Silicon) and Linux (x64, arm64) — on an Intel Mac, use the Bun install below.

With Bun

bun add -g @ahmd-sh/hntui

Or run it once without installing:

bunx @ahmd-sh/hntui

Run

hntui

Press q (or Ctrl-C) to quit.

Updating

hntui update

Checks the latest release and, for binary installs, replaces itself in place. Bun installs update with bun add -g @ahmd-sh/hntui instead (hntui update will tell you so). When a newer release exists, the status bar shows a quiet hint. hntui --version prints the installed version.

Keybindings

hntui speaks vim: j/k to move, gg/G to jump, Ctrl-D/Ctrl-U to scroll, J/K to hop between top-level comment threads, c to fold the thread you're reading, Esc/h to go back. Press ? in any view for the full list of shortcuts on that page.

Mouse

Most things you can do with the keyboard, you can do with a mouse too.

Selecting and copying text

Because the app captures mouse events, your terminal's normal click-and-drag selection is intercepted. To select text the regular way:

Themes

Press t to toggle. The dark theme is mostly black with orange accents. The light theme is faithful to news.ycombinator.com: white background, orange topbar, the familiar beige row highlight, and HN's classic grey byline text.

Saved posts

Press s on any story to save it. Saved posts get a small star next to the title and show up in the Saved tab on the right side of the tab strip. The list persists across sessions in ~/.config/hntui/saved.json as a small JSON file. (Config from the app's hackernuis days is migrated automatically on first run.) Press s again to remove a post from the list.

S jumps straight to the Saved list from anywhere.

Development

git clone https://github.com/ahmd-sh/hntui.git
cd hntui
bun install
bun dev    # hot reload

Data comes from the public Hacker News Firebase API.

Releases

Pushing a v* tag triggers two workflows:

To release a new version:

npm version patch   # or minor / major
git push --follow-tags

Acknowledgments

License

MIT, Copyright (c) 2026 Ahmed Shaikh.

hntui (ahmd-sh/hntui)

正在搜索数据库…

这是什么?hntui 是一个用来浏览 Hacker News 的终端界面:覆盖全部六个信息流(Top、New、Best、Ask、Show、Jobs),支持评论导航、收藏帖子、vim 键位和鼠标操作、主题,还有霹雳游侠(Knight Rider)风格的加载动画。
这是独立应用,还是我要导入的库?它是一个直接运行的独立终端应用,基于 OpenTUI 原生 TUI 框架构建,而不是供其他项目使用的库。
怎么安装和运行它?最简单的是独立二进制安装器,它会把自包含的二进制放到 ~/.local/bin;你也可以从 releases 页面获取适合你平台的二进制。或者,装了 Bun 的话可以免安装直接跑一次,也可以作为包来安装。
用它需要安装 Bun 吗?预构建的二进制完全没有任何依赖。只有当你通过 npm/Bun 安装,或者想改代码时,才需要 Bun 1.2 或更新版本。
它在 Intel Mac 或 Windows 上能用吗?预构建二进制只覆盖 macOS Apple Silicon 和 Linux(x64、arm64);在 Intel Mac 上你得改走 Bun 安装这条路。Windows 支持来自 OpenTUI,但作者还没测试过。
它支持哪些终端和平台?任何支持真彩色、鼠标和 UTF-8 的现代终端都可以;作者在 macOS 的 Ghostty 里做过测试,Linux/Windows 支持则来自 OpenTUI 框架。
我收藏的数据存在哪里?收藏的帖子持久保存在本地的小 JSON 文件 ~/.config/hntui/saved.json 里;除了从 HN 的公开 API 拉取数据,不会向任何地方发送任何东西。
怎么收藏帖子以后再看?在任何帖子上按 s 即可收藏(再按一次取消)。收藏的帖子会带一颗小星星,并出现在 Saved 标签页里,按 S 可以瞬间到达。
可以用鼠标代替 vim 键位吗?可以,几乎所有操作都能用鼠标完成:点标签切换信息流,点行选中或打开帖子,右键呼出上下文菜单,还能用滚轮滚动。
在终端里怎么选择并复制文本?由于 hntui 会捕获鼠标事件,普通的拖拽选择会被拦截。在 macOS 上,按住 Option 拖选后再 Cmd-C;在 Linux 上,按住 Shift 拖选后再 Ctrl-Shift-C。
Hacker News 的数据从哪里来?数据来自公开的 Hacker News Firebase API。
有哪些类似的项目?Horizon, opentui, Inquirer.js, tokscale, gh-dash, tincan-cli, wuzz, dsh-TUI
作者
ahmd-sh
大小
1.3 MB
星标
154
时长
6个月
提交 · 90 天