"value":"\n <p>I enjoy writing and working with open-source software, starting back to when I started working with PHP and Drupal in 2007.<\/p>\n\n<p>Since then, I've written and maintained a number of Drupal modules and themes, PHP libraries, npm packages, Ansible roles and Docker images - all of which are available on my GitHub and Drupal.org pages.<\/p>\n\n<p>Just over a year ago, <a href=\"\/blog\/going-full-vim\">I switched to using Neovim full-time<\/a> for my development and DevOps work, and last week, I wrote my first Neovim plugin, written in Lua.<\/p>\n\n<p>I've used Lua to configure Neovim but this is the first time that I've written and open-sourced a standalone Neovim plugin.<\/p>\n\n<p>It's called <a href=\"https:\/\/github.com\/opdavies\/toggle-checkbox.nvim\">toggle-checkbox.nvim<\/a> and is used toggle checkboxes in Markdown files - something that I use frequently for to-do lists.<\/p>\n\n<p>For example, this a simple list containing both checked and unchecked checkboxes:<\/p>\n\n<pre><code class=\"markdown\">- [x] A completed task\n- [ ] An incomplete task\n<\/code><\/pre>\n\n<p>To toggle a checkbox, the <code>x<\/code> character needs to be either added or removed, depending on whether we're checking or unchecking it.<\/p>\n\n<p>This is done by calling the <code>toggle()<\/code> function within the plugin.<\/p>\n\n<p>In my Neovim configuration, I've added a keymap to do this:<\/p>\n\n<pre><code class=\"lua\">vim.keymap.set(\n \"n\",\n \"<leader>tt\",\n \"require('toggle-checkbox').toggle()\"\n)\n<\/code><\/pre>\n\n<p>This means that I can use the same keymap by running <code><leader>tt<\/code> to check or uncheck a checkbox. I could use Vim's replace mode to do this, but I really wanted to have one keymap that I could use for both.<\/p>\n\n<p>As it's my first Neovim plugin, I decided to keep it simple.<\/p>\n\n<p>The main <code>toggle-checkbox.lua<\/code> file is currently only 41 lines of code, and whilst there is an existing Vim plugin that I could have used, I was excited to write my own plugin for Neovim, to start contributing to the Neovim ecosystem, and add a Neovim plugin to my portfolio of open-source projects.<\/p>\n\n<p>You can view the plugin at <a href=\"https:\/\/github.com\/opdavies\/toggle-checkbox.nvim\">https:\/\/github.com\/opdavies\/toggle-checkbox.nvim<\/a>, as well as my Neovim configuration (which is also written in Lua) as part of <a href=\"https:\/\/github.com\/opdavies\/dotfiles\/tree\/main\/roles\/neovim\/files\">my Dotfiles repository<\/a>.<\/p>\n\n ",
"format":"full_html",
"processed":"\n <p>I enjoy writing and working with open-source software, starting back to when I started working with PHP and Drupal in 2007.<\/p>\n\n<p>Since then, I've written and maintained a number of Drupal modules and themes, PHP libraries, npm packages, Ansible roles and Docker images - all of which are available on my GitHub and Drupal.org pages.<\/p>\n\n<p>Just over a year ago, <a href=\"\/blog\/going-full-vim\">I switched to using Neovim full-time<\/a> for my development and DevOps work, and last week, I wrote my first Neovim plugin, written in Lua.<\/p>\n\n<p>I've used Lua to configure Neovim but this is the first time that I've written and open-sourced a standalone Neovim plugin.<\/p>\n\n<p>It's called <a href=\"https:\/\/github.com\/opdavies\/toggle-checkbox.nvim\">toggle-checkbox.nvim<\/a> and is used toggle checkboxes in Markdown files - something that I use frequently for to-do lists.<\/p>\n\n<p>For example, this a simple list containing both checked and unchecked checkboxes:<\/p>\n\n<pre><code class=\"markdown\">- [x] A completed task\n- [ ] An incomplete task\n<\/code><\/pre>\n\n<p>To toggle a checkbox, the <code>x<\/code> character needs to be either added or removed, depending on whether we're checking or unchecking it.<\/p>\n\n<p>This is done by calling the <code>toggle()<\/code> function within the plugin.<\/p>\n\n<p>In my Neovim configuration, I've added a keymap to do this:<\/p>\n\n<pre><code class=\"lua\">vim.keymap.set(\n \"n\",\n \"<leader>tt\",\n \"require('toggle-checkbox').toggle()\"\n)\n<\/code><\/pre>\n\n<p>This means that I can use the same keymap by running <code><leader>tt<\/code> to check or uncheck a checkbox. I could use Vim's replace mode to do this, but I really wanted to have one keymap that I could use for both.<\/p>\n\n<p>As it's my first Neovim plugin, I decided to keep it simple.<\/p>\n\n<p>The main <code>toggle-checkbox.lua<\/code> file is currently only 41 lines of code, and whilst there is an existing Vim plugin that I could have used, I was excited to write my own plugin for Neovim, to start contributing to the Neovim ecosystem, and add a Neovim plugin to my portfolio of open-source projects.<\/p>\n\n<p>You can view the plugin at <a href=\"https:\/\/github.com\/opdavies\/toggle-checkbox.nvim\">https:\/\/github.com\/opdavies\/toggle-checkbox.nvim<\/a>, as well as my Neovim configuration (which is also written in Lua) as part of <a href=\"https:\/\/github.com\/opdavies\/dotfiles\/tree\/main\/roles\/neovim\/files\">my Dotfiles repository<\/a>.<\/p>\n\n ",