Zettlr: Hope to support vim shortcut :)

Created on 22 May 2019  Â·  4Comments  Â·  Source: Zettlr/Zettlr

Totally, I think this application is great.
However as a Linux user, I very miss the vim shortcut. Maybe someone has the same feeling too. May I ask the developer would you plant to add vim support as a new feature ?
Thanks again for your awesome job !

Most helpful comment

Support for a vim mode in CodeMirror seems to be not so good:

Note: The CodeMirror vim bindings do not have an active maintainer. That means that if you report bugs in it, they are likely to go unanswered.

Anyways, I'll think about it. If anybody who knows vim would like to give it a try, please report back here! Activating vim mode is rather easy:

  1. Open up the developer console in Zettlr
  2. Then execute require('codemirror/keymap/vim')
  3. And then renderer._editor._cm.setOption('keyMap', 'vim')
  4. Now you can use the vim mode.

Reference: https://codemirror.net/demo/vim.html

All 4 comments

Support for a vim mode in CodeMirror seems to be not so good:

Note: The CodeMirror vim bindings do not have an active maintainer. That means that if you report bugs in it, they are likely to go unanswered.

Anyways, I'll think about it. If anybody who knows vim would like to give it a try, please report back here! Activating vim mode is rather easy:

  1. Open up the developer console in Zettlr
  2. Then execute require('codemirror/keymap/vim')
  3. And then renderer._editor._cm.setOption('keyMap', 'vim')
  4. Now you can use the vim mode.

Reference: https://codemirror.net/demo/vim.html

I gave a simple try on the vim mode. And two small issues:

  1. The 'Ctrl-f' is still 'find' instead of 'PageDown'. Other shortcuts I have tried work fine.
  2. The status/shape of the cursor keeps the same in normal(command) mode and insert mode. In normal mode, the cursor usually shows a flickering block rather than the normal flickering line. It will help us to know the current mode we are using(but not very crucial).

It's an excellent software!

To point 1: It's because I override the keymap with some keys, refer to this file to know which ones!

To point 2: Yeah, I didn't implement the necessary CSS styles, as I don't officially support these (yet) — If you have an idea, please feel free to PR!

I would love to have option to enable vim mode in the settings. I've tested the suggested method and it actually makes the app usable to already broken Vim user like myself. There are just two small things I need personally to make this way better.

  1. When in normal mode (vim) the caret should be a block style so you could tell you're in normal mode. When in insert mode - switch back to pipe style caret.
  2. For a variety of vim motions the ability to see line numbers is actually useful to reformat whole blocks of text. So a support for line numbering, relative line numbering and hybrid line numbering will bring all that joy back.

Can we at least have the option in the settings as an experimental feature so we can actually use it without manually executing commands in the developer console?

Was this page helpful?
0 / 5 - 0 ratings