feat(SublimeText2.EditorPackages): cache packages

This commit is contained in:
Iristyle
2013-04-04 08:55:15 -04:00
parent d65666cdfc
commit c3efdad2c2
274 changed files with 26863 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
[
{
"caption": "Clipboard Manager: Cut",
"command": "clipboard_manager_cut"
},
{
"caption": "Clipboard Manager: Copy",
"command": "clipboard_manager_copy"
},
{
"caption": "Clipboard Manager: Paste",
"command": "clipboard_manager_paste"
},
{
"caption": "Clipboard Manager: Next & Paste",
"command": "clipboard_manager_next_and_paste"
},
{
"caption": "Clipboard Manager: Previous & Paste",
"command": "clipboard_manager_previous_and_paste"
},
{
"caption": "Clipboard Manager: Next",
"command": "clipboard_manager_next"
},
{
"caption": "Clipboard Manager: Previous",
"command": "clipboard_manager_previous"
},
{
"caption": "Clipboard Manager: Choose & Paste",
"command": "clipboard_manager_choose_and_paste"
},
{
"caption": "Clipboard Manager: Show History",
"command": "clipboard_manager_show"
},
{
"caption": "Clipboard Manager: Show Registers",
"command": "clipboard_manager_show_registers"
}
]

View File

@@ -0,0 +1,96 @@
[
{ "keys": ["super+x"], "command": "clipboard_manager_cut" },
{ "keys": ["super+c"], "command": "clipboard_manager_copy" },
{ "keys": ["super+v"], "command": "clipboard_manager_paste", "args": { "indent": true } },
{ "keys": ["super+ctrl+v"], "command": "clipboard_manager_paste", "args": { "indent": false } },
{ "keys": ["super+alt+v"], "command": "clipboard_manager_next_and_paste" },
{ "keys": ["super+shift+v"], "command": "clipboard_manager_previous_and_paste" },
{ "keys": ["super+pageup"], "command": "clipboard_manager_next" },
{ "keys": ["super+pagedown"], "command": "clipboard_manager_previous" },
{ "keys": ["super+home"], "command": "clipboard_manager_show" },
{ "keys": ["super+end"], "command": "clipboard_manager_show_registers" },
{ "keys": ["super+alt+ctrl+v"], "command": "clipboard_manager_choose_and_paste" },
{ "keys": ["super+ctrl+shift+v", "?"], "command": "clipboard_manager_show_registers" },
{ "keys": ["super+ctrl+shift+v", "/"], "command": "clipboard_manager_show" },
{ "keys": ["super+ctrl+shift+c", "1"], "command": "clipboard_manager_copy_to_register", "args": { "register": "1" } },
{ "keys": ["super+ctrl+shift+c", "2"], "command": "clipboard_manager_copy_to_register", "args": { "register": "2" } },
{ "keys": ["super+ctrl+shift+c", "3"], "command": "clipboard_manager_copy_to_register", "args": { "register": "3" } },
{ "keys": ["super+ctrl+shift+c", "4"], "command": "clipboard_manager_copy_to_register", "args": { "register": "4" } },
{ "keys": ["super+ctrl+shift+c", "5"], "command": "clipboard_manager_copy_to_register", "args": { "register": "5" } },
{ "keys": ["super+ctrl+shift+c", "6"], "command": "clipboard_manager_copy_to_register", "args": { "register": "6" } },
{ "keys": ["super+ctrl+shift+c", "7"], "command": "clipboard_manager_copy_to_register", "args": { "register": "7" } },
{ "keys": ["super+ctrl+shift+c", "8"], "command": "clipboard_manager_copy_to_register", "args": { "register": "8" } },
{ "keys": ["super+ctrl+shift+c", "9"], "command": "clipboard_manager_copy_to_register", "args": { "register": "9" } },
{ "keys": ["super+ctrl+shift+c", "0"], "command": "clipboard_manager_copy_to_register", "args": { "register": "0" } },
{ "keys": ["super+ctrl+shift+c", "a"], "command": "clipboard_manager_copy_to_register", "args": { "register": "a" } },
{ "keys": ["super+ctrl+shift+c", "b"], "command": "clipboard_manager_copy_to_register", "args": { "register": "b" } },
{ "keys": ["super+ctrl+shift+c", "c"], "command": "clipboard_manager_copy_to_register", "args": { "register": "c" } },
{ "keys": ["super+ctrl+shift+c", "d"], "command": "clipboard_manager_copy_to_register", "args": { "register": "d" } },
{ "keys": ["super+ctrl+shift+c", "e"], "command": "clipboard_manager_copy_to_register", "args": { "register": "e" } },
{ "keys": ["super+ctrl+shift+c", "f"], "command": "clipboard_manager_copy_to_register", "args": { "register": "f" } },
{ "keys": ["super+ctrl+shift+c", "g"], "command": "clipboard_manager_copy_to_register", "args": { "register": "g" } },
{ "keys": ["super+ctrl+shift+c", "h"], "command": "clipboard_manager_copy_to_register", "args": { "register": "h" } },
{ "keys": ["super+ctrl+shift+c", "i"], "command": "clipboard_manager_copy_to_register", "args": { "register": "i" } },
{ "keys": ["super+ctrl+shift+c", "j"], "command": "clipboard_manager_copy_to_register", "args": { "register": "j" } },
{ "keys": ["super+ctrl+shift+c", "k"], "command": "clipboard_manager_copy_to_register", "args": { "register": "k" } },
{ "keys": ["super+ctrl+shift+c", "l"], "command": "clipboard_manager_copy_to_register", "args": { "register": "l" } },
{ "keys": ["super+ctrl+shift+c", "m"], "command": "clipboard_manager_copy_to_register", "args": { "register": "m" } },
{ "keys": ["super+ctrl+shift+c", "n"], "command": "clipboard_manager_copy_to_register", "args": { "register": "n" } },
{ "keys": ["super+ctrl+shift+c", "o"], "command": "clipboard_manager_copy_to_register", "args": { "register": "o" } },
{ "keys": ["super+ctrl+shift+c", "p"], "command": "clipboard_manager_copy_to_register", "args": { "register": "p" } },
{ "keys": ["super+ctrl+shift+c", "q"], "command": "clipboard_manager_copy_to_register", "args": { "register": "q" } },
{ "keys": ["super+ctrl+shift+c", "r"], "command": "clipboard_manager_copy_to_register", "args": { "register": "r" } },
{ "keys": ["super+ctrl+shift+c", "s"], "command": "clipboard_manager_copy_to_register", "args": { "register": "s" } },
{ "keys": ["super+ctrl+shift+c", "t"], "command": "clipboard_manager_copy_to_register", "args": { "register": "t" } },
{ "keys": ["super+ctrl+shift+c", "u"], "command": "clipboard_manager_copy_to_register", "args": { "register": "u" } },
{ "keys": ["super+ctrl+shift+c", "v"], "command": "clipboard_manager_copy_to_register", "args": { "register": "v" } },
{ "keys": ["super+ctrl+shift+c", "w"], "command": "clipboard_manager_copy_to_register", "args": { "register": "w" } },
{ "keys": ["super+ctrl+shift+c", "x"], "command": "clipboard_manager_copy_to_register", "args": { "register": "x" } },
{ "keys": ["super+ctrl+shift+c", "y"], "command": "clipboard_manager_copy_to_register", "args": { "register": "y" } },
{ "keys": ["super+ctrl+shift+c", "z"], "command": "clipboard_manager_copy_to_register", "args": { "register": "z" } },
{ "keys": ["super+ctrl+shift+v", "1"], "command": "clipboard_manager_paste_from_register", "args": { "register": "1" } },
{ "keys": ["super+ctrl+shift+v", "2"], "command": "clipboard_manager_paste_from_register", "args": { "register": "2" } },
{ "keys": ["super+ctrl+shift+v", "3"], "command": "clipboard_manager_paste_from_register", "args": { "register": "3" } },
{ "keys": ["super+ctrl+shift+v", "4"], "command": "clipboard_manager_paste_from_register", "args": { "register": "4" } },
{ "keys": ["super+ctrl+shift+v", "5"], "command": "clipboard_manager_paste_from_register", "args": { "register": "5" } },
{ "keys": ["super+ctrl+shift+v", "6"], "command": "clipboard_manager_paste_from_register", "args": { "register": "6" } },
{ "keys": ["super+ctrl+shift+v", "7"], "command": "clipboard_manager_paste_from_register", "args": { "register": "7" } },
{ "keys": ["super+ctrl+shift+v", "8"], "command": "clipboard_manager_paste_from_register", "args": { "register": "8" } },
{ "keys": ["super+ctrl+shift+v", "9"], "command": "clipboard_manager_paste_from_register", "args": { "register": "9" } },
{ "keys": ["super+ctrl+shift+v", "0"], "command": "clipboard_manager_paste_from_register", "args": { "register": "0" } },
{ "keys": ["super+ctrl+shift+v", "a"], "command": "clipboard_manager_paste_from_register", "args": { "register": "a" } },
{ "keys": ["super+ctrl+shift+v", "b"], "command": "clipboard_manager_paste_from_register", "args": { "register": "b" } },
{ "keys": ["super+ctrl+shift+v", "c"], "command": "clipboard_manager_paste_from_register", "args": { "register": "c" } },
{ "keys": ["super+ctrl+shift+v", "d"], "command": "clipboard_manager_paste_from_register", "args": { "register": "d" } },
{ "keys": ["super+ctrl+shift+v", "e"], "command": "clipboard_manager_paste_from_register", "args": { "register": "e" } },
{ "keys": ["super+ctrl+shift+v", "f"], "command": "clipboard_manager_paste_from_register", "args": { "register": "f" } },
{ "keys": ["super+ctrl+shift+v", "g"], "command": "clipboard_manager_paste_from_register", "args": { "register": "g" } },
{ "keys": ["super+ctrl+shift+v", "h"], "command": "clipboard_manager_paste_from_register", "args": { "register": "h" } },
{ "keys": ["super+ctrl+shift+v", "i"], "command": "clipboard_manager_paste_from_register", "args": { "register": "i" } },
{ "keys": ["super+ctrl+shift+v", "j"], "command": "clipboard_manager_paste_from_register", "args": { "register": "j" } },
{ "keys": ["super+ctrl+shift+v", "k"], "command": "clipboard_manager_paste_from_register", "args": { "register": "k" } },
{ "keys": ["super+ctrl+shift+v", "l"], "command": "clipboard_manager_paste_from_register", "args": { "register": "l" } },
{ "keys": ["super+ctrl+shift+v", "m"], "command": "clipboard_manager_paste_from_register", "args": { "register": "m" } },
{ "keys": ["super+ctrl+shift+v", "n"], "command": "clipboard_manager_paste_from_register", "args": { "register": "n" } },
{ "keys": ["super+ctrl+shift+v", "o"], "command": "clipboard_manager_paste_from_register", "args": { "register": "o" } },
{ "keys": ["super+ctrl+shift+v", "p"], "command": "clipboard_manager_paste_from_register", "args": { "register": "p" } },
{ "keys": ["super+ctrl+shift+v", "q"], "command": "clipboard_manager_paste_from_register", "args": { "register": "q" } },
{ "keys": ["super+ctrl+shift+v", "r"], "command": "clipboard_manager_paste_from_register", "args": { "register": "r" } },
{ "keys": ["super+ctrl+shift+v", "s"], "command": "clipboard_manager_paste_from_register", "args": { "register": "s" } },
{ "keys": ["super+ctrl+shift+v", "t"], "command": "clipboard_manager_paste_from_register", "args": { "register": "t" } },
{ "keys": ["super+ctrl+shift+v", "u"], "command": "clipboard_manager_paste_from_register", "args": { "register": "u" } },
{ "keys": ["super+ctrl+shift+v", "v"], "command": "clipboard_manager_paste_from_register", "args": { "register": "v" } },
{ "keys": ["super+ctrl+shift+v", "w"], "command": "clipboard_manager_paste_from_register", "args": { "register": "w" } },
{ "keys": ["super+ctrl+shift+v", "x"], "command": "clipboard_manager_paste_from_register", "args": { "register": "x" } },
{ "keys": ["super+ctrl+shift+v", "y"], "command": "clipboard_manager_paste_from_register", "args": { "register": "y" } },
{ "keys": ["super+ctrl+shift+v", "z"], "command": "clipboard_manager_paste_from_register", "args": { "register": "z" } }
]

