Skip to content
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

Starting mathicsscript in vi editing mode #85

Open
mickmcq opened this issue Dec 15, 2024 · 0 comments
Open

Starting mathicsscript in vi editing mode #85

mickmcq opened this issue Dec 15, 2024 · 0 comments

Comments

@mickmcq
Copy link

mickmcq commented Dec 15, 2024

Is your feature request related to a problem? Please describe.
mathicsscript starts in Emacs mode if I start it with mathicsscript or mathicsscript --readline Prompt. If I start it with mathicsscript --readline GNU it reads my ~/.inputrc file and hence respects my preferred edit mode. But there is no such configuration file for prompt_toolkit as far as I can tell. I would need to insert code into mathicsscript to enable the switch.

Describe the solution you'd like
I would like a command-line option to either (A) enable Vi-mode at startup, or (B) enable a fragment of python code to be inserted after startup but before interactivity becomes available. The fragment I would want to run would be something like app.editing_mode = EditingMode.VI but it depends on the termshell_prompt.py file having already imported EditingMode from prompt_toolkit.enums and, of course, prompt_toolkit remaining the default.

Describe alternatives you've considered
I have included the code mentioned above in termshell_prompt.py after line 162. That's fine until mathicsscript is updated! Then I have to add it again, possibly in a different place. Another alternative is to use GNU readline, which would respect my .inputrc file, but that provides a much worse user experience in terms of syntax highlighting and autocompletion than does prompt_toolkit.

Additional context
I'm afraid option (A) may become obsolete if prompt_toolkit gains a configuration file, but option (B) might be more long-lived, although it could also be abused.

I searched for such a feature in the documentation and it may be there since, as a newb, I don't fully understand the documentation. It seems that the options for adding files and expressions all require valid mathics expressions, not raw Python code. I see that there is a "Python extensions" directory but can find no documentation about it.

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

No branches or pull requests

1 participant