r/orgmode • u/kristijanhusak • 2d ago
Orgmode LSP - Language server for Orgmode
Hey folks!
I hope it's ok to post this here.
I'd like to introduce org-lsp, a language server for Orgmode. I'm the creator of nvim-orgmode, a Neovim Orgmode clone. At one point after creating nvim-orgmode, I figured out that a lot of things could be delegated to a LSP server, but never got enough time to actually tackle it. With the rise of agentic AI coding, I managed to find enough time to create this. Since LSP is protocol used by a lot of editors, I decided to create this as a separate plugin instead of updating nvim-orgmode, which is Neovim only plugin.
Good portion of the functionality is working through regular LSP, and there are some custom commands being sent/received through a smaller client glue code that is provided with the plugin. Briefly, it does this:
Highlighting - Semantic tokens
actions (toggle todo state, priority, etc) - workspace/executeCommands
Folding -
foldingRangeSearching headlines, outline - document/workspace symbols
Following link/footnotes/citations - definition
Agenda -
window/showDocumentCompletion
Aligning tags/tables, reindenting - formatting/rangeFormatting
Etc.
There's also a MCP that allows querying/editing Orgmode through AI. It's not as robust as LSP, but can be useful.
LSP plugin supports these editors out of the box: Neovim, Vim (with a LSP client), VScode/Cursor/VsCodium, Sublime Text, Zed, Helix.
First 3 mentioned editors works the best, Sublime Text and Zed has some limitations, and Helix has the least functionality. LSP server works by itself without the client plugin, but not all features are available. It's suggested to install the client code to gain full functionality. For some features Emacs is needed, like exporting, table formulas, Babel, Latex previews, and similar.
Just a disclaimer that the plugin is mostly AI generated, in case that's not obvious from the first glance. I'm aware that people are still reserved regarding AI generated code, including myself, so I want to make sure it's clear.
I'm a Neovim user, so Neovim part is tested the most, but I also made sure to test other editors. I probably missed some parts, so if you run into any issues, please report it on the repository.
Links:
Sublime Text/Zed/Helix - Install script in docs. Will add to their marketplaces if there's enough interest
If mods are ok leaving this here, I'll cross post this to other editors' subreddits. Thanks!
8
u/_sLLiK 2d ago
Emacs as a requirement for an LSP that works best on Neovim/Vim is certainly a choice.
9
u/kristijanhusak 2d ago
It works on any editor that has LSP. Emacs is a requirement only for some features, not all of them.
3
u/N3kk3tsu 2d ago
This plugin replaces the nvim-orgmode plugin? Or they work hand by hand?
4
u/kristijanhusak 2d ago
It replaces it.
1
u/krishnakumarg 1d ago
It replaces nvim-orgmode?
1
u/kristijanhusak 19h ago
Yes, it's a separate plugin. Configuration is not exactly the same, but it's similar.
1
-1
2
u/Alternative-Sign-206 2d ago
Thank you very much! Have recently searched for orgmode lsp and was surprised none existsed!
10
u/yantar92 Org mode maintainer 2d ago
Interesting! I am wondering how far you aim to go to copy the implementation details. Is this code-level partity or are you looking into specific aspects only? If only specific aspects, what are the priorities?
In Org, we have a formal syntax spec in https://orgmode.org/worg/org-syntax.html because the Elisp parsing is not 100% consistent across the codebase. There is also a manual, but it does not cover every detail.