Skip to content

Micro-nvim-plugin/Micro-word-toggle.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Micro-word-toggle.nvim

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.).

demo

Features

  • 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

Requirements

  • Neovim 0.7+

Installation

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,
})

Usage

Bind a keymap to toggle():

vim.keymap.set("n", "<leader>tw", function()
  require("Micro-word-toggle").toggle()
end, { desc = "Toggle word" })

Configuration

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.

Default Cycles

true <-> false
yes <-> no
on <-> off
open <-> close
and <-> or
< <-> >
<= <-> >=
== <-> !=
&& <-> ||
& <-> |
debug -> info -> warn -> error
public -> private -> protected
todo -> fixme -> note -> hack -> bug

License

GLPv3. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages