Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm migrating a question I posted on stackoverflow to here as it may be more relevant.

Here is the question:

I'm looking for a way to code XML (mxml, specifically) in Notepad++ such that it follows the behavior of the "Indent by Fold" plugin - indentation after pressing 'enter' following an opening tag - but also includes automatic tag closing similar to what is provided by the "XML Tools" plugin.

The issue with enabling both at once is that I start with something like this:


(Note: the '|' character represents the cursor)

Then after hitting the '>' key, I get this:


And after pressing 'Enter,' I get something that looks like this:


What I'm looking for is something that looks like this (after hitting the '>' key):


Any help would be much appreciated.

share|improve this question
up vote 2 down vote accepted

Here's my quick and dirty solution. Really it just involves creating a macro along with enabling a XML tools feature.

First, remove the "Indent By Fold" plugin, if installed.

Then, enable the "Tag auto-close" feature by going to Plugins>XML Tools.

Also, enable Notepad++'s auto indent by going to Settings > Preferences > MISC. Tab

Next, go to Macro > Start Recording.

Now, hit the following keys in this sequence:

>, enter, enter, up, tab.

Then, go to Macro > Stop Recording. Followed by, Macro > Save Current Recorded Macro.

This will create the final '>' as well as the closing tag, but then leave your cursor indented in a new line between the opening and closing tags.

I saved mine as "CTRL + '.'".

The reasoning behind this was that if I was here:


The natural thing to do would be to hit the '>' key. Since I need to hit SHIFT+ '.' on a QWERTY keyboard to get this character, I figure I'd use CTRL+'.' (only one key away) to perform the macro and save SHIFT+'.' for cases where I just want the plain old character (e.g. <hello />).

Here is the result after hitting CTRL + '.'


I'll be on the lookout for a more elegant solution, but for now this seems to be pretty good.

Hope this helps!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .