Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-indent HTML tags #56

Closed
lukewiebe opened this issue May 20, 2024 · 2 comments
Closed

Auto-indent HTML tags #56

lukewiebe opened this issue May 20, 2024 · 2 comments

Comments

@lukewiebe
Copy link

Hello,

This plugin is so good! It does basically everything I want, with a lot less complexity than the other options. Thanks for making it!

The one thing I'm missing is HTML tag auto-indent. Let's say my cursor | is here:

<div>|</div>

Then when I press return, I would want the auto indent to produce this:

<div>
  |
</div>

How feasible do you think this is?

@m4xshen
Copy link
Owner

m4xshen commented Jun 4, 2024

@lukewiebe Thanks for the feedback! A pretty simple approach would be adding this config:

keys = {
  [">"] = { escape = false, close = false, pair = "><" },
}

This triggers auto-indent when your cursor is between two tags like this: >|<.

@lukewiebe
Copy link
Author

Ah, that’s very clever! I’ll definitely add it to my config.

I imagine this is a fairly common need with the popularity of HTML. Would you consider adding it to the default settings or noting it in the readme?

@m4xshen m4xshen pinned this issue Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants