t184256 / xontrib-prompt-vi-mode

vi-mode status formatter for xonsh prompt
MIT License
11 stars 4 forks source link

Extreme slowness #5

Open swedneck opened 4 years ago

swedneck commented 4 years ago

using prompt-vi-mode results in input becoming excruciatingly slow, to the point that it takes multiple seconds just to write a single word.

``` +------------------+----------------------+ | xonsh | 0.9.13.dev1 | | Git SHA | 9f7ccc65 | | Commit Date | Oct 15 17:14:50 2019 | | Python | 3.7.5 | | PLY | 3.11 | | have readline | True | | prompt toolkit | 3.0.2 | | shell type | prompt_toolkit2 | | pygments | 2.2.0 | | on posix | True | | on linux | True | | distro | fedora | | on darwin | False | | on windows | False | | on cygwin | False | | on msys2 | False | | is superuser | False | | default encoding | utf-8 | | xonsh encoding | utf-8 | | encoding errors | surrogateescape | +------------------+----------------------+ ```
jamoozy commented 3 years ago

I have this issue too. It seems to stem from running this function at every keystroke:

https://github.com/t184256/xontrib-prompt-vi-mode/blob/master/xontrib/prompt_vi_mode.xsh#L17

    mode = state.input_mode

I poked at it a bit, but couldn't find a way to speed this up.

On the bright side, if you're not using {vi_mode} or {vi_mode_not_insert} in your $PROMPT variable, enabling vi key bindings in xonsh is a simple matter of adding the following line to your ~/.xonshrc:

$VI_MODE = True