Hi All,
I'm new to Textmate, and I have to say I am most impressed! What a beautiful piece of software. I downloaded the 30 day trial, and I am having problems with one thing: reformatting php code.
Let's say I had a piece of code like this:
// make sure it doesn't crash in an ugly way if (!function_exists('foo')) { die("this function required"); }
and I run the reformat on it, or ^Q, then I get this:
// make sure it doesn't crash in an ugly way if (!function_exists('foo')) { die("this function required"); }
Not very helpful, and you notice that the 'if' is now on a comment line!
Note that this performs the same whether I have the file showing as HTML or PHP. Given the amount of work that's gone into PHP capability overall (great completion for example) I'm shocked that this is standard behavior out of the box.
Would love to get some tips from the textmate masters on here. Thank you! Brian Armstrong
On May 6, 2007, at 2:22 AM, Brian Armstrong wrote:
and I run the reformat on it, or ^Q, then I get this:
// make sure it doesn't crash in an ugly way if (!function_exists('foo')) { die("this function required"); }
Not very helpful, and you notice that the 'if' is now on a comment line!
^Q is a paragraph reformat, which as you have found is not so great for code. I believe what you are looking for is a way to (re-)indent code, in which case you want this:
Text -> Indent Selection ( cmd-opt-[ )
Note that you need to have a selection active for this to be available. Otherwise it will act on the current line only.
-dan
Le Sun 6/05/2007, Dan Lowe disait
On May 6, 2007, at 2:22 AM, Brian Armstrong wrote:
and I run the reformat on it, or ^Q, then I get this:
// make sure it doesn't crash in an ugly way if (!function_exists('foo')) { die("this function required"); }
Not very helpful, and you notice that the 'if' is now on a comment line!
^Q is a paragraph reformat, which as you have found is not so great for code. I believe what you are looking for is a way to (re-)indent code, in which case you want this:
Text -> Indent Selection ( cmd-opt-[ )
Note that you need to have a selection active for this to be available. Otherwise it will act on the current line only.
Is there a way to rebind this ? On a french keyboard, [ is Shift-opt-5 thus a problem to get opt-[
On 5/6/07, Erwan David erwan@rail.eu.org wrote:
Is there a way to rebind this ? On a french keyboard, [ is Shift-opt-5 thus a problem to get opt-[
I know what you feel about brackets in shortcuts. Quick, before someone, obviously not writing in french, advises you to switch to a US layout ;) :
You can change every menu key bindings in System Preferences, Keyboard & Mouse, Keyboard Shortcuts. Be sure to enter the exact menu title. I usually simply replace brackets by parenthesis.
The funny part is that key binding is the subject of today's Macromates blog post[1].
[1]: http://macromates.com/blog/archives/2007/05/06/textmates-many-key-shortcuts/
Le Sun 6/05/2007, Fred B disait
On 5/6/07, Erwan David erwan@rail.eu.org wrote:
Is there a way to rebind this ? On a french keyboard, [ is Shift-opt-5 thus a problem to get opt-[
I know what you feel about brackets in shortcuts. Quick, before someone, obviously not writing in french, advises you to switch to a US layout ;) :
You can change every menu key bindings in System Preferences, Keyboard & Mouse, Keyboard Shortcuts. Be sure to enter the exact menu title. I usually simply replace brackets by parenthesis.
The funny part is that key binding is the subject of today's Macromates blog post[1].
Thanks a lot.