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.

Mike Portnoy is back!

Mike Portnoy is back as Dream Theater’s drummer! I can’t believe it!

Just read the news and, really, I still can’t believe it! I feel bad for Mike Mangini, tho, he’s a terrific drummer but he was in the very uncomfortable position of filling Portnoy’s shoes and pleasing the fans. I remember being very skeptical anyone could replace Portnoy and Mangini proved me wrong with his powerhouse audition, but I then found his live performances lacking and eventually lost interest on the band.

I never imagined Portnoy would be back after 13 years! Looking forward for their new album!

Drawing for fun

I’m reading Bakuman again.

It’s a manga about two kids and how they reach their dream of becoming professional manga artists (mangakas). It’s very inspiring and often very meta. The story and art are phenomenal; it’s one of my all-time favorites.

In the current arc, both kids are running on empty. Mashiro, the artist, accepts a temporal job as their rival’s assistant, with the goal of breaking the rut and find a solid idea for their next manga. He finds it by being reminded how much fun he had when he was a child, drawing nonstop and imagining story concepts and characters.

I paused reading and reminisced on my own childhood and how I also drew a lot and enjoyed it. I drew armies, cartoon and video game characters, spaceships, robots and martial artists. I once drew a complete comic, full color, with a cover, something close to 30 pages.

In other ocassions I played by drawing. No panels, just characters and fighter jets flying all over the page, raw action in real time, with no care of layout, fast, loose and incomplete — just enough lines to suggest the missile lock in the HUD or have the character talk (no written dialogue, I made all the voices!). It was a complete mess and chaos, but immensely fun.

I’m trying to tap into that childhood playfulness and boldness I’ve since lost. While pondering on this, I remembered my frustration wanting so badly to draw The Real Ghostbusters’ Slimer and failing no matter how many times I tried.

It took a bunch of decades, but I finally can.

Here’s the JSON Feed

This blog now has a JSON Feed, so I can be added to Icaplanet!

Icaplanet is an old Planet, a feed aggregator, written by Oliver which used to aggregate many blogs from Ica-based friends, long before social media took over the internet. I believe things will go full circle someday and blogs will come back.

So, Oliver is reimplementing Icaplanet and he’s using JSON Feed instead of plain old RSS. The domain was about to expire and he asked me if he should renew it. I have other priorities right now, writing on my blog is not on my short-term plans, but I don’t want Icaplanet to go the 99ovejas.com way (that’s a story for another day) so I said yes and I might post sporadically, no promises.

Oh yeah, feed’s here: https://jgwong.org/blog/feed/json

You can add me now, dude!

It pays to be curious

Zoom expired my password and forced me to change it, something about a third party being compromised. I generated a new one on my password manager and, lo, it didn’t allow me to paste it. Zoom wanted me to type by hand my new long, random password.

I had an immediate solution: sleep 1s; xdotool type $(xclip -o -sel c). There. Password typed.

It’s one of those moments where it pays to be curious and keep learning stuff, even if you think it’s too niche. It might come handy when you least expect it.

Moving lines in Vim

I’m learning to move ranges of lines in Vim. What I usually did was jump to the starting line, enter Visual Mode, select the lines I want to move, cut, move to the desired location and finally paste.

But Vim has a more efficient, shorter and faster way to do this, no cursor moving at all.

  • Move current line to line after 12: :m 12
  • Move current line to before first line :m 0
  • Move current line to after last tine :m $
  • Move current line to after line with mark a: :m 'a
  • Move range of lines: 5,7m 21 — will move lines 5-7 to after line 21.
  • Move 5 lines starting at current line to after line 21: :.,.+4m 21
  • Move current line 2 lines after current line: :m .+2

And you can return to the line you were with g; (and g, is the opposite).

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.