feat: implement select mode #240
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Implements #239
There are some usefull keybindings in insert mode while having something selected, for example surrounding the current selection with (), but selecting the right text is easier in visual mode than using a mouse or arrow keys. Vim also a select mode at https://vimhelp.org/visual.txt.html#Select, this only implements switching between visual and insert mode while keeping the selection and doesn't keep the selection mode (blockmode, linewise, normal).
Example:
Screencast_20250720_171517.mp4
What changed
Adds an action binded to
<C-g>
that runs in insert mode and visual mode. If there is a selection, it switches betweenvisual
andinsert
mode while keeping the current selections.Ideally it doesn't overwrite the
<C-g>
keybinding when there is no selection, but couldn't find a way to do that.Test plan
v0
(select the entire line)<C-g>
(switch to select mode)<C-x>
, cuts the entire line/the selected text.<C-g>
again and test a visual-only command, for exampled
(cuts the entire line).