diff --git a/keymap.go b/keymap.go index 002f0a2..2184eb6 100644 --- a/keymap.go +++ b/keymap.go @@ -53,11 +53,11 @@ func init() { key.WithHelp("", "half page down"), ), GotoTop: key.NewBinding( - key.WithKeys("g"), + key.WithKeys("g", "home"), key.WithHelp("", "goto top"), ), GotoBottom: key.NewBinding( - key.WithKeys("G"), + key.WithKeys("G", "end"), key.WithHelp("", "goto bottom"), ), Down: key.NewBinding( diff --git a/main.go b/main.go index 454e137..8ce0ad1 100644 --- a/main.go +++ b/main.go @@ -247,7 +247,24 @@ func (m *model) handleDigKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { } } + case key.Matches(msg, key.NewBinding(key.WithKeys("ctrl+w"))): + digPath, ok := jsonpath.Split(m.digInput.Value()) + if ok { + digPath = digPath[:len(digPath)-1] + n := m.selectByPath(digPath) + if n != nil { + m.selectNode(n) + m.digInput.SetValue(m.cursorPath()) + m.digInput.CursorEnd() + } + } + default: + if key.Matches(msg, key.NewBinding(key.WithKeys("."))) { + m.digInput.SetValue(m.cursorPath()) + m.digInput.CursorEnd() + } + m.digInput, cmd = m.digInput.Update(msg) n := m.dig(m.digInput.Value()) if n != nil {