View File

@@ -0,0 +1,123 @@
Clipboard Manager plugin for Sublime Text 2
===========================================
A version of the Sublime Text 2 plugin at <http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2260&start=0>
that makes for TextMate-like clipboard history.
Originally written by AJ Palkovic ([ajpalkovic](https://github.com/ajpalkovic/SublimePlugins)),
modified by Martin Aspeli ([optilude](https://gist.github.com/1132507)), and
further modified and packaged for `Package Control` by Colin Thomas-Arnold
([colinta](https://github.com/colinta/SublimeClipboardManager))
My version of this plugin *does not use* `clipboard_history` as the prefix. See
the full command-list below.
Installation
------------
1. Using Package Control, install "Clipboard Manager"
Or:
1. Open the Sublime Text 2 Packages folder
- OS X: ~/Library/Application Support/Sublime Text 2/Packages/
- Windows: %APPDATA%/Sublime Text 2/Packages/
- Linux: ~/.Sublime Text 2/Packages/
2. clone this repo
3. Install keymaps for the commands (see Example.sublime-keymap for my preferred keys)
Commands
--------
**The basics**
`clipboard_manager_cut`: Self Explanatory
`clipboard_manager_copy`: Self Explanatory
`clipboard_manager_paste`: Self Explanatory.
*Options*: indent (default: False): Determines whether to use the `paste` or
`paste_and_indent` built-in command.
- - - - - -
**Navigating clipboard history**
`clipboard_manager_next_and_paste` (`super+alt+v`)
Goes to the next entry in the history and pastes it.
*Options*: indent (default: `False`)
`clipboard_manager_previous_and_paste` (`super+shift+v`)
Goes to the previous entry in the history and pastes it.
*Options*: indent (default: `False`)
`clipboard_manager_next` (`super+pageup` aka `super+fn+up`)
Goes to the next entry in the history, but doesn't paste. (the content will
appear as a status message)
`clipboard_manager_previous` (`super+pagedown` aka `super+fn+down`)
Goes to the previous entry in the history, but doesn't paste. (the content will
appear as a status message)
`clipboard_manager_choose_and_paste` (`super+ctrl+alt+v`)
Shows the clipboard history in a "quick panel".
`clipboard_manager_show` (`super+ctrl+shift+v, /`)
Shows the clipboard history in an "output panel", and points to the current
clipboard item. This was mostly useful for development, but you might find it
beneficial as well.
- - - - - -
**Registers**
Right now registers do not add/remove from the clipboard history. *This may
change!!* I would appreciate feedback about this feature.
`clipboard_manager_copy_to_register` (there are a ton, e.g. `super+ctrl+shift+c, 1`, `super+ctrl+shift+c, a`)
Puts the selection into a `register`. The example keymap includes a register
binding for every number and letter. Register keys should be single characters.
`clipboard_manager_paste_from_register` (`super+ctrl+shift+v, 1`, `super+ctrl+shift+v, a`)
Pastes the contents of a `register`. Again, there are lots of example key
bindings.
`clipboard_manager_show_registers` (`super+ctrl+shift+v, ?`)
Shows the clipboard registers in an "output panel", similar to
`clipboard_manager_show`.
- - - - - -
**Helpful Tips**
There are two ways to find out what you've got hanging out in your clipboard
history, you should use both. The `clipboard_manager_choose_and_paste` command
is your goto. It uses the fuzzy finder input panel, so you can quickly find and
paste the entry you want.
The other useful trick is to use `clipboard_manager_show` to show an output
panel at the bottom of the screen. As you scroll through history using
`clipboard_manager_next` and `clipboard_manager_previous`, it will update that
panel, with an arrow pointing the current entry. Then you can
`clipboard_manager_next_and_paste`, and it will get updated then, too. Keeps
you sane if you're doing something crazy.
If you've got a repetive task to do, with lots of copy/pastes, use registers.
They do not get affected by usual copy/pasting, so you can rest assured that
your work flow will not get affected. The keyboard shortcuts are unfortunately
quite verbose (`super+ctrl+shift+c, letter/digit`), but look at
Example.sublime-keymap and you'll see that it is easy to assign a quicker
shortcut for registers you like to use. Registers do not have to be one letter,
any string can be used as the key.

View File

@@ -0,0 +1,230 @@
import sublime
import sublime_plugin
class HistoryList(list):
"""
List type for storing the history.
Maintains a "pointer" to the current clipboard item
"""
registers = {}
SIZE = 256
__index = 0
def show(self):
ret = ""
ret += " CLIPBOARD HISTORY (%d)\n" % len(self)
ret += "====================%s==\n" % ("=" * len(str(len(self))))
for i, item in enumerate(self):
if i == self.__index:
ret += '--> '
else:
ret += ' '
item = item.replace("\t", '\\t')
item = item.replace("\r\n", "\n")
item = item.replace("\r", "\n")
item = item.replace("\n", "\n" + ' > ')
ret += u'{i:>3}. {item}\n'.format(i=str(i + 1)[-3:], item=item)
return ret
def show_registers(self):
ret = ""
ret += " CLIPBOARD REGISTERS (%d)\n" % len(self.registers.items())
ret += "=====================%s==\n" % ("=" * len(str(len(self.registers.items()))))
for key, item in self.registers.iteritems():
item = item.replace("\t", '\\t')
item = item.replace("\r\n", "\n")
item = item.replace("\r", "\n")
item = item.replace("\n", "\n" + ' > ')
ret += u'{key:<1}: {item}\n'.format(key=key, item=item)
return ret
def register(self, register, *args):
if args:
if len(args) == 1:
copy = args[0]
else:
copy = "\n".join(args)
self.registers[register] = copy
copy = copy.replace("\t", "\\t")
copy = copy.replace("\n", "\\n")
copy = copy.replace("\r", "\\r")
sublime.status_message('Set Clipboard Register "{0}" to "{1}"'.format(register, copy))
else:
return self.registers[register]
def append(self, item):
"""
Appends to the history only if it isn't the current item.
"""
if not self or self[self.__index] != item:
self.insert(0, item)
self.__index = 0
if len(self) > self.SIZE:
del self[self.SIZE:]
def current(self):
if len(self) == 0:
return None
return self[self.__index]
def at(self, idx):
self.__index = (idx if idx < len(self) else 0)
self.status()
def next(self):
if self.__index > 0:
self.__index -= 1
self.status()
def previous(self):
if self.__index < len(self) - 1:
self.__index += 1
self.status()
def first(self):
""""first" actually kind of means "last", since this is a FIFO stack"""
self.__index = len(self) - 1
self.status()
def last(self):
""""last" actually kind of means "first", since this is a FIFO stack"""
self.__index = 0
self.status()
def status(self):
copy = self.current()
copy = copy.replace("\t", "\\t")
copy = copy.replace("\n", "\\n")
copy = copy.replace("\r", "\\r")
sublime.status_message(u'Set Clipboard to "{copy}"'.format(copy=copy))
sublime.set_clipboard(self.current())
HISTORY = HistoryList([sublime.get_clipboard()])
def append_clipboard():
# append the contents of the clipboard to the history
HISTORY.append(sublime.get_clipboard())
class ClipboardManagerPaste(sublime_plugin.TextCommand):
def run(self, edit, indent=False):
if indent:
self.view.run_command('paste_and_indent')
else:
self.view.run_command('paste')
class ClipboardManagerCut(sublime_plugin.TextCommand):
def run(self, edit):
# First run sublime's command to extract the selected text.
# This will set the cut/copy'd data on the clipboard which we can easily steal without recreating the cut/copy logic.
self.view.run_command('cut')
append_clipboard()
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerCopy(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command('copy')
append_clipboard()
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerCopyToRegister(sublime_plugin.TextCommand):
def run(self, edit, register):
self.view.run_command('copy')
HISTORY.register(register, sublime.get_clipboard())
self.view.window().run_command('clipboard_manager_show_registers', {'show': False})
class ClipboardManagerPasteFromRegister(sublime_plugin.TextCommand):
def run(self, edit, register):
sublime.set_clipboard(HISTORY.register(register))
self.view.run_command('paste')
class ClipboardManagerNext(sublime_plugin.TextCommand):
def run(self, edit):
HISTORY.next()
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerNextAndPaste(sublime_plugin.TextCommand):
def run(self, edit, indent=False):
HISTORY.next()
if indent:
self.view.run_command('paste_and_indent')
else:
self.view.run_command('paste')
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerPrevious(sublime_plugin.TextCommand):
def run(self, edit):
HISTORY.previous()
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerPreviousAndPaste(sublime_plugin.TextCommand):
def run(self, edit, indent=False):
HISTORY.previous()
if indent:
self.view.run_command('paste_and_indent')
else:
self.view.run_command('paste')
self.view.window().run_command('clipboard_manager_show', {'show': False})
class ClipboardManagerShow(sublime_plugin.WindowCommand):
def run(self, show=True):
v = self.window.get_output_panel('clipboard_manager')
e = v.begin_edit('clipboard_manager')
v.replace(e, sublime.Region(0, v.size()), '')
v.insert(e, 0, HISTORY.show())
v.end_edit(e)
if show:
self.window.run_command('show_panel', {'panel': 'output.clipboard_manager'})
class ClipboardManagerShowRegisters(sublime_plugin.WindowCommand):
def run(self, show=True):
v = self.window.get_output_panel('clipboard_manager')
e = v.begin_edit('clipboard_manager')
v.replace(e, sublime.Region(0, v.size()), '')
v.insert(e, 0, HISTORY.show_registers())
v.end_edit(e)
if show:
self.window.run_command('show_panel', {'panel': 'output.clipboard_manager'})
class ClipboardManagerChooseAndPaste(sublime_plugin.TextCommand):
def run(self, edit):
def format(line):
return line.replace('\n', '\\n')[:64]
lines = []
line_map = {}
# filter out duplicates, keeping the first instance, and format
for i, line in enumerate(HISTORY):
if i == HISTORY.index(line):
line_map[len(lines)] = i
lines.append(format(line))
def on_done(idx):
if idx >= 0:
idx = line_map[idx]
HISTORY.at(idx)
self.view.run_command('paste')
if lines:
sublime.active_window().show_quick_panel(lines, on_done)
else:
sublime.status_message('Nothing in history')
class ClipboardManagerEventListener(sublime_plugin.EventListener):
def on_activated(self, view):
append_clipboard()

View File

@@ -0,0 +1 @@
{"url": "https://gist.github.com/1590661", "version": "1.2.3", "description": "A version of the Sublime Text 2 plugin at <http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2260&start=0> that makes for TextMate-like clipboard history."}

View File

@@ -0,0 +1,7 @@
{
"repo": "SublimeClipboardManager",
"name": "Clipboard Manager",
"description": "A version of the Sublime Text 2 plugin at <http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2260&start=0> that makes for TextMate-like clipboard history.",
"author": "AJ Palkovic (ajpalkovic), Martin Aspeli (optilude) and Colin Thomas-Arnold (colinta)",
"homepage": "https://gist.github.com/1590661"
}