{ "uuid": [ { "value": "8293455b-3322-4e45-a24a-2d64f77db033" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-05-11T09:01:00+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "I wrote a Neovim plugin" } ], "created": [ { "value": "2022-08-13T00:00:00+00:00" } ], "changed": [ { "value": "2025-05-11T09:01:00+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2022\/08\/13\/i-wrote-a-neovim-plugin", "langcode": "en" } ], "body": [ { "value": "\n

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

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

Just over a year ago, 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

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

It's called toggle-checkbox.nvim<\/a> and is used toggle checkboxes in Markdown files - something that I use frequently for to-do lists.<\/p>\n\n

For example, this a simple list containing both checked and unchecked checkboxes:<\/p>\n\n

-   [x] A completed task\n-   [ ] An incomplete task\n<\/code><\/pre>\n\n

To toggle a checkbox, the x<\/code> character needs to be either added or removed, depending on whether we're checking or unchecking it.<\/p>\n\n

This is done by calling the toggle()<\/code> function within the plugin.<\/p>\n\n

In my Neovim configuration, I've added a keymap to do this:<\/p>\n\n

vim.keymap.set(\n  \"n\",\n  \"<leader>tt\",\n  \"require('toggle-checkbox').toggle()\"\n)\n<\/code><\/pre>\n\n

This means that I can use the same keymap by running <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

As it's my first Neovim plugin, I decided to keep it simple.<\/p>\n\n

The main 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

You can view the plugin at https:\/\/github.com\/opdavies\/toggle-checkbox.nvim<\/a>, as well as my Neovim configuration (which is also written in Lua) as part of my Dotfiles repository<\/a>.<\/p>\n\n ", "format": "full_html", "processed": "\n

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

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

Just over a year ago, 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

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

It's called toggle-checkbox.nvim<\/a> and is used toggle checkboxes in Markdown files - something that I use frequently for to-do lists.<\/p>\n\n

For example, this a simple list containing both checked and unchecked checkboxes:<\/p>\n\n

-   [x] A completed task\n-   [ ] An incomplete task\n<\/code><\/pre>\n\n

To toggle a checkbox, the x<\/code> character needs to be either added or removed, depending on whether we're checking or unchecking it.<\/p>\n\n

This is done by calling the toggle()<\/code> function within the plugin.<\/p>\n\n

In my Neovim configuration, I've added a keymap to do this:<\/p>\n\n

vim.keymap.set(\n  \"n\",\n  \"<leader>tt\",\n  \"require('toggle-checkbox').toggle()\"\n)\n<\/code><\/pre>\n\n

This means that I can use the same keymap by running <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

As it's my first Neovim plugin, I decided to keep it simple.<\/p>\n\n

The main 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

You can view the plugin at https:\/\/github.com\/opdavies\/toggle-checkbox.nvim<\/a>, as well as my Neovim configuration (which is also written in Lua) as part of my Dotfiles repository<\/a>.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "1970-01-01T00:33:45+00:00", "guid": null, "hash": "da50f1968f98fdd321596a74d98b2ec4", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }