From allan@macromates.com Wed May 25 23:38:10 2005 From: Allan Odgaard To: textmate@lists.macromates.com Subject: Scope (was: [TxMt] & drag commands) Date: Thu, 26 May 2005 01:37:58 +0200 Message-ID: <40F041C8-8133-4954-A8BC-D38DB5D79FB8@macromates.com> In-Reply-To: <42A9ED73-30C9-42B9-A501-24A77B68AA27@ideacog.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0166493641961774188==" --===============0166493641961774188== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On May 25, 2005, at 22:44, Ben Parzybok wrote: > The one thing that was different was the scope field, which I guess > I don't understand yet. The scope is where the command should be active (i.e. the language). If you have enabled the Language Definition bundle then try e.g. to place the caret on a string in PHP in HTML, then press ctrl-shift-T (a command that shows the current scope as a tooltip), it should show: text.html.basic source.php.embedded.html string.double-quoted.php This is the scope that the caret is in, and you can limit settings, styles, and bundle items to work only for a given scope. So scopes are very much like CSS selectors -- also, when you enter the scope, TextMate performs pattern matching, so you don't have to enter all of it, e.g. you could just enter: “string” and the (in this case) drag command would only be used, when you drag stuff onto strings. For something like a drag command you'd just set the first part of the scope, i.e. text.html versus text.latex or source.css. This btw means that if you have in a HTML file, dragging stuff to that section will get the appropriate drag command scoped to source.css, where dragging to outside this section will result in the commands scoped to text.html. There should be coverage of this in the release notes (for 1.1b6). --===============0166493641961774188==--