on main help sign in
feat(ui): add ctrl+y keybinding to toggle yolo mode
2b941aaAndrey Nering
internal/ui/dialog/commands.go+1−1
@@ -522,7 +522,7 @@ func (c *Commands) defaultCommands() []*CommandItem {
522
522
523 commands = append(
523 commands = append(
524 commands,
524 commands,
525− NewCommandItem(c.com.Styles, "toggle_yolo", "Toggle Yolo Mode", "", ActionToggleYoloMode{}),
525+ NewCommandItem(c.com.Styles, "toggle_yolo", "Toggle Yolo Mode", "ctrl+y", ActionToggleYoloMode{}),
526 NewCommandItem(c.com.Styles, "toggle_help", "Toggle Help", "ctrl+g", ActionToggleHelp{}),
526 NewCommandItem(c.com.Styles, "toggle_help", "Toggle Help", "ctrl+g", ActionToggleHelp{}),
527 NewCommandItem(c.com.Styles, "init", "Initialize Project", "", ActionInitializeProject{}),
527 NewCommandItem(c.com.Styles, "init", "Initialize Project", "", ActionInitializeProject{}),
528 )
528 )
internal/ui/model/keys.go+12−7
@@ -57,13 +57,14 @@ type KeyMap struct {
57 }
57 }
58
58
59 // Global key maps
59 // Global key maps
60− Quit key.Binding
60+ Quit key.Binding
61− Help key.Binding
61+ Help key.Binding
62− Commands key.Binding
62+ Commands key.Binding
63− Models key.Binding
63+ Models key.Binding
64− Suspend key.Binding
64+ Suspend key.Binding
65− Sessions key.Binding
65+ Sessions key.Binding
66+ Tab key.Binding
66− Tab key.Binding
67+ ToggleYolo key.Binding
67}
68}
68
69
69func DefaultKeyMap() KeyMap {
70func DefaultKeyMap() KeyMap {
@@ -96,6 +97,10 @@ func DefaultKeyMap() KeyMap {
96 key.WithKeys("tab"),
97 key.WithKeys("tab"),
97 key.WithHelp("tab", "change focus"),
98 key.WithHelp("tab", "change focus"),
98 ),
99 ),
100+ ToggleYolo: key.NewBinding(
101+ key.WithKeys("ctrl+y"),
102+ key.WithHelp("ctrl+y", "toggle yolo"),
103+ ),
99 }
104 }
100
105
101 km.Editor.AddFile = key.NewBinding(
106 km.Editor.AddFile = key.NewBinding(
internal/ui/model/ui.go+7
@@ -1805,6 +1805,11 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
1805 }
1805 }
1806 cmds = append(cmds, tea.Suspend)
1806 cmds = append(cmds, tea.Suspend)
1807 return true
1807 return true
1808+ case key.Matches(msg, m.keyMap.ToggleYolo):
1809+ yolo := !m.com.Workspace.PermissionSkipRequests()
1810+ m.com.Workspace.PermissionSetSkipRequests(yolo)
1811+ m.setEditorPrompt(yolo)
1812+ return true
1808 }
1813 }
1809 return false
1814 return false
1810 }
1815 }
@@ -2410,6 +2415,7 @@ func (m *UI) FullHelp() [][]key.Binding {
2410 commands,
2415 commands,
2411 k.Models,
2416 k.Models,
2412 k.Sessions,
2417 k.Sessions,
2418+ k.ToggleYolo,
2413 )
2419 )
2414 if hasSession {
2420 if hasSession {
2415 mainBinds = append(mainBinds, k.Chat.NewSession)
2421 mainBinds = append(mainBinds, k.Chat.NewSession)
@@ -2471,6 +2477,7 @@ func (m *UI) FullHelp() [][]key.Binding {
2471 commands,
2477 commands,
2472 k.Models,
2478 k.Models,
2473 k.Sessions,
2479 k.Sessions,
2480+ k.ToggleYolo,
2474 },
2481 },
2475 )
2482 )
2476 editorBinds := []key.Binding{
2483 editorBinds := []key.Binding{