Panic Nova Vim Extension

The first class of productivity is has access to each char in the code right closer you hand. This is what Vim means to me. I am creating this topic so Nova community may discuss on how to brig vim extension to life!

3 Likes

Development of a Vim emulation extension for Nova is not currently possible, but we have been tracking ways that we might expose extension points to make it possible, as this has been a very popular request from users.

By our current thoughts, we would expose a way for an extension to declare additional “modes” for the editor, and a keyboard shortcut that would enter that mode. While in a secondary mode, all keystrokes would be forwarded through the extension, which would enable an extension to add emulation for Vim’s Normal / Navigation mode, for example. A second key combination would them be used to exit back into “Insert” mode / the standard non-modal editor behavior that exists in all GUI-based text editors.

Feel free to mention here if you feel this would be sufficient to handle the majority of cases a Vim emulation extension might require, and we can consider it our plans for this.

Notes: tracking internally as #2020.

4 Likes

I’ve thought about this a bit and have a couple other things I’d want for vim emulation:

  • A way to display the command I’m currently typing in Nova’s UI if I’m in command mode
  • Vim allows using j/k to move my selection up and down, and it preserves the column I’m in, even if I click into a space where there’s no text. I don’t think nova’s current text selection would properly support this and I don’t think an extension could emulate it since extensions don’t have a way to intercept mouse events.
    Screen Recording 2020-11-13 at 20.54.30
  • In visual mode, a way to change the cursor mode between “bar”, where it’s in between characters, and “selection” where it’s over characters. I suppose this is probably doable just by manipulating selections.
  • My vim setup configures relative line numbers, which make vim a lot easier to use
    Screen Shot 2020-11-13 at 20.50.46
3 Likes

This sound like a good place to start. Note that Vim is in “normal” mode by default, in which h, j, k, and l move the cursor, x deletes a character, etc. So to behave like Vim, the extension must be able to specify which of its declared modes is the default mode for new editor views. If a new Nova-Vim-extension editor view were to start in “insert” mode, it would be very confusing for Vim users.

2 Likes

If you all don’t mind me reviving this thread a bit:

Now that Nova 5 has the necessary functionality (unmodified and modal key bindings), I decided to give this a shot. I’ll start listing hiccups as I hit them.

Ideally, there’d be some way to tell what mode you were in. In most vim-like GUI editors, this happens two ways:

  • The shape of the cursor changes between a vertical line and a block. Nova has a setting for this, but no way to change it programmatically AFAICT.
  • The name of the current mode appears in the status bar. As far as I can tell, Nova doesn’t support extensions adding anything here.

First of all, I love using Nova. The trial is so awesome and I want to buy it. But, without a vim support I can’t use an editor. I like the ideia of exposing “modes” which extensions and attach to. This is really nice.

Another way of doing this is use neovim as a backend (in headless mode) to handle all vim operations and Nova can be a true vim editor. If this is possible, I’m 100% committed to develop such extension and maintain it. I like Nova so much, is a awesome and beautiful editor, I hope we can get this to working.

Thanks!

3 Likes

I’m using the trial now. It is awesome. But I’ve gotten so used to vim that I can’t go back to using arrows to navigate and learn another set of shortcurts. @lucastrevisan , I would be glad to help maintaining with you. I don’t ask for a true vim editor. I just want keybindings like:

  • h, i, j, k
  • w, e, b, ge, ^, $, 0,
  • .
  • search
  • d, y and their modifiers
2 Likes

Thank you! Let’s make Nova an even better code editor with vim bindings!

@logan heeeelp us! hahaha

1 Like