💾 Archived View for dmerej.info › en › blog › 0087-syntax-highlighting-is-useless.gmi captured on 2024-05-12 at 15:05:27. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-07-16)
-=-=-=-=-=-=-
2018, Oct 04 - Dimitri Merejkowsky License: CC By 4.0
... at least when it comes to Markdown files ;)
Here's what it used to look like to edit one of my articles in Neovim:
Colored markdown file in Neovim [IMG]
Take a quick look. Do you see what's wrong?
1: https://gohugo.io/functions/ref/
For quite some time I did not think to much about this situation, until I read *A case against syntax highlighting[2]*, by Linus Åkesson.
2: http://www.linusakesson.net/programming/syntaxhighlighting/
So one day I decided to try and turn the syntax highlighting off:
Un-colored markdown file [IMG]
One more thing: I'm also viewing the rendered HTML in a browser next to my Neovim window. Hugo rebuilds the page I'm editing after each save, and the browser automatically reloads.
This has several consequences:
ERROR 2018/10/04 16:36:23 error processing shortcode "_internal/shortcodes/ref.html" for page "post/0087-demo-syntax-highlight.md": template: _internal/shortcodes/ref.html:1:89: executing "_internal/shortcodes/ref.html" at <0>: invalid value; expected string
So let's think about what we learned:
So, why do we keep using it?
For now, I'm just turning syntax off for Markdown files. Here's the relevant section in my `init.vim` file:
augroup textfiles autocmd! autocmd filetype markdown :setlocal spell spelllang=en | syntax clear augroup end
I'm still using syntax highlight in the other cases.
But, in the same way the syntax highlighting may be useless (and even harmful) for editing Markdown when a HTML renderer can be used, maybe syntax highlighting is *also* useless if a linter can be used directly[3] to check the code **while it's being typed**.
3: Let's have a pint of (vim) ale!
Food for thought ...
----