Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

[Plugin] Support auto close and rename tag #47

Open
NNBnh opened this issue Apr 24, 2022 · 1 comment
Open

[Plugin] Support auto close and rename tag #47

NNBnh opened this issue Apr 24, 2022 · 1 comment
Labels
plugin request This belongs in a separate plugin

Comments

@NNBnh
Copy link
Contributor

NNBnh commented Apr 24, 2022

Following issue #46:

Pepper would be great if it have the quality-of-life-improvement features from two of the most popular VScode plugins: Auto Close Tag and Auto Rename Tag:

Auto Close Tag

From the "Auto Rename Tag" VScode plugin:

Automatically add HTML/XML close tag, same as Visual Studio IDE or Sublime Text does:

  • Automatically add closing tag when you type in the closing bracket of the opening tag
  • After closing tag is inserted, the cursor is between the opening and closing tag
  • Set the tag list that would not be auto closed
  • Automatically close self-closing tag
  • Support auto close tag as Sublime Text 3
  • Use Keyboard Shortcut or Command Palette to add close tag manually

usage

Auto Rename Tag:

From the "Auto Rename Tag" VScode plugin:

When you rename one HTML/XML tag, automatically rename the paired HTML/XML tag

usage

If you find this suggestion it's suitable to be built-in with the editor, feel free to label this issue with "Plugin" or "Plugin Idea".

@vamolessa
Copy link
Owner

vamolessa commented Apr 24, 2022

I feel like auto-close could be implemented through a plugin:
It would override the on_keys and watches for a > key event.
Then it would check if the current buffer's path has a html or xml extension.
If it does, it'd check for each cursor if it's at the end of a tag and, if it is, it would insert the corresponding text right after it.

The auto rename also could be made via a plugin that watches the on_keys event.
However, you could also achieve a similar result by using multiple cursors:

  • put the cursor on top of one of the tags
  • press N (or P)
  • press N if the next tag is bellow the cursor or P if it is above
  • then awi to select all whole words, delete them, and then enter insert mode with multiple cursors
    Then pressing <esc> twice will return to normal mode and collapse all cursors into only the main cursor.

@NNBnh NNBnh changed the title Support auto close and rename tag [Plugin] Support auto close and rename tag Apr 25, 2022
@vamolessa vamolessa added the plugin request This belongs in a separate plugin label Aug 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin request This belongs in a separate plugin
Projects
None yet
Development

No branches or pull requests

2 participants