Home Download Buy Blog Forum Support

how to copy the scope?

how to copy the scope?

Postby nicktheandroid on Sun Feb 13, 2011 9:15 am

I found out how to view the scope for maybe 2 seconds in the status bar, but i've looked for 20 minutes or longer and cannot find how to copy that scope.....
i'm trying to create a textmate theme and i'm going insane... i've been going back and forth from sublime2 to aptana3 to e, trying to create a tmtheme, trying to understand what scope affects what part of my jquery/javascript, css, and html code...

help, pleasee...

how do you personally make a theme?
how do you know what the scope means and what it's referring to?

I'm using e to visualize the theme because i can copy the scope from within aptana, then go over to e text-editor and paste it into the theme editor and select the color, isn't there an easier way?
it looks like if you're actually using textmate it's pretty easy, but no other program has made it just as easy.... ARRRRRRRRRRRR
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: how to copy the scope?

Postby adzenith on Sun Feb 13, 2011 6:04 pm

Paste this into a .py file in your user packages folder:
Code: Select all
class CopyScopeToClipboardCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    syntax_name = self.view.syntax_name(self.view.sel()[0].begin())
    print(syntax_name)
    self.view.set_status("Scope",syntax_name)
    sublime.set_clipboard(syntax_name)

and then add this to your keymap file:
Code: Select all
  { "keys": ["ctrl+shift+c"], "command": "copy_scope_to_clipboard" },

Then you can hit ctrl+shift+c to copy the scope to the clipboard. It'll also set the status bar and print it to the console.

I've never made a theme so unfortunately I can't really help with that.
adzenith
 
Posts: 1204
Joined: Mon Oct 19, 2009 9:12 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 8 guests