{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreia2goa3546zszw5jqkohwqaw4i4ah6o4fgjfjrvgnatrarboh77aa",
    "uri": "at://did:plc:aoqs4f5ru6ztomatyvept7bf/app.bsky.feed.post/3mnlsxrpgqr2u"
  },
  "canonicalUrl": "https://til.iainsimmons.com/posts/upgrading-to-neovim-0-12-built-in-undotree-plugin-incremental-selections",
  "description": "today iain learned: Some neat features that come with an upgrade to Neovim version 0.12, such as the built-in Undotree plugin and native Treesitter-based incremental selection.",
  "path": "/posts/upgrading-to-neovim-0-12-built-in-undotree-plugin-incremental-selections",
  "publishedAt": "2026-04-11T00:00:00.000Z",
  "site": "at://did:plc:aoqs4f5ru6ztomatyvept7bf/site.standard.publication/3mnlsntqzp72a",
  "tags": [
    "Neovim",
    "terminal",
    "dotfiles"
  ],
  "textContent": "<abbr title=\"In Case You Missed It\">ICYMI</abbr>, Neovim version 0.12 was released at the end of March 2026. There's quite a few roundups or summaries of the various features, so I won't go into a lot of detail, but just wanted to highlight a couple of the small changes I made after upgrading.\n\nUndotree\n\nUndotree, by mbbill is a fantastic plugin. So much so that it's now been rolled into Neovim core as a built-in plugin. See the plugin docs for Undotree.\n\nThere's no need to install it before using it, but you do need to enable it.\n\nWhile running Neovim 0.12, you could run a command:\n\nOr you could do that somewhere in your Neovim config to make it available on startup:\n\nOr if you're like me and you don't really use it often, or are used to using the lazy.vim concept of lazy-loading for a command, an equivalent would be the following (with bonus check to ensure you're running Neovim 0.12 or higher):\n\nThis way you only load it when it is actually needed.\n\nIncremental selections with Treesitter\n\nAnother feature that I used to use with the old master  branch of nvim-treesitter is incremental selection. That is, you visually select a range of text, and then with treesitter, you use keymaps to increment (expand) or decrement (contract) the selection.\n\nThat used to be configured like this:\n\nOn the main branch of nvim-treesitter, that's no longer a thing, but luckily this functionality was added in to the core of Neovim 0.12, with the default keymaps of <kbd>v</kbd> <kbd>a</kbd> <kbd>n</kbd> to increment and <kbd>v</kbd> <kbd>i</kbd> <kbd>n</kbd> to decrement. See the Neovim treesitter docs.\n\nThe default mappings aren't bad, though you have to first do  <kbd>v</kbd> <kbd>a</kbd> <kbd>n</kbd> to increment in normal mode, and then switch to just repeating <kbd>a</kbd> <kbd>n</kbd> to further increment in visual mode (and similar with  <kbd>v</kbd> <kbd>i</kbd> <kbd>n</kbd> to decrement from normal mode and then repeat <kbd>i</kbd> <kbd>n</kbd> in visual mode).\n\nI wanted some alternative keymaps (normally I'd go with <kbd>Ctrl</kbd> + <kbd>Space</kbd> to increment and <kbd>Backspace</kbd> to decrement, but these were not working for me in Linux, only in macOS).\n\nI had to dig around in the Neovim source code to find the implementation. You can find them in this commit where the new default keymaps were added.\n\nHere's how I added them to my configuration:\n\nYou'll notice that I first need to trigger visual mode if using these from normal mode. That took me a little while to figure out, but it works well, and it's the same in normal and visual mode.\n\nHere's how it looks:\n\n![[attachments/nvim-incremental-selection.mp4|Incremental selection in Neovim version 0.12]]\n\nThe rest\n\nI haven't yet switched to using vim.pack.add) and native plugin management. I've finely tuned my lazy.nvim based config and have not yet seen a compelling reason to move away from it.",
  "title": "Upgrading to Neovim 0.12: built-in Undotree plugin, incremental selections"
}