VIM Mode - Quality of Life Improvements

I found a fix for this on Mac, In Linux it worked without any issue, but with Mac there needs to be something done first

Here’s the solution if you are in mac

2 Likes

Thanks. That fixes it. Though the vim cursor is not responsive when hold down and only take effect when the key is released.
What even more weird is that I thought I have fixed this a while ago for my vim and terminal and stuff.

1 Like

that’s really strange I never had that kind of issue, is the cursor delay only happening in Obsidian is it an issue in your terminal / vim as well?

1 Like

Oh sorry, now it worked perfectly. Not sure why but I have restart Obsidian a few time since then. Thank again.
Edit: The vim cursor run smoothly on small file, but stutter and delay on large file
As in this GIF, at first the cursor move line by line smoothly on the note on the right, but only jump when I release the key on note on the left.
Screen Recording 2021-02-06 at 16.20.22

1 Like

hey my pleasure, happy to help! It’s a bit hard to see in the gif, but I think I know what you mean.

That’s strange though I’ve never had that problem, hope someone else can suggest solutions since I’m really not sure what might be causing that lag.

2 Likes

Please implement possibility to scroll page in rendered Preview mode with j and k keys.
I scroll pages in browser, IDE, pdf readers this way

4 Likes

that’d be amazing I also use j an k everywhere to scroll, this would be great!

4 Likes

I managed to achieve these using the “Obsidian Vimrc Support” plugin:

nmap j gj
nmap k gk
nmap $ 69|
nmap ^ 0|

CORRECT: ignore me, the last 2 are wrong!

Another way to reproduce the “unexpected unfold” behavior is to create a heading that’s long enough to wrap to a second line

# This is a very long heading that will most likely wrap to two lines in the editor

This is content inside the heading

# This is a second heading

If you fold the first heading, then use J to move from that heading to the second heading, the first one unfolds.

2 Likes

has anyone figured out how to implement the ctrl + d half page down and ctrl + u half page up? i keep deleting paragraphs because of muscle memory

I just unmapped the delete paragraph shortcut , works like a charm :wink:

2 Likes

Not sure if you already found it. For me, it comes from the ‘Relative line number’ plugin. No stuttering after disabling it. v0.12.15.

I was wonder why the following commands does not work.

imap <C-f> <Right>
imap <C-f> <Left>
imap <C-e> <Home>
imap <C-[> <Esc>

love this idea; lit up a happy part of my brain to realize I might be able to follow links w gd in obsidian. I have cmd-enter set to follow links, and that works well enough for me. If you wanna use that, I’d bet exmap commands in the vimrc plugin would work. Have you tried that?

I made this mistake. it’s the capital E in Esc. I never understood how vim, neovim, or any other program knew how to interpret key IDs like these ¯_(ツ)_/¯.

I’m on obsidian v0.15.2, in case that’s relevant.

In case you’ve not seen this yet, the vimrc extension has an option for this, add clipboard=unnamed to your vimrc. Also thanks for your plugins! really really changed my life! I’ll grab u a coffee once I manifest a new income stream.


@Caketray regarding vim-surround, vimrc has a surround command that takes care of the ‘create’ part of this problem. Have you considered a mapping that would cut and paste via “[a]round” or “[i]nside” that could account for the edit/delete portions of the vim-surround toolset?

latest obsidian-vimrc-support version 0.8.0 has improved the surround functionality, bringing it pretty in line with what vim-surround offers.

There is also nunmap and vunmap command, which is able to address the need to remap j to gj, etc.

2 Likes

Got here from Googling the same thing

For those who do the same, I managed to get this working by doing:

exmap followlink :obcommand editor:follow-link
nmap gd :followlink
3 Likes