What does this MR do?
This MR introduces what I call the vimode. vimode provides keyboard-centric
means of navigating the scrollback, selecting and copying text, searching and
jumping between search matches. By default, vimode provides actions and
keybinds similar to those of vi(m).
vimode is meant to be a complete replacement of the current search mode. Its
primary advantage over the search mode is the ability to arbitrarily manipulate
the selection region (extending, shrinking, resizing) using keyboard only.
vimode may be entered via the default search mode keybind (C+S+r) and exited
via Esc or C+c. vimode includes a submode for performing search (C+/ to search
forward or C+S+/ to search backward, or C+S+/ outside vimode to enter the
search mode directly, Enter to confirm, Esc to exit). Most of the search code
has been adapted to fit vimode. vimode maintains the most recent confirmed
search allowing to navigate between search matches (n to move forward, S+n to
move backward).
Why the name 'vimode'?
For a moment I thought about 'bar mode' to complement 'foo terminal', but that
name would most likely be misleading, thus the next best name I could come up
with had been 'vimode' because its controls resemble those of vi(m). I also
considered keyboard_selection (too long) and kbsel (not bad, vimode won).
Further work
- Updated man page, changelog, readme.
Possible further extensions
- operator pending mode - the current implementation has no operator pending,
thus all keybinds execute immediately. As such, certain actions are not
possible, e.g. jump forward to character ('f' + character) or yank inner word
('yiw').
- scrolloff - maintains a fixed distance from the cursor to the edges of the
viewport, e.g. scrolloff=5 would maintain 5 lines of distance between the
top/bottom of the viewport and the cursor.
- jump list - keep a number of past jump locations for quick navigation (C+i,
C+o in vim).
- support regex in search.
- WORD motions.
Further notes
- I worked on this feature as I learned how foot works, thus the commit history
ended up being quite chaotic. I suppose squashing this would be best.
- SELECTION_QUOTE_WISE has been removed as it seemed to me it existed solely to
be a toggle of the initial state, serving no purpose beyond that (as
indicated by the asserts in all other occurences of this enumeration). There
is now a function 'selection_start_matching_delimiters' which fulfills the
purpose of this selection mode.
Why is this change included? I started reworking selection and this was in
the changeset. Decided to backtrack on the selection rework due to its scale,
but this bit seemed like a reasonable inclusion.
Relevant issues
#136 #419 #1168 #1338 #1414 #1912
### What does this MR do?
This MR introduces what I call the vimode. vimode provides keyboard-centric
means of navigating the scrollback, selecting and copying text, searching and
jumping between search matches. By default, vimode provides actions and
keybinds similar to those of vi(m).
vimode is meant to be a complete replacement of the current search mode. Its
primary advantage over the search mode is the ability to arbitrarily manipulate
the selection region (extending, shrinking, resizing) using keyboard only.
vimode may be entered via the default search mode keybind (C+S+r) and exited
via Esc or C+c. vimode includes a submode for performing search (C+/ to search
forward or C+S+/ to search backward, or C+S+/ outside vimode to enter the
search mode directly, Enter to confirm, Esc to exit). Most of the search code
has been adapted to fit vimode. vimode maintains the most recent confirmed
search allowing to navigate between search matches (n to move forward, S+n to
move backward).
### Why the name 'vimode'?
For a moment I thought about 'bar mode' to complement 'foo terminal', but that
name would most likely be misleading, thus the next best name I could come up
with had been 'vimode' because its controls resemble those of vi(m). I also
considered keyboard_selection (too long) and kbsel (not bad, vimode won).
### Further work
- Updated man page, changelog, readme.
### Possible further extensions
- operator pending mode - the current implementation has no operator pending,
thus all keybinds execute immediately. As such, certain actions are not
possible, e.g. jump forward to character ('f' + character) or yank inner word
('yiw').
- scrolloff - maintains a fixed distance from the cursor to the edges of the
viewport, e.g. scrolloff=5 would maintain 5 lines of distance between the
top/bottom of the viewport and the cursor.
- jump list - keep a number of past jump locations for quick navigation (C+i,
C+o in vim).
- support regex in search.
- WORD motions.
### Further notes
- I worked on this feature as I learned how foot works, thus the commit history
ended up being quite chaotic. I suppose squashing this would be best.
- SELECTION_QUOTE_WISE has been removed as it seemed to me it existed solely to
be a toggle of the initial state, serving no purpose beyond that (as
indicated by the asserts in all other occurences of this enumeration). There
is now a function 'selection_start_matching_delimiters' which fulfills the
purpose of this selection mode.
Why is this change included? I started reworking selection and this was in
the changeset. Decided to backtrack on the selection rework due to its scale,
but this bit seemed like a reasonable inclusion.
### Relevant issues
#136 #419 #1168 #1338 #1414 #1912