This may come as a shocker, but I'm really particular about my editor settings. I'm sure no one else is, but I get pretty darn picky about my editor and how it behaves. One issue I've had with Brackets is a feature called "Smart Indent."
Smart Indent will automatically indent your cursor after you hit enter on a block expression. Not sure if "block expression" is the best term, but basically, if you enter a conditional, like if(x), or if you enter a HTML tag that wraps other tags, like <table>, Brackets will indent your cursor one "block" over after you hit enter.
This bugs the heck out of me. While I do use indentation, I don't always use it. So for example, I don't like to indent my HEAD or BODY blocks. It feels silly to me to have one pair of HTML tags at the left gutter and nothing else. I'll not indent TR blocks inside of TABLE tags either, but I do indent the TDs.
Basically - my rule is - and I try to be consistent here - that if the wrapping block has nothing else in it but one main child, I don't see much point in indenting over the text.
When I type in Brackets, I constantly find myself having to hit backspace to return the cursor to where I want it. After a while I begin to see red and start wondering if therapy is in order.
Turns out though it is pretty easy to correct. If you go into the source code and find editor/Editor.js, you can see the following block where the CodeMirror object is instantiated:
I checked the CodeMirror docs and found that I could pass a setting, smartIndent:false, to disable this.
And that's it. To be clear, when I hit enter, the cursor still indents to where the last line began. It isn't flush against the left gutter.
There is no "Preferences" UI yet for Brackets. I could make this an extension, but since I assume I'm probably in the minority when it comes to this preference and the modification is so small, I wouldn't bother creating one.
Archived Comments
So are you using Brackets as your everyday editor? Is it stable/feature complete enough for that? I'm fascinated by the idea of Brackets and would love to give it a try if it's close.
Not yet - no. I'm using it from time to time - writing extensions - etc. My main editor is still Sublime Text 2.
You'll need to comment out this line: cm.indentLine(cm.getCursor().line); around line 1836 in function called newlineAndIndent.
That must be new. Thanks.
Any idea for Brackets v36?
Eh? This hack probably still works. There is a new way to handle preferences in Sprint 36 (see their blog), but this preference isn't supported yet.
A bit old post but if someone finds this now, this is how to do it:
Go to Debug->Open Preferences File and add the same setting (but in json mode), for example, this is my preferences file (brackets.json):
{
"debug.showErrorsInStatusBar": false,
"linting.collapsed": true,
"closeBrackets": true,
"smartIndent": false
}
Yep - preferences are *much* easier to do now. :)
Hey, I have an annoying problem in that Brackets actually removes my indentation. I'll indent to where I want to be and start typing and the whole line will move right back up to the margin! Even for someone who isn't particularly picky with their settings that would be really annoying! Don't suppose you have any insight on how to fix that?
Cheers
Sorry, never seen that one before. To be honest, I don't use Brackets much. I'd file a bug report.
Ok, thanks for the reply