Even simplest vim eludes me

What I’m trying to do

I’m a noncoding writer who had/has a comfortable configuration of MacVim for writing on my notebook. The promise of Vim with Obsidian is powerfully appealing, but it continues to elude me.

Things I have tried

j and k are configured to move down/up a screen width line. I don’t remember a problem with them, but yesterday I could not predict what they would do.

I’ve appealed for help getting H and L configured to ^ and $ and jj to <Esc> But none of the much appreciated suggestions have worked.

This is my minimalist .vimrc:

set clipboard=unnamed

inoremap jj <Esc>
nnoremap <Up> gk
nnoremap k gk
nnoremap <Down> gj
nnoremap j gj
nnoremap H g^
nnoremap L g$

I sense many have been able to get this and much more working. Explanations/insights/suggestions appreciated.

AFAIK the vim mode of Obsidian can’t be configured out of the box, however this plugin allows to configure part of it.

I’m trying to replicate a small part of my config too and this seems to support most basic things. Something I’ve not succeed on is mapping

inoremap jj <ESC>

but maybe there’s some special way to do it that I’m not aware of.

Escape needs to be written like Esc

And inoremap isn’t supported by the vimrc plugin, I use imap.

2 Likes

Nice! that works like a charm! thank you!

I edited my .vimrc. It looks as below:

set clipboard=unnamed

imap jj <Esc>
nmap k gk
nmap j gj
nmap H g^
nmap L g$

I also moved my .vimrc. I had it in the .obsidian folder in the Obsidian root folder. I moved it to the .obsidian folder in my vault.

None of those mappings seem to be working.

jj enters jj. j and k move the cursor from either the first character in a paragraph or the last position of the cursor and either the next blank line or last blank line. H and L move the cursor to the top or bottom of the file.

Things that seem to be working for others are not working for me.

Hallelujah! Two changes: changed the name of my .vimrc to .obsidian.vimrc; moved the renamed file from the .obsidian folder in my vault into the vault itself, i.e., on the same level as my md files. All my mappings, including of <Esc>, work.

I thought that when people wrote .obsidian.vimrc they meant the .vimrc in the .obsidian folder. So all this time–it’s been a couple weeks at least that I’ve struggled with my vim keybindings–the problem was the name and the location of the file.

1 Like

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