Auto-indent in Notepad++

断了今生、忘了曾经 提交于 2019-11-26 23:44:52

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.

If the TextFX menu does not exist, you need to download & install the plugin. Plugins->Plugin Manager->Show Plugin Manager and then check the plugin TextFX Characters. Click 'install,' restart Notepad++.

In version Notepad++ v6.1.3, I resolve with: Plugin Manager->Show Plugin Manager** and then check the plugin "Indent By Fold"

Abhishek

There seems to be an option for auto-format of XML at least. It can be found at TextFX -> TextFX HTML Tidy -> Tidy: reindent XML.

Peter Mortensen

Most developers of text editing programs misuse this name (auto-indent). The correct name is "maintain indentation". Auto-indent is what you actually want, but it is not implemented.

I would also like to see this feature in Notepad++.

In the latest version (at least), you can find it through:

  • Settings (menu)
  • Preferences...
  • MISC (tab)
  • lower-left checkbox list
  • "Auto-indent" is the 2nd option in this group

[EDIT] Though, I don't think it's had the best implementation of Auto-indent. So, check to make sure you have version 5.1 -- auto-indent got an overhaul recently, so it auto-corrects your indenting.


Do also note that you're missing the block for the 2nd if:

void main(){
  if(){
    if() { }  # here
  }
}

You can use 'Indent by fold' plugin. Install it from the plugin manager. It works fine for me.

In the 6.6.8 version I installed the NppAutoIndent plugin from Plugins > Plugin Manager > Show Plugin Manager. Then I selected the Smart Indent option in Plugin > NppAutoIndent. Hope this helps.

A little update: You can skip the TextFX Plugin and just use Tidy2. Here you can configure your own formating-rules for different types of codes. Easy to install and remove within

Notepad++ > Plugins > Plugin Manager > Show Plugin Manager

and just search for Tidy2 and install it. Done.

imriss

Try the UniversalIndentGUI plugin for Notepad++. It re-indents code based on some parameters. It worked well for me.

Luke

For those who use Notepad++ v6.8.1 and later, the auto-indent setting now is placed in menu SettingsPreferencesMISC.Auto Indent.

This may seem silly, but in the original question, Turion was editing a plain text file. Make sure you choose the correct language from the Language menu

Install Tidy2 plugin. I have Notepad++ v6.2.2, and Tidy2 works fine so far.

Saurav Sahu
Menu TextFX → TextFX Edit → Reindent C++ code

But, Notepad++ doesn't come with this "Text FX Character" plugin. You will need to install it via

Plugins → Plugin Manager → Show Plugin Manager.

To add shortcut for Indentation.

Click on SettingsShortcut Mapper... set the shortcut key you prefer. I prefer Ctrl + =.

tapos ghosh

First download plugin manager this link then unzip the zip folder and copy this inside your program/ notepad++ folder . then restart your notepad++. then you see plugin manager inside plugin menu . then click plugin manager then click show plugin manager . It shows all your plugin list . from the list in bottom find XML tools , checked it and install it. then restart your notepad++. After open a document then plugins/xml tools/pretty plain(indent text) then enjoy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!