Sublime Forum

20100527 Beta

#1

The 20100527 beta is out now, with changes centered around automatic indentation.

Firstly, the basic automatic indent system has been reworked: rather than using hard coded rules, it now uses TextMate preferences (decreaseIndentPattern and increaseIndentPattern in tmPreferences files) to determine when to increase and decrease the indentation level. The implementation goes something like this: when pressing enter, the desired amount of whitespace is inserted on the following line. This whitespace is marked with a magic tag, and it will be reevaluated as the line is edited. If the whitespace itself edited, or you start to edit another line, the magic tag will be removed, and the indentation on the line will be baked in.

The tag added to the whitespace is used for another purpose too: if you start editing another line without adding anything after the whitespace, the whitespace will be removed. This reduces the amount of unwanted trailing whitespace in files.

Another significant change is to the way paste works: when pasting in a block of lines, their indentation will be adjusted to match that of the cursor. You can paste with ctrl+shift+v to avoid this. This is a somewhat experimental change, and the behaviour may be reverted if it turns out to be annoying.

0 Likes

#2

Excellent, I’ll have a look tonight.

Thanks :smile:

0 Likes

#3

It would be very nice to have a configuration option to turn this behaviour on or off.

Meanwhile, the new functionality works well. Thank you! :smile:

0 Likes

#4

Is the feature supposed to remove all empty lines from the clipboard when pasting?

0 Likes

#5

Looks like a bug to me…

0 Likes

#6

I’m not sure if this was introduced in the current beta.
The menu shows the keybindings of the default package instead of the user package.
I have to comment all replaced keybindings in default/default.sublime-keymap to show the actual keybindings in the menu. :cry:

0 Likes

#7

Yesh, all my menu changes were overwritten by this update as well :neutral_face:

0 Likes

#8

@tgkeul: It’s always worked that way, although you raise a good point, it’d be better if it showed the most recent key binding for the command, rather than the first.

@sublimator: the ‘magic tag’ part is just tagging the region via the standard regions API (using the ‘autows’ key). It records in the per-selection meta info the original size of the region, to detect if it’s been edited.

0 Likes

#9

this version just broke my @ (ctrl+alt+v) which is now the bind for invertselection,
how can I unbind a key? please excuse my ignorance but I did try searching for this on the forum but stopped after the sixth page

0 Likes

#10

@sztanpet: I’ll remove that key binding for the next beta, but in the mean time you can remove it by editing Preferences/Default Key Bindings, and removing the line with invertSelection

0 Likes

#11

Yes, but that will be overwritten with new versions and I was looking for a more permanent solution. Which you now provided, much thanks.

0 Likes

#12

[quote=“Chortos-2”]

It would be very nice to have a configuration option to turn this behaviour on or off.

Meanwhile, the new functionality works well. Thank you! :smile:[/quote]

EDIT: I just saw that this was an option all along (trimAutomaticWhitespace). Sorry! And thanks!

0 Likes

#13

I’m having issues trying to setup Indentation Rules for Lua in 20100529 beta.

I’ve saved the following to %AppData%\Sublime Text\Packages\Lua\Indentation Rules.tmPreferences

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>name</key>
	<string>Indentation Rules</string>
	<key>scope</key>
	<string>source.lua</string>
	<key>settings</key>
	<dict>
		<key>increaseIndentPattern</key>
		<string>^.*\s+(do|then|else|repeat|\{)\s*$</string>
		<key>decreaseIndentPattern</key>
		<string>(^\s*(end\s*$)|(^\s*until)</string>
	</dict>
</dict>
</plist>

It stills seems to be using the old indentation system though, there’s no difference in functionality AFAICT.

0 Likes

#14

@naughty: Lua indentation rules should already be present in 20100529, in Packages/Lua/Indent.tmPreferences

0 Likes

#15

Well now I feel silly :^)

Thanks

0 Likes