# Vim: O and o should respect/understand current context (lists)

**URL:** <https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386>\
**Category:** Feature requests\
**Tags:** vim\
**Created:** [November 26, 2022, 7:06pm UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386 "2022-11-26T19:06:19Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![axwell](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@axwell](https://forum.obsidian.md/u/axwell)\
**Post date:** [August 11, 2024, 8:48am UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/23 "2024-08-11T08:48:36Z")

</div>

> [@anon56682183](#):
>
> ```auto
> " Make o and O respect context
> exmap blankBelow obcommand obsidian-editor-shortcuts:insertLineBelow
> exmap blankAbove obcommand obsidian-editor-shortcuts:insertLineAbove
> nmap &a& :blankAbove
> nmap &b& :blankBelow
> nmap o &b&i
> nmap O &a&i
> 
> ```

doesn’t work for me as of now, pressing o just enters insert mode instead. any idea how to fix?

---

<div class="post-metadata">

**Author:** ![michaelpiazza](https://forum.obsidian.md/user_avatar/forum.obsidian.md/michaelpiazza/32/70770_2.png) [@michaelpiazza](https://forum.obsidian.md/u/michaelpiazza)\
**Post date:** [September 9, 2024, 5:08am UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/24 "2024-09-09T05:08:34Z")

</div>

I also had the same issue initially - you need to install the code editor shortcuts plugin that pseudometa mentioned earlier, then it will work.

---

<div class="post-metadata">

**Author:** ![PerryZ](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/p/b5a626/32.png) [@PerryZ](https://forum.obsidian.md/u/PerryZ)\
**Post date:** [October 19, 2024, 6:00pm UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/25 "2024-10-19T18:00:29Z")

</div>

Hi, it seems like this workaround has been broken on v1.7.4.  
When pressing `o` or `O`, the command `blankAbovei` or `blankBelowi` appears on the vim command bar.  
 ![Screenshot 2024-10-19 at 10.58.35](https://forum.obsidian.md/uploads/default/original/3X/4/3/43179db77e1aa7d3c94f55796fee88c2bc93a3fd.png)

 ![Screenshot 2024-10-19 at 10.58.46](https://forum.obsidian.md/uploads/default/original/3X/e/9/e9fab01fd5cb1697e880e8f5445041f0fb2ce06f.png)

It seems like Obsidian changed the way of interpreting multiple vim commands, and the `o` and `i` commands are concatenated together, which cannot be recognized.

Does anyone have some further workarounds for anychance?

---

<div class="post-metadata">

**Author:** ![obsequious](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/o/4af34b/32.png) [@obsequious](https://forum.obsidian.md/u/obsequious)\
**Post date:** [October 19, 2024, 7:16pm UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/26 "2024-10-19T19:16:40Z")

</div>

@PerryZ Yes, check out [How does one insert a literal newline (or carriage return) in a mapping? · esm7/obsidian-vimrc-support · Discussion #239 · GitHub](https://github.com/esm7/obsidian-vimrc-support/discussions/239)

---

<div class="post-metadata">

**Author:** ![PerryZ](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/p/b5a626/32.png) [@PerryZ](https://forum.obsidian.md/u/PerryZ)\
**Post date:** [October 21, 2024, 10:07pm UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/28 "2024-10-21T22:07:59Z")

</div>

thank you so much for that; it’s fixed

---

<div class="post-metadata">

**Author:** ![michaelpiazza](https://forum.obsidian.md/user_avatar/forum.obsidian.md/michaelpiazza/32/70770_2.png) [@michaelpiazza](https://forum.obsidian.md/u/michaelpiazza)\
**Post date:** [October 24, 2024, 2:12am UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/29 "2024-10-24T02:12:14Z")

</div>

For fellow vimrc noobs / lazy people such as myself, the fix for 1.7.4 (removed the 2 intermediate mappings as well):

```auto
  exmap blankBelow obcommand obsidian-editor-shortcuts:insertLineBelow
  exmap blankAbove obcommand obsidian-editor-shortcuts:insertLineAbove
  nmap o :blankBelow<CR>i
  nmap O :blankAbove<CR>i

```

---

<div class="post-metadata">

**Author:** ![crazybilly](https://forum.obsidian.md/user_avatar/forum.obsidian.md/crazybilly/32/81571_2.png) [@crazybilly](https://forum.obsidian.md/u/crazybilly)\
**Post date:** [June 18, 2025, 2:25pm UTC](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386/30 "2025-06-18T14:25:10Z")

</div>

And for the fellow lazy scroll-to-the-bottom-ers. You’ll need two plugins:

1. **Code Editor Shortcuts** - you can just install this, no need to configure
2. **Vimrc Support** - read the docs about where your .obsidian.vimrc goes and put Michael’s lines there

[Previous page](https://forum.obsidian.md/t/vim-o-and-o-should-respect-understand-current-context-lists/48386.md?page=1)
