Vim in Obsidian for beginners

Edit: since posting what is below earlier, I have found some decent YouTube videos and am considering putting together the sort of guide that I was requesting. But still, if anyone has a good source, please let me know. Thanks.

I am trying to learn vim and was wondering if anyone could point me in the right direction to try to efficiently learn the concepts and key bindings that are useful or operational in Obsidian.

I checked out the endless code mirror document with all the bindings and left more confused than I had arrived.

The ability to select a line with a keystroke and being able to do things like copy from cursor to end of line or go to beginning of document and even set markers to return to are all very cool.

I guess my question is, short of just reading up and experimenting with key bindings and concepts, is there a list or guide that could be useful for me to do this in a way more tailored to the specific implementation in Obsidian?

I am not expecting it to be easy, and understand there is a bit of a steep learning curve and am ready to take that on. However, would be happy to compromise for some sort of middle ground.

Thanks in advance.

3 Likes

Been tracking this thread as I’m also interested in learning Vim keybindings, but am wondering if it’s worth it, especially since I’m not a programmer/developer; I’ve also heard that the time saved from using Vim would be used up anyway from learning or tweaking Vim itself.

I’ve encountered a few resources:
https://www.openvim.com/

This article has also pointed me to the vimtutor command in terminal.

Both the Interactive Vim Tutorial and the vimtutor from terminal—with the short amount of time that I’ve spent with them—have been pretty good at teaching me the basics. I can see how fun it can be a bit. Still deciding if it’s worth spending more time on.

PS. I slightly regret not writing this in Vim.

1 Like

This is probably sacrilegious, but I don’t think it’s worth spending the time to learn Vim if you’re coming into it today. There’s definitely benefits to using it, and I still love it, but I find it frustrating when in a work environment I need to switch to systems that don’t use the key bindings anyway.

If you’re really bent on learning it, I suggest changing a bunch of things to Vim. Notably, each major browser has a Vi plugin-- they’re quite good and can train you to navigate web pages in a similar fashion to your editing experience. Similarly, I’ve modified my obsidian key bindings to be more vim like (e.g. if I have two panels, I move right with a key combo + l, and left with a key combo + h. All in all though, my recommendation is just to get adept using the keyboard to navigate your text, for example control/fn arrow to move a word, control home, end to navigate lines, etc. It’s the best bang for your buck IMO.

2 Likes

These are some of my recommendations (most are taken from my [[Vim Language]] note sources):

And I’m copying the advice I gave in discord:

I definitely recommend disabling the arrow keys if you’re really serious about learning vim. That will force you a bit into thinking in vim.

noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>

And as I said start small! First just use vim to move faster (without the arrow keys). You can learn some more magic later.

2 Likes

Thank you so much for this. You may have just given me the push I needed.

I do kind of wish the creators had also included an option for left handed letter keys for the arrows, but I haven’t researched that yet. I am sure those who are left handed and maybe more so people with disabled right hands like myself would appreciate it.

But really, I am kind of excited to take this on as I have been using just my right ring finger to type on that side for over 10 years now. I kind of gave up on relearning to type correctly, but attempting just these 4 letters seems manageable. This could very well be a turning point that gets me some dexterity back. Who knows, maybe I will eventually return to playing the piano because of this. Just typing this is giving me hope.

Honestly, above I am trying to put this out there mainly so it feels like I have made some sort of commitment.

Still, if anyone has a workaround to switch the arrows to left letters, let me know. It won’t discourage me. I will say I almost hope there isn’t. If I don’t hear back here I am going to look into it, so please don’t hold back for my sake.

This forum really is very helpful in many ways.

Thank you all.

2 Likes

I’m not sure how easy would it be to remap everything, but it should be possible to use vim one-handed. Might need some practice and some patience to learn the language/syntax and find a config that works for you!

One of the tips mentioned there are snippets, and while “the real vim” is really powerful, plugins in some editors (like CodeMirror, which is what Obsidian uses) don’t come with the full bells and whistles. You can use vim to move and use a few of the other verbs, but when it comes to snippets, I would recommend a text expander (e.g. espanso) instead.

Edit: Here is a reddit thread with some other suggestions for what to configure/remap, hope that is helpful!

1 Like

Wow. So cool that you found that.

Much appreciated!