Been a While

Been a While

So. Nvim 0.12 dropped and kind of made neorg die.

What the hell, Neorg?

This blog is written using norg, a neovim org mode analog. For those of you unfamiliar with emacs terminology (ew), org mode is basically what jupyter notebooks were written with before jupyter notebooks existed. It's an enhanced markup language that relies heavily on lisp, the scripting language for emacs, in order to do some really cool stuff.

For starters, you can write and run code directly within the file, which is pretty useful if that's what you want do do I guess. However, because of how emacs works, this isn't limeted to a certain file type. Let me explain.

Emacs is really cool, but also awful

Emacs, as far as people have told me, is a glorified lisp interpreter. Of course, you have your config, like in neovim, but unlike neovim, emacs has near to no limits. For starters, there's no lua api nonsense. In the same way that everything on linux is a file, everything on emacs is a mode. There are major modes, which are analogous to nvim's insert and command modes, and then minor modes, which alter the functionality of a major mode. But, this isn't just limited to the text buffer. When I said everything, I meant everything. The menu bar is a minor mode for the window, which itself is technically a mode. The buttons within the bar are minor modes, too! The cursor is a mode, the font is a mode, you get the picture. All of these modes are accesible at runtime, through the equivalent of the command pallete, alt-x.

Anyway, the point I'm trying to make is that emacs is for insane people. If you ever wanted to edit text in the title of the window as if it were an intentional feature (totally possible, the window title is just a buffer), then emacs is the editor for you. This extensible nature is what lets org mode exist. The features are just as insane as emacs itself. It starts simple, with being able to fold sections based on structured headings, but then extends to transparent tables, that have full function support that you would expect from something like excel. Not to mention that the whole file can be exported natively to html or latex with the click of a button. All of this within a text editor, may I remind you. So, what does this have to do with whatever I'm talking about?

Neorg is a step in the right direction

Neorg is supposed to be a replacement for this incredible power, just in neovim. The concept is simple, just rewrite everything in lua, right? Wrong. Unlike emacs, neovim config is surprisingly restrictive. Emacs itself is basically written in lisp, which is what makes it so powerful. Of course, there's some baseline c code to interpret the initial steps, but the rest is custom built. That means that everything the developers can do, an end user can do just as easily. There's nothing stopping you from writing a whole new text editor in lisp, or even something more complex (check out exwm, a whole ass window manager in lisp). It goes without saying that neovim has nowhere near the extensibility to be able to make a whole window manager, which makes it much harder to make an org mode replacement.

In nvim, you're stuck with whatever the devs give you, through the lua api. This is enough to make something like Telescope, or a dired ripoff like oil.nvim, but comes way short when trying to rival emacs in extensibility. For instance, when making a plugin, especially something to do with filetypes, many of the features found in org mode (folding, embedded code blocks) don't have proper implementations. There are folds in nvim, but they rely on treesitter and lsp heavily, meaning that before long your dependancy tree is insane, and you need 5 different plugins just to highlight the headers and embed properly. Emacs? Of course, they have an entire treesitter implementation written in lisp, that also defines languages in lisp, which means that it can be configured at runtime.

Damn, I might have to switch to emacs.

The neorg problem

Neorg is an incredible project. It works how I want it to, basically as a better markdown, but that means that most of the plugins I'm installing are useless to me. For one, norg refuses to work at all without treesitter. Due to lack of compliancy with the new spec, all neorg users are forced to use the old master branch for treesitter, because the main branch no longer accepts scanners written in cpp. Take a wild guess what language the neorg scanner is written in. The plugin also has an lsp, for all 4 of the different blocks, one of which isn't even implemented, meaning I have to install a whole lsp stack, which is about 10 plugins by itself, depending on what you use. Neorg also isn't supported on 0.12, meaning that you have to use an old version of neovim on a seperate config, and set up lazy because vim.pack isn't supported yet. And then there are the non-negotiable plugins that I use on neovim just to edit files, adding about 10 more random quality of life features (I'm not editing anything without my mini.surround).

This still isn't counting Latex support, by the way, which was a norg feature, but now has to follow a different spec because their renderer broke. They now advise using snacks' renderer, which works, but adds another plugin and messes up the syntax highlighting for said latex, or sometimes just doesn't highlight at all. Not that latex is implemented on this website, anyway.

Right now, I have 40 plugins, just to edit a markdown file. To someone who prides themselves in having a clean config, the whole setup feels bloated and slow.

The theoretical solution

I could write my own nonsense file type, but I don't have the time or knowledge to come up with anything remotely functional. On top of making a whole file type, spec and all, from scratch, I would also basically have to write a static site generator for it, so that I could keep writing this blog, as well as make some kind of transition script so that I can move all of my notes that are written in neorg over to whatever file type I would end up making. Did I mention I've never even made a neovim plugin?

The real issue is lack of support. Nobody cares about a niche replacement for an already niche file type on a specialist editor, which means that nobody wants to rewrite the treesitter integration so that it's compliant with the main branch, nobody wants to make a proper lsp and find some way to distribute it, and nobody wants to implement tables properly for all of the four people out there that would use them. Other than the creator of the site generator I'm using, Norgolith, I might be the only person on the internet writing a blog in norg. There are alternatives, but they suffer the same problem of overbuilding and the same lack of modularity. Projects like orgmode for nvim exist, sure, but all the site generators for proper org mode files are intended to be used from within emacs, meaning that I can't easily publish anything anyway.

What I've been forced to do for now is clone an older version of my repo and use that config. After gutting out all of the lsp nonsense and some code-specific plugins, everything works as intended again, as is the intention with flakes. Just load up the nix shell and have everything as you left it.

Some kind of resolution

After messing about with svelte, I might just make a typescript norg parser and turn this blog into a dynamic site. For starters, I could remove the direct norgolith input from my flake, which I don't particularly like, and I would also have full control over the look, unlike whatever stolen theme this is, just refreshed with a catppuccin css file. Worth looking into, but, for now, norg is here to stay. Atleast until I get bored.

Next up: why I hate neovim

See ya!