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_modetoTrueenablesNAVIGATIONmode on startup. The issue is that due to the current behaviour ofViState.reset()input mode gets resetted back toINSERTon 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_modewas introduced which setsinput_modeto the state observed before reset.vi_keep_last_used_modecan be useful even withvi_start_in_nav_modeset toFalsein the case the user prefer to start inINSERTmode but still wants to maintain the last mode he was in.In the case of
vi_keep_last_used_modeset toFalseandvi_start_in_nav_modetoTrueNAVIGATIONmode is set on every iteration the same wayINSERTwas set before this commit.Maybe interfering with the
pre_runon 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 acceptsmodeas an argument (after this commit prompt-toolkit/python-prompt-toolkit@60b22db#diff-d95a70749837190e857489f7cbc59cdc).