Created
January 16, 2012 17:13
-
-
Save fbzhong/1621850 to your computer and use it in GitHub Desktop.
Sample for JavaScript Indent of TextMate 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following is what I want. | |
(function($, Animation, undefined) { | |
/** | |
* @desc Set visiblity to visible. | |
*/ | |
$.fn.visible = function() { | |
this.css('visibility', 'visible'); | |
}; | |
var test = function() { | |
var args = arguments, | |
x = args[0], | |
y = args[1]; | |
return $(x, y); | |
}; | |
var push = function(from, to) { | |
Animation.defer() | |
.translate3d(to, '100%', 0, 0, 0).then() | |
.slideLeft(from).slideLeft(to).then() | |
.run(function() { | |
/** | |
* @desc hide the from element. | |
*/ | |
from.hidden(); | |
}); | |
return this; | |
}; | |
}(jQuery, Animation)); | |
// The following is what I type in TextMate 2, without manual modification. | |
(function($, Animation, undefined) { | |
// <--- useless spaces. | |
/** | |
* @desc Set Visibility to visible. // <--- TM2 will auto delete a typed space before * | |
*/ | |
$.fn.visible = function() { | |
this.css('visibility', 'visible'); | |
}; | |
// <--- useless spaces. | |
var test = function() { | |
var args = arguments, | |
x = args[0], // <--- I wish the x indent to args. | |
y = args[1]; | |
return $(x, y); | |
}; | |
// Another version. | |
var test = function() { | |
var args = arguments, | |
x = args[0], | |
y = args[1]; // <--- I manually change the y indent. | |
return $(x, y); // <--- The return indent is not I want. | |
}; | |
// <--- useless spaces. | |
var push = function(from, to) { | |
Animation.defer() | |
.translate3d(to, '100%', 0, 0, 0).then() // <--- No auto indent... | |
.slideLeft(from).slideLeft(to).then() | |
.run(function() { | |
/** | |
* @desc hide the from element. | |
*/ | |
from.hidden(); | |
}); | |
return this; | |
}; | |
}(jQuery, Animation)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment