diff --git a/internal/input/keymap.go b/internal/input/keymap.go index 38a63ce..6e60516 100644 --- a/internal/input/keymap.go +++ b/internal/input/keymap.go @@ -95,6 +95,8 @@ func NewNormalKeymap() *Keymap { "\"": textobject.Delimiter{Char: '"'}, "'": textobject.Delimiter{Char: '\''}, "`": textobject.Delimiter{Char: '`'}, + "b": textobject.Delimiter{Char: '('}, + "B": textobject.Delimiter{Char: '{'}, }, } } @@ -142,8 +144,9 @@ func NewVisualKeymap() *Keymap { "a": nil, }, textObjects: map[string]action.TextObject{ - "w": textobject.Word{}, - "W": textobject.WORD{}, + "w": textobject.Word{}, + "W": textobject.WORD{}, + // TODO: 's' and 'p' "{": textobject.Delimiter{Char: '{'}, "}": textobject.Delimiter{Char: '}'}, "(": textobject.Delimiter{Char: '('}, @@ -155,6 +158,8 @@ func NewVisualKeymap() *Keymap { "\"": textobject.Delimiter{Char: '"'}, "'": textobject.Delimiter{Char: '\''}, "`": textobject.Delimiter{Char: '`'}, + "b": textobject.Delimiter{Char: '('}, + "B": textobject.Delimiter{Char: '{'}, }, } } diff --git a/internal/textobject/delimiter.go b/internal/textobject/delimiter.go index 5fc67fa..0a1ae3c 100644 --- a/internal/textobject/delimiter.go +++ b/internal/textobject/delimiter.go @@ -47,6 +47,9 @@ type Delimiter struct { } // TODO: This should allow for many lines, not just a single line +// +// BUG: This does not work properly when the cursor is not inside a delimiter. If the cursor +// does not fall inside a delimiter range, it should search forward and find the delimiter. func (to Delimiter) GetRange(m action.Model, cursor core.Position, modifier string) (core.Position, core.Position, core.MotionType) { buf := m.ActiveBuffer() line := buf.Lines[cursor.Line]