一款面向工程师的、快速且基于键盘操作的终端文本编辑器。
Txt: A fast, keyboard-driven terminal text editor for engineers

原始链接: https://txt.hellman.io/

**txt** 是一款基于终端的快速文本编辑器,专为追求无阻碍操作体验、且不希望处理复杂模式系统或繁琐插件配置的工程师而设计。它以直观易用为核心,让用户在终端内即可获得如同图形界面(GUI)编辑器般的高效体验。 **主要特性:** * **性能与易用性:** 启动即开即用,键位绑定符合直觉,采用无需切换模式的界面设计。 * **代码智能:** 内置基于 tree-sitter 的语法高亮、支持抽象语法树(AST)的选区操作、代码折叠及粘性作用域标题栏。 * **开发工具:** 原生支持语言服务器协议(LSP)、模糊搜索文件/符号、多光标编辑以及强大的 Git 集成。 * **高度定制:** 支持键盘宏、代码片段、自定义键位绑定(预设 VS Code/IntelliJ 方案)以及 `.editorconfig` 配置。 * **通用性:** 配备文件侧边栏,支持鼠标操作,并可监控文件系统的外部更改。 **txt** 的初衷并非取代您的主力 IDE,而是作为一款高性能工具,协助您在终端内快速、高效地完成编辑任务。它目前已在 macOS、Linux 和 Windows 上发布,可通过 Homebrew、Shell 脚本或二进制文件下载安装。如需获取完整文档及安装详情,请访问 GitHub 上的项目页面。

Hacker News | 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 | 登录 Txt:一款专为工程师打造的快速、键盘驱动型终端文本编辑器 (hellman.io) 9 分,由 jlundberg 发布于 2 小时前 | 隐藏 | 过往 | 收藏 | 3 条评论 SrslyJosh 3 分钟前 | 下一条 [-] 提示:Claude 已提交至该仓库。 reply_ix 5 分钟前 | 上一条 | 下一条 [-] 虽然他们强调了键盘驱动的功能,但在演示动图中展示的却是鼠标驱动的工作流。挺耐人寻味的选择,不是吗? WesolyKubeczek 11 分钟前 | 上一条 [-] 鉴于 https://github.com/micro-editor/MICRO 已经存在好几年了,如果能有一个对比会更好。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请加入 YC | 联系我们 搜索:
相关文章

原文

A fast, keyboard-driven terminal text editor for engineers.

Install

Homebrew (macOS and Linux)

brew tap ErikHellman/tap
brew install txt

Update later with brew upgrade txt.

macOS and Linux (curl)

curl -fsSL https://raw.githubusercontent.com/ErikHellman/txt/main/install.sh | sh

Installs the latest release binary to ~/.local/bin. Make sure that directory is on your PATH. Re-run the same command to update.

Windows

irm https://raw.githubusercontent.com/ErikHellman/txt/main/install.ps1 | iex

Installs to %LOCALAPPDATA%\txt and adds it to your PATH automatically.

Build from source

Requires Rust 1.88 or newer.

git clone https://github.com/ErikHellman/txt.git
cd txt
cargo build --release

The binary will be at ./target/release/txt. Copy it anywhere on your PATH.

Usage

Open a file or a directory:

Opening a directory brings up the file sidebar automatically. Press F1 at any time to see the full list of key bindings.

Key bindings

Key Action
Ctrl+S Save file
Ctrl+Q Quit
Ctrl+P Fuzzy file picker
Ctrl+Shift+O Symbols in current file
Ctrl+Shift+P Command palette
Ctrl+F Find
Ctrl+H Find & replace
Ctrl+W Expand selection to enclosing AST node
Ctrl+Shift+W Shrink selection
Ctrl+Shift+[ Toggle code fold at cursor
Alt+Shift+Up/Down Add cursor above / below
Alt+M Jump to matching bracket
Alt+L Center the viewport on the cursor
Alt+Left / Alt+Right Walk the jump list
Ctrl+Z Undo
Ctrl+Y / Ctrl+Shift+Z Redo
Ctrl+Shift+G Git operations dialog
Ctrl+L Configure LSP server
Ctrl+, Open settings
F1 Show all key bindings

The default txt keymap is shown above. VS Code and IntelliJ IDEA presets are available from the settings UI (Ctrl+,), and a ~/.config/txt/keybindings.toml overrides individual bindings.

Configuring LSP servers

LSP is per-workspace and opt-in. The fastest way to get started is the LSP picker (Ctrl+L, or Configure LSP server in the command palette): pick a language and txt writes the selection to <workspace>/.txt/lsp.toml for you. Install the server binary from upstream first — txt does not download language servers — and the first time the binary is launched you will be asked to approve it. The SHA-256 of approved binaries is cached in ~/.config/txt/trusted_binaries.json; changed binaries re-prompt.

Built-in server presets

The picker ships with presets for the following servers — click through to the upstream project for installation instructions:

C/C++ (clangd), Python (pyright), Lua (lua-language-server), and Zig (zls) are also in the picker.

Editing lsp.toml directly

For anything beyond the defaults — passing extra flags, pointing at a custom binary, or providing initializationOptions — edit <workspace>/.txt/lsp.toml:

enabled = true
server  = "rust-analyzer"

# Plain server with no extra arguments.
[servers.rust-analyzer]
command = "rust-analyzer"

# Pass extra arguments via the `args` array.
[servers.gopls]
command = "gopls"
args    = ["serve", "-rpc.trace"]

# Use a custom binary path and forward an initializationOptions JSON
# payload during the LSP handshake.
[servers.pyright]
command      = "/opt/homebrew/bin/pyright-langserver"
args         = ["--stdio"]
init_options = { pythonPath = "/usr/bin/python3" }

# Multiple servers can live side-by-side; the `server` key at the top
# of the file selects which one is active.
[servers.typescript-language-server]
command = "typescript-language-server"
args    = ["--stdio"]

The fields are:

  • enabled — master switch. When false (the default), no LSP server is launched and txt uses tree-sitter alone.
  • server — which [servers.<name>] entry to activate. Switch servers by editing this single line.
  • [servers.<name>] — one table per server. command is the executable name or absolute path, args is the argument list, and init_options is an optional JSON value sent as initializationOptions during the LSP handshake.

License

txt is dual-licensed under MIT and Apache 2.0. You may choose either license.

Bug reports and feature requests

Found a bug or have an idea for a feature? Open an issue on GitHub:

github.com/ErikHellman/txt/issues

For bugs, please include your operating system, the version of txt (run txt --version), and the steps needed to reproduce the problem.

联系我们 contact @ memedata.com