Vim plugin for codeMirror

I’m afraid I can’t see any vim effect with the vim plugin for code mirror. nothing seem to works.

code mirror is working, and I have other codeMirror plugins doing their stuff.

Firs off, I can’t quit the insert mode. Escape cancels the editing. I modified my keymap on the system level so that I now use the caps lock key to produce the escape char. This does not solve my problem.

I noticed the thread called “CodeMirror Keymap VimJK: supprot jk binding” but I can’t see anything I can use there. The jk trick I already saw but here I have not vim per se. I tried inserting ,{keys:"jj",type:"keyToKey",toKeys:"<Esc>",context:"insert"} in $:/plugins/tiddlywiki/codemirror/keymap/vim.js and reloaded but this doesn’t allow escaping insert mode by quickling typing jj. In fact, I wonder wether that’s vim-like insert mode or a complete failare of vim mode to launch itself…

1 Like

You can use ctrl-[ to escape.

I’m using the standard code mirror/vim setup.

Everything works pretty much as expected, including keystroke recording and registers. But I wish there was a way to retain the keystrokes between sessions. Also, that there was a way to insert tabs without leaving the text field, but I haven’t researched it much.

1 Like

jj or jk are required to quickly press to exit the insertion mode, ctrl c can also exit the insertion mode。neotw/vim-js.tid at 0ec09dd57ccb4803e335de2a8b1e343411527d14 · oeyoews/neotw · GitHub Maybe you’re still missing a line of code like this, jj needs to be pre-set twice

You can actually modify the escape mapping to use shift escape instead of tw’s escape

Sorry but definitely, as I click on the edit button, I am NOT in normal mode, but in insert mode or not in a vim setup to be frank. If I hit the * key, I am not making a search but plainly inserting “*” which is symptomatic.

Note also that I use a French keymap (bépo variant). So no ctr-] for me. but I was able to have a special key for escape. it is just tgat escape always make me leaving the whole edition process.

so yes! vim mode does not work for me.

If that’s important, I’m using the server mode of tw. And it’s running with podman quite nicely on my linux box.

maybe you forgot to change the codemirror keymap

1 Like

@oeyoews YES!!! It was that, my forgetting to change the codemirror keymap to vim!

This may be because I’m not anglophon, but I find it awkward to call that parameter a “keymap”. Strictly speaking, my keymap has not changed. what has changed is the interpretation of key events. a “key input handler” would have been clearer. I would also gave thought that the default “keymap” would have been set correctly by the vim plugin.

Now, I do my vim-escape with Ctl-C.

Just tried :q! to leave without saving my changes. That command is not recognized. Is there a way it could be (a matter of config or a matter of development)?

. this all supported mapping for vim. neotw/vim-js.tid at 0ec09dd57ccb4803e335de2a8b1e343411527d14 · oeyoews/neotw · GitHub

Hum. not really handy to look for stuff there. And especially when you don’t really know how it’s called. I’m looking for ctrl-n to complete a word with what has already been typed (and if possibly use tab instead of ctrl-n) as it’s so easy.

Control-space will complete a word in CodeMirror, including insert mode in Vim.

1 Like

@Mark_S Thank you. My basic needs are met. :smiley:

How did you get vim to show up as a key map?
I’ve tried importing the vim keymap .js - as well as the .tid version of that - but I still just see the ‘default’ key map in CodeMirror.
And does this require CodeMirror 6?

I’ve done a bunch of searching online, but haven’t found any tutorials etc on getting the keymap to show up in that drop down.

Thank you!

@baiguai Sorry for the late answer. I have only those tiddlers for all my vim stuff:

  • $:/config/codemirror/keyMap with a text of vim and a type of string;
  • $:/plugins/tiddlywiki/codemirror-keymap-vim

Is that helpful to you?