Hi,
I'm a new to textmate and loving it so far. i have a couple of questions that i've saved up after my first week of use that i was hoping someone could help me with:
* i find that snippets make it easy to add text - but i'm not so sure how to modify existing text. e.g. i find i am always commenting out code in css, so i added this snippet (and bound to a key):
/* $TM_SELECTED_TEXT */
great! ok, now how would i remove comments? (or even better, how to toggle comments on the current line?)
* hard-wrap: i know textmate doesn't support this out of the box, but with vi i always used "fmt". so here's my command which i bound to a key:
fmt << ___END___ $TM_SELECTED_TEXT ___END___
this isn't ideal (what if the text has ___END___ in it? fmt barfs on non-ascii, and i always get an extra newline.) is there a better way?
* some snippets show a series of options, which you cannot select (they just get erased when you start to type.) what's the idea - just a simple reminder - or am i using it wrong? e.g. in the css bundle:
list-style-type: ${1:none/disc/circle/square};$0
why not just make 4 snippets - so then you get the popup and can choose which one? (so i could hit '1' instead of typing in 'none'.)
well, i've got lots more questions, but that's probably enough for now.
:jason
On Oct 4, 2006, at 9:10 AM, Jason Moore wrote:
Hi,
I'm a new to textmate and loving it so far. i have a couple of questions that i've saved up after my first week of use that i was hoping someone could help me with:
- i find that snippets make it easy to add text - but i'm not so
sure how to modify existing text. e.g. i find i am always commenting out code in css, so i added this snippet (and bound to a key):
/* $TM_SELECTED_TEXT */
great! ok, now how would i remove comments? (or even better, how to toggle comments on the current line?)
Did you try command-/? ;) It's Comment Line / Selection in the Source bundle.
- hard-wrap: i know textmate doesn't support this out of the box,
but with vi i always used "fmt". so here's my command which i bound to a key:
fmt << ___END___ $TM_SELECTED_TEXT ___END___
this isn't ideal (what if the text has ___END___ in it? fmt barfs on non-ascii, and i always get an extra newline.) is there a better way?
Does control-Q help at all? That's Reformat Paragraph in the Text menu.
I believe you can change the command above to:
fmt <<< $TM_SELECTED_TEXT
- some snippets show a series of options, which you cannot select
(they just get erased when you start to type.) what's the idea - just a simple reminder - or am i using it wrong? e.g. in the css bundle:
list-style-type: ${1:none/disc/circle/square};$0
Yes, it's intended as a reminder.
why not just make 4 snippets - so then you get the popup and can choose which one? (so i could hit '1' instead of typing in 'none'.)
You could certainly do that. It will probably be a lot of snippets though, if you are going to expand them all.
Hope that helps.
James Edward Gray II
On 4-Oct-06, at 10:28 AM, James Edward Gray II wrote:
On Oct 4, 2006, at 9:10 AM, Jason Moore wrote:
great! ok, now how would i remove comments? (or even better, how to toggle comments on the current line?)
Did you try command-/? ;) It's Comment Line / Selection in the Source bundle.
duh. can't believe i didn't find that. perfect!
- hard-wrap: i know textmate doesn't support this out of the box...
Does control-Q help at all? That's Reformat Paragraph in the Text menu.
I believe you can change the command above to:
fmt <<< $TM_SELECTED_TEXT
the <<< works great. but "Reformat Paragraph" is much much better. (i must have read an old discussion about TM not supporting hard-wrapping.)
one other concept i'm trying to get - is how to replace existing text. e.g.
"h1 [tab] Welcome" gives me: <h1 id="welcome">Welcome</h1>
good. but is there an easy way to change it to: <h2 id="welcome">Welcome</h2> or <div id="welcome">Welcome</div> ?
:jason
On Oct 4, 2006, at 10:53 AM, Jason Moore wrote:
one other concept i'm trying to get - is how to replace existing text. e.g.
"h1 [tab] Welcome" gives me:
<h1 id="welcome">Welcome</h1>
good. but is there an easy way to change it to:
<h2 id="welcome">Welcome</h2> or <div id="welcome">Welcome</div> ?
OK, you slowed me down with that one. ;)
I can't think of an out-of-the-box solution for this one. I believe you will need to build a command for this.
James Edward Gray II