on main help sign in
feat: open commands dialog on pressing `/` (#2034)
commitaa2cacd24af953a858dfb17f84ef37ff1db74ff3 authorAndrey Nering <andreynering@users.noreply.github.com> dateThu 29 Jan 2026, 10:31 (9 months ago) parente57687f
2 files changed+11−2
internal/ui/model/keys.go+5 internal/ui/model/ui.go+6−2
internal/ui/model/keys.go+5
@@ -10,6 +10,7 @@ type KeyMap struct {
1010 Newline key.Binding
1111 AddImage key.Binding
1212 MentionFile key.Binding
13+ Commands key.Binding
1314
1415 // Attachments key maps
1516 AttachmentDeleteMode key.Binding
@@ -123,6 +124,10 @@ func DefaultKeyMap() KeyMap {
123124 key.WithKeys("@"),
124125 key.WithHelp("@", "mention file"),
125126 )
127+ km.Editor.Commands = key.NewBinding(
128+ key.WithKeys("/"),
129+ key.WithHelp("/", "commands"),
130+ )
126131 km.Editor.AttachmentDeleteMode = key.NewBinding(
127132 key.WithKeys("ctrl+r"),
128133 key.WithHelp("ctrl+r+{i}", "delete attachment at index i"),
internal/ui/model/ui.go+6−2
@@ -1542,6 +1542,10 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
15421542 if cmd != nil {
15431543 cmds = append(cmds, cmd)
15441544 }
1545+ case key.Matches(msg, m.keyMap.Editor.Commands) && m.textarea.Value() == "":
1546+ if cmd := m.openCommandsDialog(); cmd != nil {
1547+ cmds = append(cmds, cmd)
1548+ }
15451549 default:
15461550 if handleGlobalKeys(msg) {
15471551 // Handle global keys first before passing to textarea.
@@ -1865,7 +1869,7 @@ func (m *UI) ShortHelp() []key.Binding {
18651869 k := &m.keyMap
18661870 tab := k.Tab
18671871 commands := k.Commands
1868− if m.focus == uiFocusEditor && m.textarea.LineCount() == 0 {
1872+ if m.focus == uiFocusEditor && m.textarea.Value() == "" {
18691873 commands.SetHelp("/ or ctrl+p", "commands")
18701874 }
18711875
@@ -1941,7 +1945,7 @@ func (m *UI) FullHelp() [][]key.Binding {
19411945 hasAttachments := len(m.attachments.List()) > 0
19421946 hasSession := m.hasSession()
19431947 commands := k.Commands
1944− if m.focus == uiFocusEditor && m.textarea.LineCount() == 0 {
1948+ if m.focus == uiFocusEditor && m.textarea.Value() == "" {
19451949 commands.SetHelp("/ or ctrl+p", "commands")
19461950 }
19471951