VIM Mode

Use case or problem

I found the vim mode today and I was happy about it :slight_smile: However, I would suggest a few improvements:

  1. When you create a new page, the cursor jumps into the title and you can type straight away. After naming the page, when you press enter, you jump to the actual content of the page - and you are in normal mode, meaning you need to press i before you can enter anything. Makes no sense - the page is empty, what should I do in normal mode here. I think we should start in insert mode right away on a new page.

  2. The same when clicking with the mouse somewhere, I think when you use the mouse already and click somewhere (not marking text), you probably want to start inserting text, otherwise you could have marked the text already with the mouse.

  3. When I’m on a list item (- ), task (- [ ] ), table row, etc. when I press o (create a new line underneath and jump there) or O (create new line above and jump there), it behaves differently as if I’m at the end of the line and press enter (does not pre-populate the new row)

Proposed solution

Either change it or make it configurable that

  1. on a new page, after setting the title and pressing enter, we are in insert mode
  2. when clicking somewhere inside a text with the mouse, enter insert mode automatically. when selecting text, keep the current behaviour (staying in insert mode or switching to visual mode if was normal mode before)
  3. o and O should behave the same way as pressing enter at the end of the line, e.g. pre-populating the new row with - or - [ ] or a new table row, and positioning the cursor in the right place. This some folks might not like, making this configurable would probably be better

Thanks for writing that up, but please post one feature request per thread. For now, I’ve moved this to help.

Here is my personal opinion (I’m not on the dev team):

  1. It kind of makes sense, but as a Vim user, I disagree. It is such a muscle memory for me to start typing by hitting the edit button I need (and not always i, at least when there is content). And you’re asking for the plugin to have knowledge about whether the document is empty or not. So now, which mode you are in is dependent on the state of the note’s content? I wouldn’t want that kind of inconsistency. And what if you do want to p or @q? Typing is not always the first thing to do.
  2. Does Vim do this? Or have any flag to enable acting that way? I don’t really know, but this also sounds like a complex set of user assumptions that would likely be very opinionated. If there are vimrc flags you can set to act this way, please list them so perhaps they can be included as supported options. Otherwise if you are trying to stray away from what Vim can do, I doubt it will be considered (not a dev).
  3. This sounds familiar. I am fairly certain an existing bug or feature request exists about this point.

Hi, thanks for the quick reply!

  1. I get your point, but for me it’s worse that you are in insert mode in the title (which I’d like to keep) and after pressing enter, you are suddenly in normal mode. TBH I rarely use vim itself, I usually use window applications with vim mode (like intellij), where you do use the mouse a bit more and also usually use the clipboard from the system, and not yanks. But that’s why I thought it should be configurable.

  2. Again, I get your point in terms of vim compatibility, but we should also consider that obsidian is used differently than vim (I’d say). Probably one could use the keyboard for that, but I use the mouse to open files, click in the place where I want to add a note and then don’t want to press i every time. I love though that while typing, I can press escape and then do selections or other things, using the keyboard. But that is probably also connected to my content, I do lots of tasks lists, or lists with some things to remember. Again, that’s why I thought it should be a config option.

  3. I did a search before, but I didn’t search for “vim o” as I expected a lot of wrong matches (being used to confluence search), but actually that gave me some existing feature requests and also a workaround:

Will try them tomorrow.

1 Like
  1. I do see your point about how if you’re in Insert mode in the title, you’d want to stay in insert mode after hitting enter. (Although you aren’t actually in Insert mode in the title. It’s not an editor view where Vim is supported. But that isn’t really something the user cares about when making the request.)
  2. I also hear you. But if it isn’t similar to standard Vim, you likely have a better chance pitching it as a plugin idea. Or if it is, specifying how you configure it, so the Vimrc wizards can suggest how you might already be able to do it.
1 Like

Regarding number 3, I got it to work :slight_smile:

plus the next comment

Looking forward to feedback regarding 1 and 2 :blush:

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