Closed milanglacier closed 5 months ago
Perhaps relevant: https://github.com/neovim/neovim/pull/18317
Perhaps relevant: neovim/neovim#18317
I think we will have to wait for this to be done before we proceed
It looks like this is actually possible with captures: reddit link
For org, adding this to my after/queries/org/injections.scm
file aliases py to python:
(block
parameter: (expr) @_lang
(#match? @_lang "^[pP][yY]$")
(contents) @python
)
nvim treesitter has implemented this feature for markdown:
https://github.com/nvim-treesitter/nvim-treesitter/pull/4659
perhaps the samething can be done for org?
Added the same values that were introduced in that PR d2fde796eec52d9ecc4ac045a6d1b3bff83cbfe7
Does this feature exist in Emacs orgmode core?
Yes
Orgmode link
https://orgmode.org/manual/Editing-Source-Code.html
see
org-src-lang-modes
However, note that
org-src-lang-modes
has no effect fororg-babel
, to successfully execute code block, the language name must exactly the same with what pre-defined by emacs -orgmode.Feature value
No response
Additional context
AFAIK orgmode-nvim uses treesitter injection to highlight code block. However the problem is that the language name of the code block must be exactly the same with the treesitter counterpart (for example r in treesitter and R in emacs). However, many of the counterpart are not the same with the language name in emacs. In emacs you can configure
org-src-lang-modes
to alias language name for highlight.But for org-babel, you cannot do that. A code block that can be successfully executed by Org-babel must have the same language name pre-defined by orgmode: https://orgmode.org/worg/org-contrib/babel/languages/index.html otherwise it will issue an error: "org-babel-execute-src-block: No org-babel-execute function for xxx!"
Thus I think it would be better if language code block can be aliased in nvim-orgmode.