How do I indent multiple lines at once in Notepad++?

Tag: ide , editor , text-editor , notepad++ , tabs Author: chenyouzhan Date: 2009-09-05

In many text editors that are aimed at programmers, if the user has a selection that spans more than 1 line and presses the TAB key, those lines are indented by 1 TAB (or a number of spaces, depending on how the editor is configured).

However, this does not seem to be the default behavior of Notepad++. Is there a way I can do this in Notepad++, or is there a plugin that I can get to allow me to do this?

Edit: Upon additional testing, SHIFT-TAB correctly un-indents the lines as expected, but only a tab simply inserts a tab wherever the carat is. This is in version 5.4.5 Unicode

Best Answer

The problem was with the QuickText plugin. After removing it, indent worked as normal.

Other Answer1

The problem with the new version of QuickText seems to be that it is set to react to the TAB key. Previously it was set to use CTRL-ENTER. If you change the key combination in the shortcut mapper then your TAB key should start working again, and QuickText should also work (with whatever new key you've assigned).

Other Answer2

If you're using QuickText and like pressing Tab for it, you can otherwise change the indentation key.

Go Settings > Shortcup Mapper > Scintilla Command. Look at the number 10.

  • I changed 10 to : CTRL + ALT + RIGHT and
  • 11 to : CTRL+ ALT+ LEFT.

Now I think it's even better than the TABL / SHIFT + TAB as default.

Other Answer3

I have Notepad++ 5.3.1 (UNICODE). I haven't done any magic and it works fine for me as described by you.

Maybe it depends on the (programming/markup/...) "Language"?

comments:

5.1.1 (Unicode) here and works too. Independent of the selected syntax highlighting language.

Other Answer4

It works fine for my v. 5.4.5 of Notepad++. I just select multiple lines and press TAB.

If you want TAB to be replaced by SPACE than you need to go Settings > Preferences and select Edit Components tab. Next check Replace by spaces check box in Tab Setting section.

Other Answer5

Just install the NppAutoIndent plug-in, select Plugins > NppAutoIndent > Ignore Language and then Plugins > NppAutoIndent > Smart Indent.

comments:

Hi Anshi, welcome to Stack Overflow. Please note that writing in ALL CAPS is difficult to read and looks like shouting.

Other Answer6

Notepad++ will only auto-insert subsequent indents if you manually indent the first line in a block; otherwise you can re-indent your code after the fact using TextFX > TextFX Edit > Reindent C++ code.

Other Answer7

in Notepad++v6.1.8 (Unicode) it works after removing the QuickText plugin.

comments:

This has already been noted. See accepted answer.