Add config options related to Vi input mode #337
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.
This PR addresses #258 and adds couple of configuration options related to Vi input mode.
Setting
vi_start_in_nav_mode
toTrue
enablesNAVIGATION
mode on startup. The issue is that due to the current behaviour ofViState.reset()
input mode gets resetted back toINSERT
on the every iteration of the main loop. In order to at one hand to provide the user with desired behaviour and on the other hand doesn't introduce breaking changes the other optionvi_keep_last_used_mode
was introduced which setsinput_mode
to the state observed before reset.vi_keep_last_used_mode
can be useful even withvi_start_in_nav_mode
set toFalse
in the case the user prefer to start inINSERT
mode but still wants to maintain the last mode he was in.In the case of
vi_keep_last_used_mode
set toFalse
andvi_start_in_nav_mode
toTrue
NAVIGATION
mode is set on every iteration the same wayINSERT
was set before this commit.Maybe interfering with the
pre_run
on the main loop is not the best option but I don't see any other way to set input mode after reset forViState.reset()
no longer acceptsmode
as an argument (after this commit prompt-toolkit/python-prompt-toolkit@60b22db#diff-d95a70749837190e857489f7cbc59cdc).