Skip to content

A minimalist neovim plugin to close & rename html/jsx elements with the power of treesitter

License

Notifications You must be signed in to change notification settings

tronikelis/ts-autotag.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ts-autotag.nvim

📃 Introduction

A minimalist Neovim plugin that auto closes & renames html/jsx elements without setting keymaps

🖥️ Examples

Auto close tag

auto close tag gif

Auto rename tag

auto rename tag

📦 Install

With lazy.nvim

{
    "tronikelis/ts-autotag.nvim",
    opts = {},
    -- ft = {}, optionally you can load it only in jsx/html
    event = "VeryLazy",
}

🔧 Configuration

Default config

{
	opening_node_types = {
		-- templ
		"tag_start",

		-- html
		"start_tag",

		-- jsx
		"jsx_opening_element",
	},
	identifier_node_types = {
		-- html
		"tag_name",
		"erroneous_end_tag_name",

		-- jsx
		"member_expression",
		"identifier",

		-- templ
		"element_identifier",
	},

	disable_in_macro = true,

	auto_close = {
		enabled = true,
	},
	auto_rename = {
		enabled = true,
		closing_node_types = {
			-- jsx
			"jsx_closing_element",

			-- html
			"end_tag",
			"erroneous_end_tag",

			-- templ
			"tag_end",
		},
	},
}

🤔 Differences between nvim-ts-autotag

  • A much more "dumb" and simple solution which just checks child node types under cursor
  • Does not override any keymaps, nvim-ts-autotag overrides > keymap which could break other plugins

About

A minimalist neovim plugin to close & rename html/jsx elements with the power of treesitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages