Skip to content

Commit

Permalink
Apply changes from commmnts in #33
Browse files Browse the repository at this point in the history
  • Loading branch information
titoBouzout committed Sep 11, 2012
1 parent 75de93c commit 232e208
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
26 changes: 13 additions & 13 deletions README.markdown
Expand Up @@ -17,7 +17,7 @@ Go to your Packages subdirectory under ST2's data directory:
Then clone this repository: Then clone this repository:


git clone git://github.com/SublimeText/WordHighlight.git git clone git://github.com/SublimeText/WordHighlight.git

That's it! That's it!


Options Options
Expand All @@ -26,41 +26,41 @@ Options
Under the Packages/WordHighlight sub-directory, edit the `Word Highlight.sublime-settings` file: Under the Packages/WordHighlight sub-directory, edit the `Word Highlight.sublime-settings` file:


* `"draw_outlined" : true` * `"draw_outlined" : true`

This makes the highlights be drawn as outlines instead of as filled This makes the highlights be drawn as outlines instead of as filled
highlights. highlights.
* `"marking_occurrences_on_gutter" : true` * `"mark_occurrences_on_gutter" : true`


If this comes true, icons will be used to mark all occurrences of selected words on the gutter bar. If this comes true, icons will be used to mark all occurrences of selected words on the gutter bar.
To customize the icons, the property "icon_type_on_gutter" is helpful. To customize the icons, the property "icon_type_on_gutter" is helpful.

* `"icon_type_on_gutter" : dot` * `"icon_type_on_gutter" : dot`

Normally, there are 4 valid types: dot, circle, bookmark and cross. If you want more, please Normally, there are 4 valid types: dot, circle, bookmark and cross. If you want more, please
have a look at folder "Theme - Default" under the "Packages" of Sublime Text (this can be done have a look at folder "Theme - Default" under the "Packages" of Sublime Text (this can be done
via menu "Preferences > Browse Packages"). via menu "Preferences > Browse Packages").


* `"highlight_when_selection_is_empty" : true` * `"highlight_when_selection_is_empty" : true`

This makes words highlight when the insertion point is inside of them but when This makes words highlight when the insertion point is inside of them but when
they're not actually selected. they're not actually selected.


* `"highlight_word_under_cursor_when_selection_is_empty" : true` * `"highlight_word_under_cursor_when_selection_is_empty" : true`

When the previous option is enabled, this makes the word under the cursor to gain highlighting When the previous option is enabled, this makes the word under the cursor to gain highlighting


* `"highlight_delay" : 0` * `"highlight_delay" : 0`

This delays highlighting all occurrences using given time (in miliseconds) to let users move cursor This delays highlighting all occurrences using given time (in miliseconds) to let users move cursor
around without being distracted with immediate highlights. Default value 0 means almost no delay. around without being distracted with immediate highlights. Default value 0 means almost no delay.


* `"color_scope_name" : "wordhighlight"` * `"color_scope_name" : "wordhighlight"`

Normally the color of the highlights is the same as the color of comments in Normally the color of the highlights is the same as the color of comments in
your code. If you'd like to customize the color, add the below to your color your code. If you'd like to customize the color, add the below to your color
scheme file and change EDF2E9 to whatever color you want, then change scheme file and change EDF2E9 to whatever color you want, then change
color_scope_name to the scope name in the block you added. color_scope_name to the scope name in the block you added.

