-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
REPL/LineEdit: vim-style bindings by embedding Neovim? #9649
Comments
I could see this working well as a package, though I'd recommend a separate mode, so nvim can handle most of the editing. If you want to reuse any of the existing infrastructure, you can just use the appropriate functions rather than hacking it in. |
Most attempts at vim keybindings fall into an uncanny valley of working like vim 90% of the time, before breaking your flow by doing something unexpected and annoying, so this would be a terrific way to tackle #6774 and have actual vim keybindings. Though I agree, it would probably be better as a package. |
Yes this is probably best as a package (since it brings in an external dependency) Perhaps it would be simplest to be a separate REPL implementation not using LineEditRepl (and i.e. let nvim draw to the terminal directly in this mode, though this will require more work on the nvim side), but it still would be convenient to switch between LineEdit and this in a single keystoke. (retaining current input, repl mode (julia/help/Cxx/etc) and history) |
(closing as not actionable in base) |
A way of impementing vi/vim-style keybindings (ref #6774) might be to embed an Neovim (fork of vim that aims to support plugins and uis in any language) instance and forward key presses to it.
I have a very crude proof-of-concept here. When pressing
^O
at the REPL it will copy the LineEdit buffer contents to neovim and start forwarding keypresses to nvim. Then it will listen to buffer changes from nvim and update the display, transitioning back to LineEdit control when insert mode is entered in nvim.There is some work needed on the neovim-side to properly support this kind of embedding, but on the julia-side, I don't know the proper way to integrate with LineEdit. Right now I do
and one of the issues is that this sometimes
read
s one byte too much after I want to switch back to LineEdit. It is possibe to "push back" a charater to the read stream of LineEdit somehow? Or perhaps it would be better to make this a mode/state of LineEdit where (almost) all presses is forwarded to nvim?The text was updated successfully, but these errors were encountered: