jupyter / jupyter_console

Jupyter Terminal Console
http://jupyter-console.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
250 stars 145 forks source link

Add modal cursor option for when using vi mode #292

Open jsr-p opened 1 year ago

jsr-p commented 1 year ago

This PR adds the option of having a modal cursor when using the vi mode. It does this by setting the cursor option of the PromptSession equal to an instance of ModalCursorShapeConfig from here. Furthermore, it adds two news options to the config file:

  1. The option to have a modal cursor (when using vi mode)
  2. An option to change the ttimeoutlen parameter of the main Application from prompt_toolkit

The ttimeoutlen is a timeout setting that affects the handling of keys; in this case, when to flush the input. I.e. it determines how long does it it take when the escape key has been pressed for prompt_toolkit to register this and change the prompt layout according to the vi mode. See the prompt_toolkit docs.

Together with #289 this yields a descent vi mode layout for the jupyter_console.