Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ingshtrom
committed
Jan 16, 2013
1 parent
9662537
commit a96c701
Showing
4 changed files
with
97 additions
and
96 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*.pyc | ||
*.cache | ||
*.sublime-project | ||
.DS_store | ||
*.pyc | ||
*.cache | ||
*.sublime-project | ||
.DS_store | ||
.c9revisions |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
# SublimeBlockCursor # | ||
|
||
![Screenshot](http://f.cl.ly/items/42131K2X1h0j0P2m1O2B/Screen%20Shot%202011-12-02%20at%202.36.54%20AM.png) | ||
|
||
It can become very difficult to keep track of your cursor location. This is solved by having a "block" cursor, which is very easy to spot no matter where it is on screen. Unfortunately, Sublime Text 2 does not (yet) support this feature natively. This Plugin mimics this functionality by highlighting the area behind the cursor whenever it moves (similar to how you might highlight syntax errors, or color a comment). | ||
|
||
## Installation ## | ||
|
||
### With Package Control ### | ||
|
||
If you have the [Package Control][package_control] installed, you can install SublimeBlockCursor from inside Sublime Text itself. Open the Command Palette and select "Package Control: Install Package", then search for SublimeBlockCursor and you’re done! | ||
|
||
### Without Package Control ### | ||
|
||
Go to your Sublime Text 2 Packages directory: | ||
|
||
Windows: %USERPROFILE%\AppData\Roaming\Sublime Text 2\Packages\ | ||
Mac: ~/Library/Application Support/Sublime Text 2/Packages/ | ||
|
||
and clone the repository there | ||
|
||
git clone git://github.com/netpro2k/SublimeBlockCursor | ||
git clone git://github.com/ingshtrom/SublimeBlockCursor | ||
|
||
|
||
## Configuration ## | ||
|
||
These are the settings that I prefer. You can change the style of the block cursor by adding a section to your theme file like so: | ||
|
||
```xml | ||
<dict> | ||
<key>name</key> | ||
<string>Block Cursor</string> | ||
<key>scope</key> | ||
<string>block_cursor</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>foreground</key> | ||
<string>#000000</string> | ||
<key>background</key> | ||
<string>#FF1111</string> | ||
</dict> | ||
</dict> | ||
``` | ||
|
||
--------- | ||
|
||
[sublime]: http://www.sublimetext.com/2 | ||
[package_control]: http://wbond.net/sublime_packages/package_control | ||
# SublimeBlockCursor # | ||
|
||
![Screenshot](http://f.cl.ly/items/42131K2X1h0j0P2m1O2B/Screen%20Shot%202011-12-02%20at%202.36.54%20AM.png) | ||
|
||
It can become very difficult to keep track of your cursor location. This is solved by having a "block" cursor, which is very easy to spot no matter where it is on screen. Unfortunately, Sublime Text 2 does not (yet) support this feature natively. This Plugin mimics this functionality by highlighting the area behind the cursor whenever it moves (similar to how you might highlight syntax errors, or color a comment). | ||
|
||
## Installation ## | ||
|
||
### With Package Control ### | ||
|
||
If you have the [Package Control][package_control] installed, you can install SublimeBlockCursor from inside Sublime Text itself. Open the Command Palette and select "Package Control: Install Package", then search for SublimeBlockCursor and you’re done! | ||
|
||
### Without Package Control ### | ||
|
||
Go to your Sublime Text 2 Packages directory: | ||
|
||
Windows: %USERPROFILE%\AppData\Roaming\Sublime Text 2\Packages\ | ||
Mac: ~/Library/Application Support/Sublime Text 2/Packages/ | ||
|
||
and clone the repository there | ||
|
||
git clone git://github.com/netpro2k/SublimeBlockCursor | ||
git clone git://github.com/ingshtrom/SublimeBlockCursor | ||
|
||
|
||
## Configuration ## | ||
|
||
These are the settings that I prefer. You can change the style of the block cursor by adding a section to your theme file like so: | ||
|
||
```xml | ||
<dict> | ||
<key>name</key> | ||
<string>Block Cursor</string> | ||
<key>scope</key> | ||
<string>block_cursor</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>foreground</key> | ||
<string>#000000</string> | ||
<key>background</key> | ||
<string>#FF1111</string> | ||
</dict> | ||
</dict> | ||
``` | ||
|
||
--------- | ||
|
||
[sublime]: http://www.sublimetext.com/2 | ||
[package_control]: http://wbond.net/sublime_packages/package_control |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
import sublime | ||
import sublime_plugin | ||
|
||
|
||
class SublimeBlockCursor(sublime_plugin.EventListener): | ||
def view_is_widget(self, 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') or not("Vintage" in view.settings().get('ignored_packages') or view.settings().get('command_mode')): | ||
view.erase_regions('SublimeBlockCursorListener') | ||
return | ||
self.show_block_cursor(view) | ||
|
||
def on_deactivated(self, view): | ||
view.erase_regions('SublimeBlockCursorListener') | ||
view.settings().clear_on_change('command_mode') | ||
self.current_view = None | ||
|
||
def on_activated(self, view): | ||
self.on_selection_modified(view) | ||
view.settings().add_on_change('command_mode', self.on_command_mode_change) | ||
self.current_view = view | ||
|
||
def on_command_mode_change(self): | ||
import sublime | ||
import sublime_plugin | ||
|
||
|
||
class SublimeBlockCursor(sublime_plugin.EventListener): | ||
def view_is_widget(self, 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') or not("Vintage" in view.settings().get('ignored_packages') or view.settings().get('command_mode')): | ||
view.erase_regions('SublimeBlockCursorListener') | ||
return | ||
self.show_block_cursor(view) | ||
|
||
def on_deactivated(self, view): | ||
view.erase_regions('SublimeBlockCursorListener') | ||
view.settings().clear_on_change('command_mode') | ||
self.current_view = None | ||
|
||
def on_activated(self, view): | ||
self.on_selection_modified(view) | ||
view.settings().add_on_change('command_mode', self.on_command_mode_change) | ||
self.current_view = view | ||
|
||
def on_command_mode_change(self): | ||
self.on_selection_modified(self.current_view) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"url": "https://github.com/ingshtrom/SublimeBlockCursor", | ||
"version": "1.0.1", | ||
"description": "Sublime Text 2 plugin to mimic a block cursor in all modes.", | ||
"author": "ingshtrom", | ||
"homepage": "http://ingshtrom.tumblr.com" | ||
{ | ||
"name": "SublimeBlockCursorEverywhere", | ||
"url": "https://github.com/ingshtrom/SublimeBlockCursor", | ||
"version": "1.0.1", | ||
"description": "Sublime Text 2 plugin to mimic a block cursor in all modes. Forked from netpro2k/SublimeBlockCursor.", | ||
"author": "ingshtrom && netpro2k", | ||
"homepage": "http://ingshtrom.tumblr.com" | ||
} |