nvim-FeMaco.lua
nvim-FeMaco.lua copied to clipboard
Incorrect indentation in org-mode
Reproduction
- Enable indentation in org_mode (default) or set
org_indent_modetoindent - Create at least two levels of headlines and add a src block (see example below)
- Invoke the FeMaco binding on the src block
- Update the src block content indentation (like
ggVG=) - Use the
:wqcommand to write and replace prev src block
Example
#+title: Org FeMaco Indentation Repro
* Heading 1
** Heading 2
#+begin_src fennel
(let [x 5]
(+ x 2)) ;; Purposefully incorrectly indented
#+end_src
Expected
The indentation level after saving the FeMaco buffer should respect the original org-mode src block indentation
* Heading 1
** Heading 2
#+begin_src fennel
(let [x 5]
(+ x 2)) ;; Now correctly indented
#+end_src
Actual
The indentation level does not reflect the org-mode src block indentation:
* Heading 1
** Heading 2
#+begin_src fennel
(let [x 5]
(+ x 2)) ;; Now worse than before :(
#+end_src
Workarounds
- For now I've just set
org_indent_modetonoindent
I think the built-in orgmode edit special does indent correctly, but not sure how applicable to this tool it is:
https://github.com/nvim-orgmode/orgmode/blob/313ce5a04e7fc3d677ad906a94fc49c1f54d1572/lua/orgmode/objects/edit_special/init.lua
FeMaco is way nicer though. The official just opens a split.
Thanks for the thorough issue @eccentric-j, I'm quite busy atm and have not unfortunately been able to look into this yet.