Skip to content

Own your tools. A case for an extendable open source editor

Published: at 10:30 AM

Most Wednesdays I have a long commute. Recently I’ve decided to spend some of this time sorting out things that cause friction in my workflow. I’ve begun referring to this as Workflow Wednesday. Examples of this is setting up keybindings I am missing in JetBrains Rider or Neovim, organising my notes, or configuring a new session with tmuxifier.

I am not normally a fan of the “software developers are craftspeople”. However I do think we can take some inspiration from how craftspeople learn to both use and care for their tools. People who know me might know that I am a big fan of vim, neovim and modal editing generally. There are many reasons to use neovim, but in this blog post I will focus on the customisability and extendability of neovim. There are other editors that are extendable of course (e.g. emacs). While other editors are configurable, and not easily extended. I think new editors being created who choose JSON as a configuration layer instead of LUA or something similar are making a mistake. At least they are not going to get me as an adopter. So what is a good example of extendability? Lets take a look at what I did in a recent Workflow Wednesday.

Part of my workflow is using a weekly note in obsidian. I edit my weekly note in neovim, and use the plugin obsidian.nvim for interacting with Obsidian. My weekly notes have todo-items in markdown, formatted with the classic - [ ] Something todo, and what most people do is add an x inside the brackets to mark it as complete like this - [x] Completed todo. This is what I do as well. In addition to this I also go through my to-dos and move the important ones to next week like this - [>] Moved to next week, or mark them as deleted - [~] Forget about doing this .

It looks something like this:

Screenshot tasks

I was getting tired of editing to-dos manually so I wanted to find a plugin to handle it for me. I searched around a bit and found this plugin for neovim called toggle-checkbox. The code is pretty simple, since toggling a markdown checkbox is a pretty simple problem. It didn’t support my moved or deleted syntax though. So I copied the code to my own config folder and modified it a bit. I added a parameter to the toggle-method so I can make a keybind for toggling something as done, moved or deleted. You can see the code for my modified toggle-checkbox in my dotfiles repo.

To make keybinds that only activate for markdown I added this to my markdown ftplugin file:

vim.keymap.set(
  "n",
  "<leader>od",
  ":lua require('toggle-checkbox').toggle_checked('x')<CR>",
  { desc = "Toggle done", silent = true }
)
vim.keymap.set(
  "n",
  "<leader>om",
  ":lua require('toggle-checkbox').toggle_checked('>')<CR>",
  { desc = "Toggle moved", silent = true }
)
vim.keymap.set(
  "n",
  "<leader>or",
  ":lua require('toggle-checkbox').toggle_checked('~')<CR>",
  { desc = "Toggle removed", silent = true }
)

What are some improvements you can make to your own workflow? What is stopping you from doing it?