vim: Add helix mode toggle (#41454)

Just for parity with vim. Also prevents these toggles from having both
enabled at the same time as that is a buggy state.

Release Notes:

- Added command to toggle helix mode
This commit is contained in:
Lukas Wirth
2025-10-29 12:16:31 +00:00
committed by GitHub
parent 1a223e23fb
commit b7d31fabc5
2 changed files with 35 additions and 3 deletions
+17 -1
View File
@@ -22,7 +22,7 @@ use ui::{
ButtonStyle, ContextMenu, ContextMenuEntry, DocumentationEdge, DocumentationSide, IconButton,
IconName, IconSize, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*,
};
use vim_mode_setting::VimModeSetting;
use vim_mode_setting::{HelixModeSetting, VimModeSetting};
use workspace::item::ItemBufferKind;
use workspace::{
ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, item::ItemHandle,
@@ -307,6 +307,7 @@ impl Render for QuickActionBar {
let editor = editor.downgrade();
let editor_settings_dropdown = {
let vim_mode_enabled = VimModeSetting::get_global(cx).0;
let helix_mode_enabled = HelixModeSetting::get_global(cx).0;
PopoverMenu::new("editor-settings")
.trigger_with_tooltip(
@@ -583,10 +584,25 @@ impl Render for QuickActionBar {
move |window, cx| {
let new_value = !vim_mode_enabled;
VimModeSetting::override_global(VimModeSetting(new_value), cx);
HelixModeSetting::override_global(HelixModeSetting(false), cx);
window.refresh();
}
},
);
menu = menu.toggleable_entry(
"Helix Mode",
helix_mode_enabled,
IconPosition::Start,
None,
{
move |window, cx| {
let new_value = !helix_mode_enabled;
HelixModeSetting::override_global(HelixModeSetting(new_value), cx);
VimModeSetting::override_global(VimModeSetting(false), cx);
window.refresh();
}
}
);
menu
}