Support loading Vim commands from configuration (vimrc-style)

No worries @hanjae87 , it’s a hidden file which makes it confusing.

It’s a file at the same level as .obsidian (root folder with the rest of your notes)

It follows the same concepts as the .obsidian folder, but the .obsidian.vimrc is a file not a folder.

I wrote a blogpost on .obsdian so it’s not exactly the same, but it will definitely help you out

Let me know if you got any questions, since I know these things can be confusing

1 Like

Dear @santi,
Thank you for the explanation!
Unfortunately, I still can’t seem to find the .vimrc file anywhere.
I turned on the option to view hidden files as well.
Would I need to create/touch this file or is it automatically created?

The odd thing is I see the .obsidian file whether or not I have the option to view hidden files toggled on or off.

Thank you again!
HJ

1 Like

No worries, so you need to create the file. It won’t be there by default.

It has to be named .obsidian.vimrc

Let me know if it worked for you

Dear @santi,
I created the vimrc via vscode, and it is working like a gem now!
Thank you so much for your support!!
HJ

1 Like

perfect happy to know you got it working!

Replying to myself: the Autocomplete plugin by Yeboster does exactly this, and it’s great.

Hi santi, I’ve been trying to get my escape key mapped to jk. It is something that I’m familiar with - I have inoremap jk <esc> mapped in my .vimrc file, and map jk <Esc> in my .ideavimrc for PyCharm.

For some reason, I’m struggling to get it working with Obsidian.

I’ve followed the instructions so that:

  1. Editor → Vim Key Bindings is Enabled.

  2. Comunity Plugins → Vimrc Support is Enabled

  3. In the root of my vault, I’ve created a file called .obsidian.vimrc and inside this file I have just these two lines

imap jk
imap jk

  1. Restart Obsidian (v.0.12.3)

Is there a step that I am missing?

Thanks.

Resolved - I was editing .obsidian.vimrc on my vault that was located in a different location.

I have the same vault on DropBox and iCloud. I recently moved it to iCloud so that I can continue to work on Obsidian mobile … Anyway, I was making a change to.obsidian.vimrc on my Dropbox vault, but opening up the vault on iCloud.

For others that may encounter this issue, one of the things I found helpful was to type in the command in obsidian.

So, in obsidian, I typed in : imap jk <Esc> and verified that this worked. When it did, I found it strange that the change was not persistent when obsidian restarted. So that’s when I realized that the change I made was not the right .obsidian.vimrc file.

1 Like

Just putting this solution to a common problem here so that it can be found.

On Windows, Ctrl-C needs to be remapped to make it copy selected text in vim mode. Several people recommend putting unmap <C-c> into the .obsidian.vimrc file but that does not work.

What works is iunmap <C-c> — the troublesome mapping is only operative in insert mode, so you need to unmap it with a preceding i

2 Likes

Sorry,I am working on the Windows, but I Set “Vimrc file name” = “C:\Users\ryanzhuo.obsidian.vimrc”, i put the file named “.obsidian.vimrc” which has been written “set clipboard=unnamed”, but it didn’t work.

anybody can tell me what’s wrong in my settings?

Yes: if you typed C:\Users\ryanzhuo.obsidian.vimrc literally, it won’t work. You need to set the vimrc file name to C:\Users\ryanzhuo\YOURVAULTNAME\.obsidian.vimrc — with a slash after ryanzhou\YOURVAULTNAME and a period after that. (assuming that your vault isn’t just called ryanzhou!)

I might type the wrong settings before, could you please tell me if it works on the Win10?
here are my screen shots:


That looks certainly wrong, because the .obsidian.vimrc file needs to be in the root folder of your vault, not in your home directory.

1 Like

Omg!!!, You are right, Thanks a lot, I found what’s wrong in my settings, It works when I put the file into the workspace, which is the vault you mentioned. I am unfamiliar to Obsidian’s terminology,Such as vault, But I will Keep learning, Thank you for teaching me.

1 Like

imap jk <Esc> worked before 0.13.14 version. With latest preview version does not work any longer. Has anyone found a solution already (was too nice when it worked)?

Did you update the Vimrc plugin to its latest version (0.5.1)?

I noticed the the return key does nothing in normal mode. In all my other vim instances it goes to the beginning of the next line w/o leaving normal mode. Any idea how to get this working in Obsidian?

Just to be clear, Vim keybindings in Obsidian is not an instance of Vim. It is a partial implementation based on a CodeMirror project. More context here: "Unknown option: whichwrap" message in vim mode - #2 by rigmarole

(I don’t know how to get it working. There might be a way. But just remember it isn’t a full-featured Vim. You might have to make a feature request on that project.)

1 Like

What do you need to put into .obsidian.vimrc to start Obsidian in Insert Mode? Neither start nor set insertmode seem to work.