Skip to content

Commit

Permalink
Merge pull request #37 from mreq/master
Browse files Browse the repository at this point in the history
current_buffer_only option
  • Loading branch information
ice9js committed Feb 3, 2016
2 parents c492415 + 5df5547 commit 909c53b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ You can then override the bindings for any of the following commands:
- ```ace_jump_select```
- ```ace_jump_add_cursor```

The commands accept an optional Boolean `current_buffer_only` argument. When present and set to `true`, AceJump only performs on the currently edited buffer.

### Labels

Go to ```Preferences > Package Settings > AceJump > Settings - User```,
Expand Down
13 changes: 8 additions & 5 deletions ace_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@

mode = 0

def get_active_views(window):
def get_active_views(window, current_buffer_only):
"""Returns all currently visible views"""

views = []
for group in range(window.num_groups()):
views.append(window.active_view_in_group(group))
if current_buffer_only:
views.append(window.active_view())
else:
for group in range(window.num_groups()):
views.append(window.active_view_in_group(group))
return views

def set_views_setting(views, setting, values):
Expand Down Expand Up @@ -75,14 +78,14 @@ def clear_views_sel(views):
class AceJumpCommand(sublime_plugin.WindowCommand):
"""Base command class for AceJump plugin"""

def run(self):
def run(self, current_buffer_only = False):
self.char = ""
self.target = ""
self.views = []
self.changed_views = []
self.breakpoints = []

self.all_views = get_active_views(self.window)
self.all_views = get_active_views(self.window, current_buffer_only)
self.syntax = get_views_setting(self.all_views, "syntax")
self.sel = get_views_sel(self.all_views)

Expand Down

0 comments on commit 909c53b

Please sign in to comment.