<dict> <dict>
<key>name</key> <key>name</key>
<string>WordHighlight</string> <string>WordHighlight</string>
Expand All @@ -74,10 +74,10 @@ Under the Packages/WordHighlight sub-directory, edit the `Word Highlight.sublime
</dict> </dict>


* `"file_size_limit" : 4194304` * `"file_size_limit" : 4194304`

Files bigger than this number will put WordHighlight on mode "highlight around view port" (a portion of the document) Files bigger than this number will put WordHighlight on mode "highlight around view port" (a portion of the document)


* `"when_file_size_limit_search_this_num_of_characters" : 20000` * `"when_file_size_limit_search_this_num_of_characters" : 20000`

When a file is bigger than the previous setting. This controls how many characters below and above the view port you want to search for words to highlight When a file is bigger than the previous setting. This controls how many characters below and above the view port you want to search for words to highlight


7 changes: 4 additions & 3 deletions Word Highlight.sublime-settings
Expand Up @@ -2,9 +2,10 @@
"color_scope_name": "comment", "color_scope_name": "comment",
"case_sensitive": true, "case_sensitive": true,
"draw_outlined": true, "draw_outlined": true,
"marking_occurrences_on_gutter" : true,
// valid types: dot, circle, bookmark and cross "mark_occurrences_on_gutter" : false,
"icon_type_on_gutter" : "dot", // valid types: dot, circle, bookmark and cross
"icon_type_on_gutter" : "dot",


"highlight_delay": 0, "highlight_delay": 0,
"highlight_when_selection_is_empty": false, "highlight_when_selection_is_empty": false,
Expand Down
4 changes: 2 additions & 2 deletions word_highlight.py
Expand Up @@ -15,7 +15,7 @@ def load(self):
Pref.highlight_delay = settings.get('highlight_delay', 0) Pref.highlight_delay = settings.get('highlight_delay', 0)
Pref.case_sensitive = (not bool(settings.get('case_sensitive', True))) * sublime.IGNORECASE Pref.case_sensitive = (not bool(settings.get('case_sensitive', True))) * sublime.IGNORECASE
Pref.draw_outlined = bool(settings.get('draw_outlined', True)) * sublime.DRAW_OUTLINED Pref.draw_outlined = bool(settings.get('draw_outlined', True)) * sublime.DRAW_OUTLINED
Pref.marking_occurrences_on_gutter = bool(settings.get('marking_occurrences_on_gutter', True)) Pref.mark_occurrences_on_gutter = bool(settings.get('mark_occurrences_on_gutter', False))
Pref.icon_type_on_gutter = settings.get("icon_type_on_gutter", "dot") Pref.icon_type_on_gutter = settings.get("icon_type_on_gutter", "dot")
Pref.highlight_when_selection_is_empty = bool(settings.get('highlight_when_selection_is_empty', False)) Pref.highlight_when_selection_is_empty = bool(settings.get('highlight_when_selection_is_empty', False))
Pref.highlight_word_under_cursor_when_selection_is_empty = bool(settings.get('highlight_word_under_cursor_when_selection_is_empty', False)) Pref.highlight_word_under_cursor_when_selection_is_empty = bool(settings.get('highlight_word_under_cursor_when_selection_is_empty', False))
Expand Down Expand Up @@ -129,7 +129,7 @@ def highlight_occurences(self, view):
view.erase_regions("WordHighlight") view.erase_regions("WordHighlight")
if regions: if regions:
if Pref.highlight_delay == 0: if Pref.highlight_delay == 0:
view.add_regions("WordHighlight", regions, Pref.color_scope_name, Pref.icon_type_on_gutter if Pref.marking_occurrences_on_gutter else "", Pref.draw_outlined) view.add_regions("WordHighlight", regions, Pref.color_scope_name, Pref.icon_type_on_gutter if Pref.mark_occurrences_on_gutter else "", Pref.draw_outlined)
view.set_status("WordHighlight", ", ".join(list(set(occurrencesMessage))) + (' found on a limited portion of the document ' if limited_size else '')) view.set_status("WordHighlight", ", ".join(list(set(occurrencesMessage))) + (' found on a limited portion of the document ' if limited_size else ''))
else: else:
sublime.set_timeout(lambda:self.delayed_highlight(view, regions, occurrencesMessage, limited_size), Pref.highlight_delay) sublime.set_timeout(lambda:self.delayed_highlight(view, regions, occurrencesMessage, limited_size), Pref.highlight_delay)
Expand Down

0 comments on commit 232e208

Please sign in to comment.