obsidian-vimrc-support icon indicating copy to clipboard operation
obsidian-vimrc-support copied to clipboard

Need help with simple remap

Open EricEWeir opened this issue 1 year ago • 7 comments

I'm a noncoder trying to implement simple vim-mode mappings. They are:

set clipboard=unnamed
map k gk
map j gj
map H ^
map L $
map jj <ESC>

The H and L remaps don't work. Neither does the <ESC>. remap.

I started with noremap mappings. On suggestions encountered here I also tried imap and map. With <ESC> I also tried inoremap I'm guessing none of the is right for <ESC>.

Help appreciated.

EricEWeir avatar Feb 07 '23 17:02 EricEWeir

Have a try as below:

nmap H ^
nmap L $
imap jj <Esc>

jiyee avatar Feb 08 '23 02:02 jiyee

for this mapping:

map jj <ESC>

perfectly work this one

imap jj <Esc>

karpovichpv avatar Feb 09 '23 05:02 karpovichpv

I have these:

nmap H ^
nmap L $
imap jj <ESC>

nmap H ^ Takes cursor to top of file. nmap L $ Takes cursor to bottom of file. imap jj <ESC> Enters jj

I have vimrc-support plugin enabled. Also Obsidian vim key bindings.

EricEWeir avatar Feb 09 '23 15:02 EricEWeir

If anybody has a clue about why these key bindings aren't working for me I'd greatly appreciate help. I gather they work for others.Especially miss the <ESC> binding on my mobile devices.

Again, Obsidian's vim key bindings and the vimrc-support plugin are enabled on all devices.

EricEWeir avatar Feb 21 '23 17:02 EricEWeir

If anybody has a clue about why these key bindings aren't working for me I'd greatly appreciate help. I gather they work for others.Especially miss the binding on my mobile devices.

Again, Obsidian's vim key bindings and the vimrc-support plugin are enabled on all devices.

Hello, try this:

  1. Create file .obsidian.vimrc
  2. Write in this file next lines:
imap jj <Esc>
nmap H gg
nmap L G
  1. copy this file to your current obsidian vault-folder
  2. switch on vim mode
  3. reload the program

karpovichpv avatar Feb 21 '23 18:02 karpovichpv

Thanks. I tried it. Same results.

gg and G don't need to be mapped. It seems they're already provided for in Obsidians native vim mode

EricEWeir avatar Feb 21 '23 23:02 EricEWeir

Hi @EricEWeir, I had a similar issue, and I cannot reproduce how I fixed it, but I will share my experience. I had a .obsidian.vimrc with:

nmap j gj
nmap k gk, both worked
a few lines below, I had
imap  jk <Esc>, and jk in insert mode didn't work.

I had a combination of issues: I wrote originally "ESC" instead of "Esc", corrected and no changes. My configuration started to work once I moved the imap jk <Esc> line at the beginning of my .obsidian.vimrc, and I commented the nmap lines. What is interesting is that I moved back to where it was originally, and I uncommented the nmap lines, and all mappings works without issues.

I have Obsidian v1.1.15 installed with Vimrc support plugin 0.9.0

fmontagut avatar Feb 27 '23 15:02 fmontagut