Skip to content

Cursor shape dependent on vi editing mode #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mskar
Copy link

@mskar mskar commented Oct 3, 2020

This pull request implements vim mode-dependent changes in cursor shape.

The cursor shape is

  • beam in Insert mode:
    image
  • block in Nav (Normal) mode
    image
  • underscore in Replace mode
    image

The code is based on a prompt_toolkit issue.

I put the cursor code in ptpython/key_bindings.py, because the imported classes are from prompt_toolkit's key_binding module. This may be a stretch, but pressing certain keys (e.g. escape, i, a, e, R) can switch modes and change the cursor shape.

This PR only effects vi mode.

Currently, this feature is enabled by default, but it can be disabled using by adding

repl.enable_modal_cursor = False

to config.py.

To install a version of ptpython with the modal cursor, run the line below.

python -m pip install git+https://github.com/mskar/ptpython.git@vim_cursor

@jonathanslenders
Copy link
Member

Closing in favor of: #497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants