Righter
A Vim-like text editor written in Rust. Righter uses a shared editor core with two frontends: TUI (terminal) and GUI (desktop window).
With rust-analyzer LSP integration, it supports completion, go-to-definition, hover, references, diagnostics, code actions, rename, formatting, and workspace symbol search.
Requirements
- Rust nightly (edition 2024)
rust-analyzeravailable inPATH(for LSP features)
Build and Run
# TUI (default)
# GUI
Features
Vim Editing
- Modes: Normal / Insert / Visual / Visual Line / Command / Search
- Motions:
h/j/k/l,w/b/e/W/B/E,0/$,^,{/},gg/G,H/M/L,%,f/F/t/T - Editing:
d/c/y+ motion,dd/cc/yy,p/P,x,J,r,~,gu/gU/g~,Ctrl-A/X - Undo/Redo:
u/Ctrl-R - Repeat:
.(dot repeat) - Macros:
q{char}to record,@{char}to play,@@to replay last macro - Registers:
"{char}to select a register - Visual Selection:
v/V, then apply operations liked/c/y
Search and Replace
/for regex search (incremental, smart case)n/Nfor next/prev match,*/#for word-under-cursor search:s/old/new/[g][i]for line replacement:%s/old/new/[g][i]for file-wide replacement (with capture groups)
LSP (rust-analyzer)
| Key / Command | Action |
|---|---|
auto / Ctrl-Space |
Completion |
gd |
Go to definition |
K |
Hover |
gr |
Find references |
ga |
Code actions |
gE |
Diagnostics list |
]d / [d |
Next/previous diagnostic |
Ctrl-T |
Workspace symbol search |
:rename <name> |
Rename symbol |
:format |
Format document |
Windows and Buffers
Ctrl-W v/sto split panes (vertical/horizontal),:split/:vsplitwith optional fileCtrl-W h/j/k/lto move between panes,Ctrl-W qto close a panegt/gTor:bn/:bpto switch buffersCtrl-Pfor fuzzy file finder,Ctrl-Tfor workspace symbol search:set wrap/:set nowrapto toggle line wrapping:set fontsize=Nto change GUI font size (8–48, default 14):set scrolloff=N/:set tabstop=Nto adjust scroll offset and tab width
Configuration
Settings are read from ~/.config/righter/config.json ($XDG_CONFIG_HOME preferred) at startup. All fields are optional; missing fields use defaults. The file is read-only — :set changes are session-local.
GUI Mouse Support
- Click to position cursor in the editor area
- Scroll wheel to scroll the viewport
- Click on a split pane to switch focus
Architecture
┌──────────────────────────────────────────────────┐
│ Shared Editor Core │
│ editor/ input/ lsp/ highlight/ buffer/ │
│ key.rs (KeyInput) │
│ highlight/style.rs (SyntaxStyle) │
│ editor/pane.rs (AreaRect) │
└───────────┬──────────────────┬───────────────────┘
│ │
┌────────▼────────┐ ┌──────▼─────────┐
│ TUI Frontend │ │ GUI Frontend │
│ ratatui/crossterm│ │ egui/eframe │
│ main.rs, app.rs │ │ gui_main.rs │
│ ui/ │ │ gui_app.rs │
└──────────────────┘ │ gui/ │
└─────────────────┘
A single crate builds two binaries behind feature flags (tui / gui).
The editor core stays frontend-agnostic via three shared types: KeyInput, AreaRect, SyntaxStyle.
Limitations
- Rust-focused (
tree-sitter-rust/rust-analyzer) - Clipboard support is currently macOS-only (
pbcopy/pbpaste) - LSP WorkspaceEdit currently applies only to the active file
License
MIT
日本語
Rust製のVimライクテキストエディタ。 同一のエディタコアを TUI(ターミナル)と GUI(デスクトップウィンドウ)の2つのフロントエンドで共有する設計です。
rust-analyzer との LSP 統合により、補完・定義ジャンプ・ホバー・参照検索・診断・コードアクション・リネーム・フォーマット・ワークスペースシンボル検索をサポートします。
必要環境
- Rust nightly(edition 2024)
- rust-analyzer(LSP機能を使う場合、PATHに存在すること)
ビルドと実行
# TUI版(デフォルト)
# GUI版
主な機能
- Vim操作(モード/モーション/演算子/マクロ/レジスタ)
- 検索・置換(正規表現、インクリメンタル検索、スマートケース)
- LSP統合(補完、定義ジャンプ、ホバー、参照検索、診断、コードアクション、リネーム、フォーマット、ワークスペースシンボル検索)
- ペイン分割・バッファ切替・ファイルファインダー・ワークスペースシンボル検索
- GUI版: マウス操作(クリックでカーソル移動、スクロール、ペインフォーカス切替)
設定ファイル
~/.config/righter/config.json($XDG_CONFIG_HOME 優先)を起動時に読み込みます。全フィールド省略可、ファイルなしでも正常起動します。:set による変更はセッション内のみ有効です。
制限事項
- Rust専用(tree-sitter-rust / rust-analyzer 固定)
- クリップボードは macOS のみ(
pbcopy/pbpaste) - LSP WorkspaceEdit は現在のファイルのみ対応
ライセンス
MIT