www-gem words

[Plugin] Manage pairs around your text: mini.surround


Why I moved from nvim-surround to mini.surround

#(Neo)vim #(Neo)vim-Plugins

What do Neovim users do when they get bored? They rewrite their config file to optimize their startup time by saving 12 milliseconds. Then, they mess up with plugins and try new ones, just to break their config even more :)
For the longest time, nvim-surround just worked. So, why break what wasn’t broken? Why did I make the leap to mini.surround ?

Grab a cup of your preferred Linux fuel, open up a terminal, and let’s talk about why this tiny module won over my heart, my config files, and my muscle memory.

The Plugin Ecosystem Consolidation

mini.nvim is a collection of independent, hyper-focused, lightweight Lua modules written by a single mastermind (E. Chasnovski). By switching to mini.surround, I didn’t just replace a plugin, I opened the door to a unified suite. I’ll continue sharing my journey in the mini.nvim world through my “The Neovim mini collection” series.

Intuitive Mappings

Out of the box, nvim-surround mimics vim-surround using actions like ys, ds, and cs. It’s iconic, but it has a slight cognitive friction when you want to expand or query bindings.

mini.surround opts for a prefix-based structure (sa for surround add, sd for surround delete, sr for surround replace).

  • Want to add quotes around a word? saw"
  • Want to delete surrounding brackets? sdb
  • Want to find the next/last surrounding pair? It handles directional searches effortlessly.

Once your fingers adapt to the s prefix family, it maps neatly onto how you think about text manipulation: verb + target.

Native Visual Mode Integration That Just Makes Sense

One of the subtle papercuts I experienced with nvim-surround was handling complex visual selections. When you highlight a multi-line block or a specific chunk of code and want to wrap it, behavior could occasionally require specific operator sequences.

mini.surround handles visual selections natively and gracefully. Highlight a chunk of code in visual mode, press sa followed by your delimiter, and boom your snippet is wrapped cleanly, respecting indentation rules right out of the box. It feels less like fighting an extension and more like an extension of Neovim’s core philosophy.

The Migration Verdict

Moving away from nvim-surround wasn’t about the older plugin being bad, it’s phenomenal at what it does. But mini.surround gave me a faster, remarkably lean footprint with built-in search versatility and a cohesive ecosystem that aligns with a minimalist Linux workflow.

If you’re looking to trim down your init.lua without sacrificing a single ounce of text-editing power, give mini.surround a spin.


All posts in the The Neovim Mini Collection series:
  1. [Plugin] The buffer list: mini.buffer
  2. [Plugin] Manage pairs around your text: mini.surround


Share your feedback via email, using Mastodon or

Comment on wwwgem's post

Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.