Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ Curly Bracket Auto-Outdenting

Tags:

notepad++

I personally think that the common practice of coding javascript like this:

function(){
//code
}

is ugly and annoying. So when I code in javascript, I like to format it like this:

function()
    {
    //code
    }

I've never had this problem with notepad++ before, but after my last install, the program feels the need to remove my tab/indent every time I try to indent my curly brackets so I have to go back and hit tab again after both are typed. Does anyone know what preference option can fix this?

I found that if I go Settings > Preferences > MISC. and then uncheck the box that says "auto-indent", the program will stop removing my indents, but it also starts me completely outdented when I start a new line.

Just to sum this all up one more time. If my previous line of code was indented 3 times, I want to still be indented 3 times when I hit enter/return. I also want it so when I go to indent my curly brackets for them to stay where I indented them and to not drop down one indent.

I've spent a lot of time googling this and haven't found out anything and I can't figure it out by flipping through the preferences. If you could help me out with this problem, it would be very much appreciated.

like image 597
Shikayaru Avatar asked Jan 27 '15 13:01

Shikayaru


1 Answers

I found a way to restore previous behaviour of Notepad++ (before 6.7 release) which not impose K&R indenting style ;

  1. Disable Auto-Indenting into Misc preferences
  2. Install NppAutoIndent plugin
  3. Set NppAutoIndent with "Previous line" option if you like Allman style, or "Block Indent" if you prefer Whitesmiths style (requested by @Shikayaru).

Nb: NppAutoIndent "Smart Indent" option apply the same default behaviour of Notepad++ since 6.7 (and related to K&R style only).

I had requested (by mail) an option to disable this new feature introduced since Notepad++ 6.7 but never receive a response. Somebody created an issue on GitHub you may support ; https://github.com/notepad-plus-plus/notepad-plus-plus/issues/296

like image 130
oliezekat Avatar answered Sep 27 '22 19:09

oliezekat