# Vim in multiple keyboard layout

**URL:** <https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412>\
**Category:** Support\
**Created:** [17 September 2022 16:54 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412 "2022-09-17T16:54:11Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guyc1800](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/guyc1800/32/14963_2.png) [@Guyc1800](https://discourse.joplinapp.org/u/Guyc1800)\
**Post date:** [17 September 2022 16:54 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/1 "2022-09-17T16:54:11Z")

</div>

Hi I am using Joplin editor on my fedora kde 36 laptop.  
I use the vim option in the Joplin, it works great in English kayboard layout QWERTY, but when I switch to Hebrew it doesn't work anymore, is there a way to make it ignore keyboard layout and use the key code of each key?

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [17 September 2022 20:13 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/2 "2022-09-17T20:13:47Z")

</div>

Please see [vim mode is usable only with "eng"(latin) keyboard layout · Issue #6591 · laurent22/joplin · GitHub](https://github.com/laurent22/joplin/issues/6591)

---

<div class="post-metadata">

**Author:** ![Guyc1800](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/guyc1800/32/14963_2.png) [@Guyc1800](https://discourse.joplinapp.org/u/Guyc1800)\
**Post date:** [17 September 2022 21:32 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/3 "2022-09-17T21:32:28Z")

</div>

I didnt see any solution for my problem, it seems that joplin devs uses some library for emulating vim and this library causes the issue, is there any workaround to solve this issue other use vim as external editor?.  
also after going through the chain of refs to other issues it seems that it can be solved if there was some kind of vimrc file in joplin files folder and map the keys manually

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [17 September 2022 22:45 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/4 "2022-09-17T22:45:04Z")

</div>

I just tested CodeMirror6's ViM emulation and it doesn't work (so upgrading to CodeMirror 6 wouldn't fix the issue).

It might be possible to customize vim emulation with a plugin [through CodeMirror 6's ViM emulation API](https://codemirror.net/5/doc/manual.html#vimapi) and [Joplin's plugin API](https://joplinapp.org/api/references/plugin_api/classes/joplin.html), but I don't think it's currently possible to load a vimrc-like file (but I think Joplin should add support for this).

To prevent users from having to wait for a new Joplin release, it might make sense to create a `vimrc` plugin (I may have time to work on this over the next few days).

---

<div class="post-metadata">

**Author:** ![Guyc1800](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/guyc1800/32/14963_2.png) [@Guyc1800](https://discourse.joplinapp.org/u/Guyc1800)\
**Post date:** [18 September 2022 17:25 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/5 "2022-09-18T17:25:29Z")

</div>

thank you for the help.

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [18 September 2022 22:08 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/6 "2022-09-18T22:08:38Z")

</div>

I've created a plugin ([GitHub repository](https://github.com/personalizedrefrigerator/joplin-plugin-codemirror-vimrc))! It should show up in the plugin repository in the next day or two.

![Screenshot of "custom CodeMirror .vimrc" plugin in plugin repository.](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/5/50f786bdd1da2df6ce1d648c589dca499960697f.png)

After installing, pressing `ctrl+shift+P` and searching for `vimrc` allows editing a very limited `.vimrc`-like file that supports `map`, `noremap`, `imap`, `inoremap`, etc:  
 ![screenshot of edit .vimrc in the command palette](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/b/b30116d2a18e35a6b42aec136bad59b1c4118b02.png)

---

<div class="post-metadata">

**Author:** ![Roman](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman/32/15593_2.png) [@Roman](https://discourse.joplinapp.org/u/Roman)\
**Post date:** [19 September 2022 20:08 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/7 "2022-09-19T20:08:18Z")

</div>

Hello, thanks for the plugin. I have the same problem as you have. I've set up your plugin, but it seems that it is not working. I click cmd+shift+P see popup window with text, click okay and nothing happends.

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [19 September 2022 23:43 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/8 "2022-09-19T23:43:34Z")

</div>

(I've pushed an update with several bug fixes, including an issue with comment lines — it seems to work fine in my version of Joplin that's built from source, but not in the standard version of Joplin...)

Here's my .vimrc-like file:

```nohighlight
nmap י h
nmap ח j
nmap ל k
nmap ך l

```

Please try again in a few hours (when ~~v1.0.2~~ v1.0.3 is available on the Joplin plugin marketplace).

Thank you for reporting this!

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [20 September 2022 01:44 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/9 "2022-09-20T01:44:56Z")

</div>

I set up the stable AppImage in my development environment and have fixed the issue.

In Joplin 2.8.8, lines in the `.vimrc` were read with `\r\n` separators. In Joplin 2.9.8 (the version I was testing with), lines were read with `\n` separators. My code was only handling `\n` separators. Version 1.0.3 should fix the issue by removing `\r`s before attempting to parse the `.vimrc`.

---

<div class="post-metadata">

**Author:** ![Roman](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/roman/32/15593_2.png) [@Roman](https://discourse.joplinapp.org/u/Roman)\
**Post date:** [20 September 2022 06:52 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/10 "2022-09-20T06:52:05Z")

</div>

That's working, thanks. Amazing plugin. I was struggling with this problem for months. Thank you a lot. 🙏

For people who will use this plugin it maybe not obvious how to set it:

1. Install the plugin
2. Restart the joplin
3. press cmd/ctrl+shift+P
4. type vimrc you will see the hint, press inter
5. type your commands after the text in the pop-up window

 ![Joplin 2022-09-20 09-49-36](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/9/96f9c5fc6eb19c5e51c83643688ed4333ef65fb5.jpeg)

Because the 5) item was not obvious for me.

---

<div class="post-metadata">

**Author:** ![forban](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@forban](https://discourse.joplinapp.org/u/forban)\
**Post date:** [28 September 2022 16:51 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/11 "2022-09-28T16:51:47Z")

</div>

Thank you for this useful plugin.

I have encountered an error. The search does not work when I press the / button. The logs contain the following messages:

```auto
/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:1215 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at HistoryController.pushInput (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:1215:19)
    at handleQuery (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:1359:50)
    at Object.processSearch (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:1434:15)
    at Object.processCommand (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:1261:18)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:963:37
    at runInOp (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/lib/codemirror.js:3950:28)
    at CodeMirror.operation (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/lib/codemirror.js:8647:37)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/keymap/vim.js:957:23
    at doHandleBinding (/Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/lib/codemirror.js:7161:14)
    at /Applications/Joplin.app/Contents/Resources/app.asar/node_modules/codemirror/lib/codemirror.js:7238:69

```

Dot (., repeat) also does not work.

Could you please help me to fix it?

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [28 September 2022 22:50 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/12 "2022-09-28T22:50:24Z")

</div>

Thank you for reporting this! Let's try to fix it!

For me, with

```auto
nmap י h
nmap ח j
nmap ל k
nmap ך l
nmap ñ /
unmap <Ctrl+C>

```

as my `vimrc`, pressing `/` and `ñ` to search both work. `.` also works.

(Note that re-mapping built-in mappings might not work — the CodeMirror documentation (I think) says that `unmap` only works for user-defined commands).

What keyboard layout are you using? What version of Joplin? What is your `vimrc`-like configuration file?

---

<div class="post-metadata">

**Author:** ![forban](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@forban](https://discourse.joplinapp.org/u/forban)\
**Post date:** [29 September 2022 10:42 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/13 "2022-09-29T10:42:37Z")

</div>

Today after stopping and starting Joplin (not restarting) everything worked. It may have been a false alarm.

I'll keep watching for a while longer and let you know if the error reappears.

Thanks for the wonderful plugin, it makes life a lot easier.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [29 October 2022 10:43 UTC](https://discourse.joplinapp.org/t/vim-in-multiple-keyboard-layout/27412/14 "2022-10-29T10:43:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
