Vim mappings not working as they should

Things I have tried

I copied minimal parts of the .vimrc I use outside Obsidian for use in Obsidian and placed in .obsidian.vimrc.

Here it is:

set wrap
set linebreak
set display=lastline
set clipboard=unnamed
set spell spelllang=en_us
let mapleader = ","

noremap k gk
noremap j gj
noremap H ^
noremap L $
inoremap jj <ESC>

Three commands are not working as expected:

H ^ takes the cursor to the top of the file.
L $ takes the cursor to the bottom of the file.
jj <ESC> enters jj instead of <ESC>

What I’m trying to do

I would like H ^, L $, and jj <ESC> to function as they should.

“CodeMirror Vim bindings” is not a full implementation of Vim. Only a subset of things will work. You can search that project to research what may or may not work.

Thanks. I’ll check it out. That said, though, my minimal mappings are near identical to those the vimrc support plugin developer suggested.

I checked out the CodeMirror Vim bindings. As I said to a friend, ”Way, way beyond me”. What faint glimmers there are I have no idea what I could do with them. And there’s basic stuff that’s still more puzzling.

Especially interested in remapping H, L, and jj. The CodeMirror mappings of H and L are MoveToTopLine and MoveToBottomLine respectively. If I map H to ^ and L to $ shouldn’t that override the CodeMirror mappings? But it does not.

There are mappings of six different key combinations to <Esc>. E.g., '<C-[>', type: 'keyToKey', toKeys: '<Esc>'. It appears that some of these are for insert mode, some for normal mode. I would like to think mapping jj to one or of these would give me <Esc>. Maybe I’ll give one a try.

As I understand it, the CodeMirror mappings are not mappings in Vim but in some other editor/system to create Vim-like behavior. Can I assume Obsidian is one of those systems?

Yet another anomaly in trying to emulate Vim commands in Obsidian, at least on a mobile device. The j and k keys do not move the cursor by displayed lines but by some other measure of vertical distance. Makes them essentially useless.

And another: in reading mode the keyboard is not available for navigation within a note.

That’s on an iPhone.

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