T-65 — the capstone of the Vim epic. assets/keymaps/vim.yaml binds the muscle-memory set guarded on vim.normal/insert/visual: hjkl/w/b/e/0/$/^/ gg/G motions, x/dd/dw/D/yy/p/P/cc/cw edits, i/a/I/A/o/O insert entries, v + d/y/c in visual, Esc back to normal, and counts via the matcher. App shortcuts (palette, find, zoom) are carried in the preset so they survive under Vim. The editor now feeds Shift chords to the matcher (Vim's capitals: G, D, A, P, $) while still bubbling Ctrl/Alt/Meta to the global handler. The keybindings-ui stub gains palette commands (`Keymap: Vim` / `Keymap: Default`) to switch presets — the user-facing way to turn Vim on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
/// T-65: the keybindings UI contributes palette commands that switch the
|
|
/// active keymap preset.
|
|
library;
|
|
|
|
import 'package:clide/builtin/keybindings_ui/keybindings_ui.dart';
|
|
import 'package:clide/kernel/kernel.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import '../../helpers/kernel_fixture.dart';
|
|
|
|
void main() {
|
|
late KernelFixture f;
|
|
setUp(() async {
|
|
f = await KernelFixture.create();
|
|
f.services.extensions.register(KeybindingsUiExtension());
|
|
await f.services.extensions.activate('builtin.keybindings-ui');
|
|
});
|
|
tearDown(() => f.dispose());
|
|
|
|
test('contributes a switch command per shipped preset', () {
|
|
expect(f.services.commands.get('keymap.preset.vim'), isNotNull);
|
|
expect(f.services.commands.get('keymap.preset.default'), isNotNull);
|
|
});
|
|
|
|
test('running the vim command switches the active preset', () async {
|
|
await f.services.commands.execute('keymap.preset.vim');
|
|
expect(f.services.settings.get<String>(kKeymapPresetSetting), 'vim');
|
|
});
|
|
|
|
test('switching back to default works', () async {
|
|
await f.services.commands.execute('keymap.preset.vim');
|
|
await f.services.commands.execute('keymap.preset.default');
|
|
expect(f.services.settings.get<String>(kKeymapPresetSetting), 'default');
|
|
});
|
|
}
|