Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A small cleanup and version fixes

  • Loading branch information...
commit 9e5c4da910c650e537e1960800ec92cc5e5de27e 1 parent 1dd6ff2
@JesusLeon JesusLeon authored
View
21 Default (Linux).sublime-keymap
@@ -1,20 +1,5 @@
[
- {
- "keys": ["alt+ctrl+left"],
- "command": "split_screen_resizer",
- "args": {
- "side": "left",
- "ratio": "8:2",
- "autofocus": true
- }
- },
- {
- "keys": ["alt+ctrl+right"],
- "command": "split_screen_resizer",
- "args": {
- "side": "right",
- "ratio":"2:8",
- "autofocus": true
- }
- }
+ // SplitScreen-Resizer
+ { "keys": ["shift+alt+left"], "command": "split_screen_resizer", "args": {"side": "left"} },
+ { "keys": ["shift+alt+right"], "command": "split_screen_resizer", "args": {"side": "right"} }
]
View
21 Default (OSX).sublime-keymap
@@ -1,20 +1,5 @@
[
- {
- "keys": ["super+ctrl+left"],
- "command": "split_screen_resizer",
- "args": {
- "side": "left",
- "ratio": "8:2",
- "autofocus": true
- }
- },
- {
- "keys": ["super+ctrl+right"],
- "command": "split_screen_resizer",
- "args": {
- "side": "right",
- "ratio":"2:8",
- "autofocus": true
- }
- }
+ // SplitScreen-Resizer
+ { "keys": ["shift+alt+left"], "command": "split_screen_resizer", "args": {"side": "left"} },
+ { "keys": ["shift+alt+right"], "command": "split_screen_resizer", "args": {"side": "right"} }
]
View
21 Default (Windows).sublime-keymap
@@ -1,20 +1,5 @@
[
- {
- "keys": ["alt+ctrl+left"],
- "command": "split_screen_resizer",
- "args": {
- "side": "left",
- "ratio": "8:2",
- "autofocus": true
- }
- },
- {
- "keys": ["alt+ctrl+right"],
- "command": "split_screen_resizer",
- "args": {
- "side": "right",
- "ratio":"2:8",
- "autofocus":true
- }
- }
+ // SplitScreen-Resizer
+ { "keys": ["alt+ctrl+left"], "command": "split_screen_resizer", "args": {"side": "left"} },
+ { "keys": ["alt+ctrl+right"], "command": "split_screen_resizer", "args": {"side": "right"} }
]
View
30 README.md 100755 → 100644
@@ -1,36 +1,49 @@
SplitScreen-Resizer
===================
-A [Sublime Text 2][sublime_link] plugin created to switch and resize a 2-Columns layout with speed and comfort in mind. Just by pressing the key shortcuts you can make the desire column your working column by automatically give focus to it and make it wider.
+A [Sublime Text 2][sublime_link] plugin created to switch and resize a 2-Columns layout in the easiest and most confortable way. Just press the keyboard shortcuts and the plugin will make the indicated column your working column, by automatically focusing on it and making it wider.
+
+No more going back to the mouse to manually resize your columns everytime you want to switch from one side to another.
Keys
----
-Pressing <kbd>Alt+Ctrl+left</kbd> or <kbd>Alt+Ctrl+right</kbd> will switch focus to the respective column and resize it according to the configured ratio (which by default is "8:2" and "2:8"). You can change the ability to autofocus and the ratio in the user key bindings of this package following the *Preferences > Package Settings > SplitScreen-Resizer* menu.
+Pressing <kbd>Alt+Ctrl+left</kbd> or <kbd>Alt+Ctrl+right</kbd> will switch focus to the respective column and resize it according to the configured ratio (which by default is "7:3" and "3:7"). You can change these ratios, the keyboard shortcuts and the ability to autofocus when resizing in the settings of this package following the *Preferences > Package Settings > SplitScreen-Resizer* menu. You can even make it autosize the columns on mouse click or on Sublime's default *Focus Group* command.
+
+So if you are a full-keyboard coder or a mouse lover, this plugin got you covered.
Credits
-------
-This plugin combines functionalities from these great plugins:
+Created by [Jesus Leon][iamjessu_link].
+
+**Contributors:**
+
+* [ArtisR][ArtisR_link] (Artis Raugulis) - Added mouse focus
+
+This plugin combines functionalities from these plugins:
* [SplitScreen][splitscreen_link] by [spadgos][spadgos_link] (Nick Fisher).
* [Split Navigation][splitnavigation_link] by [oleander][oleander_link] (Linus Oleander).
-Contributors
--------
-* [ArtisR][ArtisR_link] (Artis Raugulis) - Added mouse focus
+
Updates
-------
-**v2.0.0**
+**v1.3**
+
+* Added *onFocus* support.
+* Ratios and behavior are configured in the settings file.
+
+**v1.2**
* Added autofocus feature.
-**v1.0.0**
+**v1.0**
* Resize columns by pressing the configured keys.
@@ -67,6 +80,7 @@ For example:
[sublime_link]: http://www.sublimetext.com/
+[iamjessu_link]: https://github.com/iamjessu
[splitscreen_link]: https://github.com/spadgos/sublime-SplitScreen
[spadgos_link]: https://github.com/spadgos
[splitnavigation_link]: https://github.com/oleander/sublime-split-navigation
View
43 split_screen_resizer.py
@@ -1,18 +1,20 @@
"""
-SplitScreen-Resizer v2.0.0
+SplitScreen-Resizer v3.0.0
by Jesus Leon
https://github.com/iamjessu/sublime-SplitScreen-Resizer
-Contributors:
+
+Contributors, THANKS!:
Artis Raugulis <artis@devart.lv>
+
A fork of:
SplitScreen v1.0.0
by Nick Fisher
https://github.com/spadgos/sublime-SplitScreen
-Combined with the plugin:
+Combined with:
Split Navigation
by Linus Oleander
@@ -33,46 +35,53 @@ class PanelChangedCommand(sublime_plugin.EventListener):
last_work_group = None
settings = None
def on_activated(self, view):
- #load settings
+ # Load settings.
if self.settings == None:
self.settings = sublime.load_settings("splitscreen-resizer.sublime-settings")
- #if mouse focus disabled - exit ..
- if self.settings.get('disable_mouse_focus'):
+ # If mouse focus disabled. Exit.
+ if self.settings.get('resize_on_focus') == False:
return 0
- #current active group
+ # Current active group.
current_active_group = view.window().active_group()
- #Working group not changed - doing nothing ...
+ # Working group not changed. Do nothing.
if self.last_work_group == current_active_group:
return 0
- #update last work group
+ # Update last work group.
self.last_work_group = current_active_group
- #by default we show left side ...
- args = {"side":"left", "ratio":self.settings.get('ratio_left'), "autofocus":False}
- #if right side active - update args to right side version
+ # By default we show left side.
+ # Note the extra parameter ignore_focus_on_resize.
+ # It prevents an infinite loop. A short circuit! :O
+ args = {"side":"left", "ignore_focus_on_resize":True}
+
+ # If right side active, update args to right side version.
if(current_active_group == 1):
- args = {"side":"left", "ratio":self.settings.get('ratio_right'), "autofocus":False}
+ args = {"side":"right", "ignore_focus_on_resize":True}
win = view.window()
win.run_command("split_screen_resizer", args)
class SplitScreenResizerCommand(sublime_plugin.WindowCommand):
- def run(self, side, ratio, autofocus):
+ settings = None
+ def run(self, side, ignore_focus_on_resize=False):
+ # Load settings
+ if self.settings == None:
+ self.settings = sublime.load_settings("splitscreen-resizer.sublime-settings")
win = self.window
num = win.num_groups()
act = win.active_group()
if side == "left":
- ratio_val = ratio
+ ratio = self.settings.get('ratio_left')
act = act - 1
if side == "right":
- ratio_val = ratio
+ ratio = self.settings.get('ratio_right')
act = act + 1
# By keeping it as modulus operation we ensure that:
@@ -80,7 +89,7 @@ def run(self, side, ratio, autofocus):
# working with more than 2 columns.
# - It acts as a loop, focusing the first/last column when the
# last/first is reached respectively.
- if autofocus:
+ if self.settings.get('focus_on_resize') and ignore_focus_on_resize == False:
win.focus_group(act % num)
View
30 splitscreen-resizer.sublime-settings
@@ -1,8 +1,28 @@
{
- //Disable mouse autofocus
- "disable_mouse_focus" : false,
+ // *** Understanding the way this plugin works ***
- //column ratios (for now you also need to define these ratios in Key bindings )
- "ratio_left" : "6.5:3.5",
- "ratio_right" : "3.5:6.5"
+ // Action, reaction:
+ // Case 1: If user focus, the plugin resizes.
+ // Case 2: If user resizes, the plugin focus.
+
+
+ // Case 1.
+ // Resize when giving focus to a Group (column)?
+ // Note that Sublime API triggers this event on the following cases:
+ // - When clicking on the working area of a column *BUT* not on the scroll bar
+ // and the Minimap.
+ // - When clicking on a Tab of a column. That includes the Close (x) button.
+ // - When giving focus to a column using default key shortcuts: Ctrl+{NUMBER}.
+ "resize_on_focus" : true,
+
+ // Case 2.
+ // Focus when resizing using this plugin's keyboard shortcuts?
+ // If false, it will only resize the columns keeping the focus where it is.
+ // This can be useful depending on how your ratios are defined.
+ "focus_on_resize" : true,
+
+ // Columns resize ratios:
+ // Remember that 70:30 = 7:3 = 0.7:0.3
+ "ratio_left" : "65:35",
+ "ratio_right" : "35:65"
}

0 comments on commit 9e5c4da

Please sign in to comment.
Something went wrong with that request. Please try again.