Skip to content

Commit d887ff0

Browse files
authored
Merge pull request #15 from zevorn/feat/tui-keymap-header-vim-jumps
Improve interaction logic, panne switch, add keymap
2 parents 1bf80c2 + b902d13 commit d887ff0

File tree

9 files changed

+1039
-25
lines changed

9 files changed

+1039
-25
lines changed

README-zh.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,16 @@ criew tui
198198
#### 键位
199199

200200
- `:` 打开命令栏
201+
- 顶部状态栏会显示当前 keymap 方案:`default``vim``custom`
202+
- 数字前缀可重复垂直移动:`default/custom` 使用 `数字 + i/k``vim` 使用 `数字 + j/k`
201203
- `y` / `n` 启用或禁用当前订阅
202-
- `Enter` 打开当前 mailbox 或 thread
204+
- `Enter` 打开当前 mailbox 或 thread,并自动切到 threads 或 preview pane
203205
- `a` apply 当前 patch series
204206
- `d` 导出当前 patch series
205207
- `u` 撤销本次会话中最近一次成功 apply
206208
- `r``e` 打开回信面板
207209
- `Tab` 在 Mail 页面和 Code Browser 页面之间切换
210+
-`ui.keymap = "vim"` 时,`gg` 跳到当前 pane 行首,`G` 跳到行尾,`qq` 快速退出
208211

209212
#### 命令栏命令
210213

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,16 @@ criew tui
211211
Inside the TUI:
212212

213213
- `:` opens the command palette
214+
- the header shows the active keymap scheme (`default`, `vim`, or `custom`)
215+
- a numeric prefix repeats vertical movement: `count+i/k` for `default`/`custom`, `count+j/k` for `vim`
214216
- `y` / `n` enable or disable the selected subscription
215-
- `Enter` opens the selected mailbox or thread
217+
- `Enter` opens the selected mailbox or thread and moves focus to threads or preview
216218
- `a` applies the current patch series
217219
- `d` exports the current patch series
218220
- `u` undoes the most recent successful apply from the current session
219221
- `r` or `e` opens the reply panel
220222
- `Tab` switches between the mail page and the code browser
223+
- with `ui.keymap = "vim"`, `gg` jumps to the first line in the active pane, `G` jumps to the last line, and `qq` exits quickly
221224

222225
##### Background sync
223226

docs/reference/config.example.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ filter = "info"
5656
# startup_sync = true
5757

5858
# Optional. Main-page navigation scheme.
59-
# Supported: "default" (j/l focus, i/k move), "vim" (h/l focus, j/k move).
59+
# Supported:
60+
# "default" (j/l focus, i/k move)
61+
# "vim" (h/l focus, j/k move, gg/G jump, qq quit)
62+
# "custom" (header shows custom; navigation currently falls back to default bindings)
6063
# Default: "default"
6164
# keymap = "default"
6265

src/infra/config.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ mailbox = "linux-kernel"
3131
3232
[ui]
3333
startup_sync = true
34-
# keymap = "default" # Supported: default, vim
34+
# keymap = "default" # Supported: default, vim, custom
3535
# inbox_auto_sync_interval_secs = 30
3636
3737
[logging]
@@ -63,13 +63,15 @@ pub enum UiKeymap {
6363
#[default]
6464
Default,
6565
Vim,
66+
Custom,
6667
}
6768

6869
impl UiKeymap {
6970
pub fn as_str(self) -> &'static str {
7071
match self {
7172
Self::Default => "default",
7273
Self::Vim => "vim",
74+
Self::Custom => "custom",
7375
}
7476
}
7577
}
@@ -735,6 +737,27 @@ trees = ["./linux-next"]
735737
let _ = fs::remove_dir_all(home);
736738
}
737739

740+
#[test]
741+
fn loads_custom_ui_keymap_from_config() {
742+
let base = temp_dir("config-custom-keymap");
743+
let config_path = base.join("config.toml");
744+
745+
fs::write(
746+
&config_path,
747+
r#"
748+
[ui]
749+
keymap = "custom"
750+
"#,
751+
)
752+
.expect("write config");
753+
754+
let loaded = load(Some(&config_path)).expect("load config");
755+
756+
assert_eq!(loaded.ui_keymap, UiKeymap::Custom);
757+
758+
let _ = fs::remove_dir_all(base);
759+
}
760+
738761
#[test]
739762
fn falls_back_to_config_alias_filename_when_present() {
740763
let home = temp_dir("config-legacy-home");

0 commit comments

Comments
 (0)