Wiki linking and concealing

Something I don’t like of Obsidian‘s Wiki links syntax is that the link is first, and the label second. So:

[[Link|Display Text]]

This breaks the reading flow, because if I write:

Whatever happened [[Daily Notes/Daily Notes 2023-11-01|the other day]]

You inevitably read “Whatever happened [[Daily Notes…” and then see the | character and then I realize, “oh, the text meant to be read was “the other day,” that makes sense now.”

This is no problem while working in Obsidian, because Obsidian will display the link as an HTML link, you read “Whatever happened the other day” and you won’t see the link. That’s great, but I spend most of my time in Vim/Neovim. I would have rather preferred if Obsidian used the other Wiki link format, which is “label first, link second.” Like this:

Whatever happened [[the other day|Daily Notes/Daily Notes 2023-11-01]]

It’s more natural to me. You read “Whatever happened [[the other day” and when you see the |character, you know it’s linking somewhere else. Reading flow doesn’t break.

Then I remembered Vim’s conceal feature. By setting up the proper syntax highlighting rules, Vim can hide the link and show only the label, just like Obsidian!

I thought there might be no need to do this from scratch, maybe there’s a syntax file that, at the very least, parses the link and label. I can go from there. I looked at Wiki.vim’s own syntax highlighting but they don’t parse the text and link part. Same with a Mediawiki syntax file for Vim. Pandoc’s syntax file for Vim doesn’t either.

Change of plans, I had to do it from scratch. I would had to learn two things: how to create new syntax highlighting rules and how Vim’s regular expressions work.

And so I did. I learnt on every little pocket of time I had, meaning, when I was sick with tummy ache at 2 AM, when singing to the kids to sleep, whenever Thais was busy baking, etc. I devoured tutorials and the Vim manual. By the way, Neovim has a better, navigable, manual.

This is how it looks like:

A screenshot of Vim, showing how my concealed Wiki links look.

It works awesome and I feel awesome! I feel like I own Vim at a new level. I’m now thinking on how to leverage this new skill and also the fact that I’m no longer at the whim of a colorscheme being almost perfect if only the Comments color were a bit darker. Now I can tweak it to my liking. And even make some new rules or copy over stuff between syntax files.

And Vim is so powerful! Everything is so very well thought out. It has the experience of years, decades of work. So the syntax highlighting can handle many things and already has solutions for things you might stumble because, in these past decades, many people stumbled with it already and it was solved. Elegantly.

Wiki linking indecision

Something I’m undecided about my personal Wiki is linking from directories. I had to reorganize entries into directories because they started to grow in quantity making navigation cumbersome.

My “problem” now is that linking from, say a Daily Note, looks like this [[../foobar]]. It breaks the natural reading flow. As in:

Yesterday I met [[../../People/Oliver Etchebarne]] and it was nice.

Now, Obsidian does something interesting. If I create a [[foobar]] link, and Obsidian doesn’t find it in the current directory, it tries to find it on every parent directory. This means you can have “clean,” good-looking links that work transparently.

So I was looking on how to make Wiki.vim do the same and there’s indeed a way to do that, I’d need to write a “resolver.”

And here’s where my indecision begins. Is Obsidian going to shape how I write notes? Because otherwise, why not just move my writing entirely to Obsidian? I know the answer to that is, “no, I want to keep using Vim.”

I only use Obsidian on my smartphone, because it’s the better Markdown editor I know of. But I refrain from using Obsidian plugins that require Obsidian to work. If I can’t parse them, read them or replicate their functionality in some capacity, then no.

For example, I use the Templater plugin because it creates files from templates, something I already did with Vim, but I don’t use the DataView plugin, because I’d only see some code declarations and query specifications, making my Wiki dependant on that specific plugin.

So, no, Obsidian will not shape how I do things. Having said that, I’m still undecided on the paths. For now, I’m keeping them relative. I don’t like them but I have writing and stuff to do.

Looking for a better Wiki

Three years ago, I tried VimWiki but it didn’t convince me. Markdown is not a first-class citizen, but VimWiki’s own syntax. It also uses its own filetype, which made me lose my Markdown customizations. HTML export is only for VimWiki’s syntax, not Markdown. It also stole the Tab mapping I use with UltiSnips.

Then I found Wiki.vim and everything is great. It’s not a filetype plugin, so I can keep my Markdown filetype. It doesn’t overwrite my mappings. It uses Pandoc for export, which is great. It has FZF integration. It has tags, not sure if VimWiki have them too, and I haven’t tried them yet.

I still use it, three years later and now I want to improve some things.