nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3k stars 131 forks source link

Source blocks don't get highlighted correctly if indented #14

Closed akinsho closed 3 years ago

akinsho commented 3 years ago

Describe the bug

The source blocks in org files lose their highlighting if they are indented org_mode

I think maybe this section below insists that they must be at the start of the line, but perhaps should allow any amount of whitespace before it? Not sure if something like that can actually work in vim syntax highlighting. https://github.com/kristijanhusak/orgmode.nvim/blob/c81e00ad057b7564e6facb5bc7542fbb1a3349ea/syntax/org.vim#L140-L142

To Reproduce Steps to reproduce the behavior:

  1. Go to any org file
  2. Paste
    #+BEGIN_SRC lua
    local a = 5
    local b = 5
    #+END_SRC
  3. Highlight the region and indent it using >
  4. Watch highlighting disappear

Expected behavior I'm actually not sure how org mode behaves, but I believe from screenshots I can find that you are allowed to have these blocks be indented

Emacs functionality I believe it allows indentation, though I'll admit I'm not an expert and I'm not 100% sure but screenshots like this seem to indicate that it does

image

kristijanhusak commented 3 years ago

This should be fixed now. Let me know if it works.

akinsho commented 3 years ago

Thanks @kristijanhusak that works really well now 👍🏾