Quick indentation toggling for Neovim.
{
"alex-k03/nvim-toggle-indentation",
config = function()
require("indent-toggle").setup({
small_indent = 2, -- default: 2
large_indent = 4, -- default: 4
update_prettier = false, -- default: false, set to true to sync with ~/.prettierrc
})
end,
}{
"alex-k03/nvim-toggle-indentation",
config = function()
require("indent-toggle").setup({
update_prettier = true,
keys = {
{ "<leader><tab>t", action = "toggle", desc = "Toggle indentation" },
{ "<leader><tab>2", action = "set", value = 2, desc = "Set indentation to 2" },
{ "<leader><tab>4", action = "set", value = 4, desc = "Set indentation to 4" },
},
})
end,
}:ToggleIndentation- Toggle between small and large indentation:SetIndentation 4- Set specific indentation level
Configure keybindings in the keys option during setup:
keys = {
{ "<leader><tab>t", action = "toggle", desc = "Toggle indentation" },
{ "<leader><tab>2", action = "set", value = 2, desc = "Set indentation to 2" },
{ "<leader><tab>4", action = "set", value = 4, desc = "Set indentation to 4" },
}Each key table supports:
[1]- The key mapping (required)action- Either "toggle" or "set" (required)value- The indentation value (required for "set" action)desc- Description for which-key (optional)mode- Vim mode, defaults to "n" (optional)silent- Whether to suppress output, defaults to true (optional)
All options with their defaults:
{
small_indent = 2, -- The smaller indentation size
large_indent = 4, -- The larger indentation size
update_prettier = false, -- Whether to update ~/.prettierrc tabWidth
}