A tiny Neovim plugin to toggle the word under the cursor through common pairs and cycles (true/false, on/off, debug/info/warn/error, etc.).
- Toggle the current word in place with one command
- Case-aware replacement:
True -> False,DEBUG -> INFO - Extend or replace the default cycles with your own words
- Neovim 0.7+
Using lazy.nvim:
{
"Micro-nvim-plugin/Micro-word-toggle.nvim",
config = function()
require("Micro-word-toggle").setup()
end,
}Using packer.nvim:
use({
"Micro-nvim-plugin/Micro-word-toggle.nvim",
config = function()
require("Micro-word-toggle").setup()
end,
})Bind a keymap to toggle():
vim.keymap.set("n", "<leader>tw", function()
require("Micro-word-toggle").toggle()
end, { desc = "Toggle word" })Provide extra cycles via setup({ dict = { ... } }):
require("Micro-word-toggle").setup({
dict = {
{ "enable", "disable" },
{ "start", "stop", "restart" },
{ "left", "right" },
},
})The dictionary is a list of word groups, and each group forms a cycle.
true <-> false
yes <-> no
on <-> off
open <-> close
and <-> or
< <-> >
<= <-> >=
== <-> !=
&& <-> ||
& <-> |
debug -> info -> warn -> error
public -> private -> protected
todo -> fixme -> note -> hack -> bug
GLPv3. See LICENSE.
