Vim Bindings on the horizon?

I use either Emacs in Evil mode or the neovim plugin in VSCode, and my shell also uses VIM mode.

So the only command line that does not follow that paradigm is Julia.

I found a few discussions on github re VIM bindings or integrating neovim in the REPL.

I found one discussion (would need to check back and find it) where the idea was pushed out of 1.8 milestones and the last comment was something along the lines of “…plan for v1.9 …”

Is this a thing that’s coming?

Edit: this has been discussed 4 years ago here: Vim mode in REPL command line - #23 by tamasgal with a new reply from last month.

1 Like

There is also a Julia Package called VimBindings.jl which might work for you.

In Julia I use the Emacs keybindings since I was not satisfied with any other solution, but for me it’s OK. Everything else is Vim :wink:

2 Likes

I found that, but it seems to depend on a host of old packages and caused irresolvable package conflicts. So I couldn’t test it.

I can deal with Emacs bindings, on simple readline interfaces VIM bindings don’t really make sense. But when writing a function over multiple lines in the REPL, they really would be a nice thing to have for editing that.

It’s just a weird disconnect when the REPL is running in a vterm in Emacs (I use Julia-Snail GitHub - gcv/julia-snail: An Emacs development environment for Julia) and then you have to shift modes mentally. In particular since the REPL vterm buffer has a normal and insert mode :slight_smile: but the REPL doesn’t understand c3w

1 Like

I am the author of VimBindings.jl, I will try to update the package soon to update the dependencies.

I recently married and then moved to a new country so my spare time has been sparse but I’m hoping to make many improvements to the package now that things have calmed down a little.

12 Likes

@TS-CUBED I’ve updated the dependencies and also removed some that were no longer needed. You may have better luck installing it now.

It’s quite rough around the edges at present, I’m open to feedback!

2 Likes

Still get this error:

(@v1.8) pkg> add https://github.com/caleb-allen/VimBindings.jl
    Updating git-repo `https://github.com/caleb-allen/VimBindings.jl`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package JuliaInterpreter [aa1ae85d]:
 JuliaInterpreter [aa1ae85d] log:
 ├─possible versions are: 0.1.1-0.9.15 or uninstalled
 ├─restricted by julia compatibility requirements to versions: 0.9.11-0.9.15 or uninstalled
 └─restricted by compatibility requirements with Debugger [31a5f54b] to versions: 0.7.0-0.8.21 — no versions left
   └─Debugger [31a5f54b] log:
     ├─possible versions are: 0.1.0-0.7.6 or uninstalled
     └─restricted to versions 0.6 by VimBindings [51b3953f], leaving only versions 0.6.0-0.6.8
       └─VimBindings [51b3953f] log:
         ├─possible versions are: 0.1.0 or uninstalled
         └─VimBindings [51b3953f] is fixed to version 0.1.0

I think I can remove the Debugger dependency as well. I’ll see what I can do.

Just wanted to say a thank you Caleb for making this package (and congrats on the marriage)! I had no idea this package existed and I have already added it to my startup.jl configuration - if you ever want to register this package at some point, let me know. Happy to help with making a PR. :smiley:

1 Like

@TheCedarPrince I’ve now added it to the repo, it can now be added with [ add VimBindings!

Also, if you experience any bizarre issues you may find better results loading it when you invoke Julia, rather than from within startup.jl.

More info can be found at the readme.

Anyways, I was able to carve out some time to resolve some of the more pressing bugs. There is also refactor of how commands are parsed in the works which will make it much easier to build out many vim features in a short amount of time.

Once I find a few spare hours I’ll try to get that through, and maybe it will be ready for a proper package announcement then!

2 Likes

I’ve done some refactoring to expand the functionality of VimBindings.jl to all REPL modes, feel free to try it out and provide feedback!

2 Likes

@caleb-allen Thank you for creating the package! Looks really nice :slight_smile:

@TS-CUBED One alternative is that one can directly call up Neovim from Julia via the edit(<filename>) command, so long as nvim is set up as the default editor via the EDITOR, JULIA_EDITOR, or VISUAL env variables. That way one can go back and forth between editing files in Neovim and working in the REPL. Relevant function doc

1 Like