detached 55482b4

test(config): cover vim action migration

commit
55482b4bafa5d858ee2cb799aaa893b156141535
author
brice · · 2026-08-14 13:17 UTC
parent
f52290e
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +35 -0
M internal/infrastructure/config/migrate_test.go +35 -0
@@ -816,6 +816,41 @@ func TestMigrator_MergeMissingDefaultActions_PaneMode(t *testing.T) {
816816 assert.Equal(t, "Custom move pane", move["desc"])
817817 }
818818
819+func TestMigrator_MergeMissingDefaultActions_VimMode(t *testing.T) {
820+ m := NewMigrator()
821+
822+ rawConfig := map[string]any{
823+ "workspace": map[string]any{
824+ "vim_mode": map[string]any{
825+ "actions": map[string]any{
826+ "heading-next": map[string]any{
827+ "keys": []string{"]]"},
828+ "desc": "Custom next heading",
829+ },
830+ },
831+ },
832+ },
833+ }
834+
835+ m.mergeMissingDefaultActions(rawConfig)
836+
837+ actionsAny := m.getNestedValue(rawConfig, "workspace.vim_mode.actions")
838+ actions, ok := actionsAny.(map[string]any)
839+ require.True(t, ok)
840+
841+ focusAny, hasFocus := actions["focus-input"]
842+ require.True(t, hasFocus)
843+ focus, ok := focusAny.(ActionBinding)
844+ require.True(t, ok)
845+ assert.Equal(t, []string{"gi"}, focus.Keys)
846+
847+ headingAny, hasHeading := actions["heading-next"]
848+ require.True(t, hasHeading)
849+ heading, ok := headingAny.(map[string]any)
850+ require.True(t, ok)
851+ assert.Equal(t, "Custom next heading", heading["desc"])
852+}
853+
819854 func TestMigrator_DefaultValueForKey_WorkspaceShortcutAction(t *testing.T) {
820855 m := NewMigrator()
821856
@@ -816,6 +816,41 @@ func TestMigrator_MergeMissingDefaultActions_PaneMode(t *testing.T) {
816 assert.Equal(t, "Custom move pane", move["desc"])816 assert.Equal(t, "Custom move pane", move["desc"])
817 }817 }
818 818
819+func TestMigrator_MergeMissingDefaultActions_VimMode(t *testing.T) {
820+ m := NewMigrator()
821+
822+ rawConfig := map[string]any{
823+ "workspace": map[string]any{
824+ "vim_mode": map[string]any{
825+ "actions": map[string]any{
826+ "heading-next": map[string]any{
827+ "keys": []string{"]]"},
828+ "desc": "Custom next heading",
829+ },
830+ },
831+ },
832+ },
833+ }
834+
835+ m.mergeMissingDefaultActions(rawConfig)
836+
837+ actionsAny := m.getNestedValue(rawConfig, "workspace.vim_mode.actions")
838+ actions, ok := actionsAny.(map[string]any)
839+ require.True(t, ok)
840+
841+ focusAny, hasFocus := actions["focus-input"]
842+ require.True(t, hasFocus)
843+ focus, ok := focusAny.(ActionBinding)
844+ require.True(t, ok)
845+ assert.Equal(t, []string{"gi"}, focus.Keys)
846+
847+ headingAny, hasHeading := actions["heading-next"]
848+ require.True(t, hasHeading)
849+ heading, ok := headingAny.(map[string]any)
850+ require.True(t, ok)
851+ assert.Equal(t, "Custom next heading", heading["desc"])
852+}
853+
819 func TestMigrator_DefaultValueForKey_WorkspaceShortcutAction(t *testing.T) {854 func TestMigrator_DefaultValueForKey_WorkspaceShortcutAction(t *testing.T) {
820 m := NewMigrator()855 m := NewMigrator()
821 856

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close