Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Last active December 24, 2015 13:59
Show Gist options
  • Save dongyuwei/6808772 to your computer and use it in GitHub Desktop.
Save dongyuwei/6808772 to your computer and use it in GitHub Desktop.
copy sublime text3's current selection into clipboard. Inspired by iterm2's `copy on select` feature.
import sublime, sublime_plugin
class Copy_on_select(sublime_plugin.EventListener):
def on_selection_modified(self, view):
for region in view.sel():
if not region.empty():
print(view.substr(region))
view.run_command('copy')
@dongyuwei
Copy link
Author

# for debugger:
print("selection modified") # shown in console panel(ctrl+`)
sublime.message_dialog("selection modified")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment