description: "Configuring Vim to act as a first-class markdown editor for various purposes"
cover: /assets/pngs/editor.png
date: 2020-04-30T23:06:59-04:00
categories:
- Technology
tags:
- Vim
- Markdown
- Zettelkasten
- 100 Days To Offload
toc: true
---
I've recently decided to attempt to keep all of my notes and everything I've learned in a [Zettelkasten](https://zettelkasten.de/). After reading [Daryl Sun's blog post](https://write.privacytools.io/darylsun/100-days-to-offload-day-4), I started looking more into the method and found it *incredibly* intriguing. I've tried the "Evernote way" of throwing everything I come across in a single place but it inevitable gets lost. I don't remember what it was called but I tried another app that actually tags your files and organises them in a nice manner. This worked well for the most part but the graphical client was badly optimised Electron and *very* heavy. I've also tried keeping notes in books but I was never really able to keep up with any of it. The thing that is especially compelling about a Zettelkasten is that I put *everything* I learn in a single text file but link around to as many different ideas as I can, drawing my *own* connections for me to rediscover later on.
Because it's all in a simple text file, I'm also able to create a keybinding in [Sway](https://github.com/swaywm/sway/) that will open it in Vim, jump to the bottom, and have a nice markdown environment ready for me to write in. It did take a bit of configuration and looking around for different plugins but I'm very happy with what I have so far.
The first thing is telling Vim to treat all `.md` files as Markdown
It can also be nice to not see a ton of \[links](https\://example.com) and \*\*bold** or \*italic* text everywhere. Sure, my eye has gotten used to it but still. I'd rather have my terminal actually render bold text as bold.
If you use the `vim-markdown` plugin mentioned further on, I recommend using its option for concealing rather than Vim's.
## Spell check
One of the things every good editor needs is spell check and Vim is no exception. This line enables spell check with British English for all markdown files.
Here's a short crash course in Vim spelling commands:
-`[s` to search for misspelled words above the cursor
-`]s` to search for misspelled words below the cursor
-`z=` to see replacement suggestions
-`zg` to add the word to your dictionary
## Goyo
The very first component is something I use across *all* markdown files. [Goyo](https://github.com/junegunn/goyo.vim) is one of the first plugins I install on any machine I'll be writing with. It enables a "distraction-free writing environment" and I absolutely love it. It disables pretty much all visual elements in Vim except for what mode you're in: visual, command, insert, etc. I have a keybinding set to quickly open/close Goyo because there is an odd issue when I switch workspaces to and away from Vim. With two taps of `Ctrl+g`, it's back to normal.
That latest plugin I installed is [vim-markdown](https://github.com/plasticboy/vim-markdown) and it is *wonderful*. I really recommend reading about all of the options but here's what I have set.
In addition to the rest of the awesome features, the main one I wanted is the last: `follow_anchor`. With this, I can create internal links within the same markdown document and jump between them with `ge`. It also lets me open both files and URLs from within Vim and without ever having to reach for the mouse.
## General Vim things
Other, more general Vim settings that I use globally but might also be nice for editing markdown
" Keep cursor in approximately the middle of the screen
set scrolloff=12
" Disable mouse support
set mouse=
```
---
In all, I'm hoping that the work I've done today for improving my markdown workflow will help me create a more effective Zettelkasten. The *big* thing was really being able to follow internal links around because that's the main thing with keeping a Zettelkasten: following your ideas to see where they lead and discovering what connections you can make to form entirely new ideas. Mine will be stored in [Gitea](https://git.nixnet.xyz/Amolith/zettelkasten) for now but I'm thinking about putting it here at some point. It would be cool to have a map of my own mind very easily accessible from anywhere.
![screenshot of my setup](/assets/jpgs/zettelkasten.jpg)
I won't keep editing this post to provide updates on my config. Instead, I recommend looking at my ["production" version on Gitea](https://git.nixnet.xyz/Amolith/dotfiles/src/branch/master/dotfiles/pc/.config/nvim/init.vim).
---
This was posted as part of [#100DaysToOffload](https://100daystooffload.com/), an [awesome idea](https://fosstodon.org/@kev/104053977554016690) from [Kev Quirk](https://kevq.uk/). If you want to participate, just write something every day for 100 days and post a link on social media with the hashtag!