Created
June 26, 2012 15:32
-
-
Save kellishaver/2996448 to your computer and use it in GitHub Desktop.
Sublime Text 2 Block Cursor - outside of Vintage Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime | |
import sublime_plugin | |
class SublimeBlockCursor(sublime_plugin.EventListener): | |
def view_is_widget(view): | |
settings = view.settings() | |
return bool(settings.get('is_widget')) | |
def show_block_cursor(self, view): | |
validRegions = [] | |
for s in view.sel(): | |
if s.a != s.b: | |
continue | |
validRegions.append(sublime.Region(s.a, s.a + 1)) | |
if validRegions.__len__: | |
view.add_regions('SublimeBlockCursorListener', validRegions, 'block_cursor') | |
else: | |
view.erase_regions('SublimeBlockCursorListener') | |
def on_selection_modified(self, view): | |
if view.settings().get('is_widget'): | |
view.erase_regions('SublimeBlockCursorListener') | |
return | |
self.show_block_cursor(view) | |
def on_deactivated(self, view): | |
view.erase_regions('SublimeBlockCursorListener') | |
def on_activated(self, view): | |
self.show_block_cursor(view) |
Sweet!
Any chance you would want to publish to a git repo and make it available through package control?
http://wbond.net/sublime_packages/package_control
If not, I can do it....
Is it possible to get this to work with SublimeMarkAndMove?
Wow, I didn't even notice all of the comments on this until now. I've not used SublimeMarkAndMove (though I want to now that I know of its existence) so I'd have to look into it. I know this works with the regular multi-select that's baked in.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for making this available - much appreciated!