Sublime Forum

How to copy the scope?

#1

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

0 Likes

#2

Paste this into a .py file in your user packages folder:

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:

{ "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.

1 Like