Sublime Forum

Less smart auto tabbing, but not completely dumb, please

#1

The tabbing behavior of the default Sublime installation is irking me.

I would like all tabbing behavior to be the same, no matter what the file. And I would like the behavior to be: just copy the tabs from the previous line. Nothing smarter than that.

Today, if I type something with an open brace, Sublime will try to “help” me and auto-indent for me:

foo { |

Even worse, if I then type a close brace, it UN-indents!

foo { }|

If I turn off auto-indent, then it completely ignores tabs:

foo { |

Which is also wrong (for me).

Instead, I just want it to copy whatever tabs existed on the previous line, with no extra “help”.

foo { |

I was wondering if anyone could provide an answer.

Thank you.

(also, this was outlined by someone else, with my same preference, here: stackoverflow.com/questions/1129 … er-bracket )

0 Likes

[ST2/3] Smart Indent setting broken
#2

I would love this too. It’s been doing the current thing for years, and people have brought it up before.

0 Likes

#3

Yes. auto-indent should just maintain the current indent level, while smart-indent should add indents based on language semantics. The latter should be highly configurable too. Sublime could definitely improve in this area and this kind of stuff is very simple to achieve.

Another related thing that does my head in is the lack of a cursorless line selection mode. Pasting code blocks around can be a PITA. Although Paste and Indent helps, it falls short a number of times, especially when we haven’t exactly selected lines before copying. Line selection mode means that what is copied, and pasted/inserted, are always whole lines. This is much less fiddly behaviour for code editing, never breaking the current line when inserting.

Unfortunately it’s details like these that keep a good deal of users away from Sublime.

:smile:

0 Likes

#4

Don’t you want your code look like this at the end ?

foo { blabla }
This is the result if you type your code in one sequence, without the need to hit the tab key once.
When editing some code, smart_indent is more a hit-and-miss.
I’ve found it very useful once you have learned how it works.

As described in the answer of your stackoveflow link (http://stackoverflow.com/a/13756901), the .tmPreferences file in the language package (\Sublime Text 2\Packages\JavaScript\JavaScript Indent.tmPreferences for JavaScript) define the behavior of the smart_indent.

0 Likes

#5

No, I don’t want my code to look like that.

I use double-tabs quite a bit in my code (example below).

Yes, I understand what Sublime is trying to force me to do – I just don’t want that. And quite frankly, it’s the main thing stopping me from using Sublime over Notepad++. Notepad++ and gedit both have the behavior I describe, so I use them on Windows and Linux. I would love to use Sublime on both, and have a consistent experience across both platforms, along with the extra features of Sublime… But I’m not going to change how I code to accommodate Sublime – the tool should accommodate my needs, not the other way. If Sublime is unable or unwilling, I just won’t use it shrug.

[code] expose.create = function() {
var taskCount = 0;
var storedErr = null;
var isFinished = false;
var done = function() {};

		var my = {
				add: function(taskFunc) {
						taskCount++;
						nextTick(function() {
								taskFunc(function(err) {
										taskCount--;
										storedErr = storedErr || err;
										if (taskCount > 0 || isFinished)
											return;
										isFinished = true;
										done(storedErr);
									});
							});
					},
				done: function(doneFunc) {
						done = doneFunc;
					}
			};
		return my;
	};[/code]
0 Likes