diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap index 47d8567..355f2b0 100644 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -35,6 +35,10 @@ { "keys": ["ctrl+k", "ctrl+alt+down"], "command": "create_pane_with_file", "args": {"direction": "down"} }, { "keys": ["ctrl+k", "ctrl+alt+left"], "command": "create_pane_with_file", "args": {"direction": "left"} }, + + // You can pull a file from another pane by binding the following command: + // { "keys": [], "command": "pull_file_from_pane", "args": { "direction": ""} } + { "keys": ["ctrl+k", "ctrl+z"], "command": "zoom_pane", "args": {"fraction": 0.9} }, { "keys": ["ctrl+k", "ctrl+shift+z"], "command": "unzoom_pane", "args": {} }, diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index 6e49293..3814a81 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -35,6 +35,10 @@ { "keys": ["super+k", "super+alt+down"], "command": "create_pane_with_file", "args": {"direction": "down"} }, { "keys": ["super+k", "super+alt+left"], "command": "create_pane_with_file", "args": {"direction": "left"} }, + + // You can pull a file from another pane by binding the following command: + // { "keys": [], "command": "pull_file_from_pane", "args": { "direction": ""} } + { "keys": ["super+k", "super+z"], "command": "zoom_pane", "args": {"fraction": 0.9} }, { "keys": ["super+k", "super+shift+z"], "command": "unzoom_pane", "args": {} }, diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap index 47d8567..355f2b0 100644 --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -35,6 +35,10 @@ { "keys": ["ctrl+k", "ctrl+alt+down"], "command": "create_pane_with_file", "args": {"direction": "down"} }, { "keys": ["ctrl+k", "ctrl+alt+left"], "command": "create_pane_with_file", "args": {"direction": "left"} }, + + // You can pull a file from another pane by binding the following command: + // { "keys": [], "command": "pull_file_from_pane", "args": { "direction": ""} } + { "keys": ["ctrl+k", "ctrl+z"], "command": "zoom_pane", "args": {"fraction": 0.9} }, { "keys": ["ctrl+k", "ctrl+shift+z"], "command": "unzoom_pane", "args": {} }, diff --git a/Main.sublime-menu b/Main.sublime-menu index 734a459..b4cf73c 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -84,6 +84,16 @@ { "command": "clone_file_to_pane", "args": {"direction": "right"}, "caption": "Right" }, { "command": "clone_file_to_pane", "args": {"direction": "left"}, "caption": "Left" } ] + }, + { + "caption": "Pull from", + "children": + [ + { "command": "pull_file_from_pane", "args": {"direction": "up"}, "caption": "Above" }, + { "command": "pull_file_from_pane", "args": {"direction": "down"}, "caption": "Below" }, + { "command": "pull_file_from_pane", "args": {"direction": "right"}, "caption": "Right" }, + { "command": "pull_file_from_pane", "args": {"direction": "left"}, "caption": "Left" } + ] } ] }, diff --git a/Origami.sublime-commands b/Origami.sublime-commands index 2f27849..9f7b564 100644 --- a/Origami.sublime-commands +++ b/Origami.sublime-commands @@ -24,6 +24,11 @@ { "command": "create_pane", "args": {"direction": "down", "give_focus": true}, "caption": "Origami: Create and Focus Pane Below" }, { "command": "create_pane", "args": {"direction": "left", "give_focus": true}, "caption": "Origami: Create and Focus Pane on the Left" }, + { "command": "pull_file_from_pane", "args": {"direction": "up"}, "caption": "Origami: Pull File from Pane Above" }, + { "command": "pull_file_from_pane", "args": {"direction": "right"}, "caption": "Origami: Pull File from Pane on the Right" }, + { "command": "pull_file_from_pane", "args": {"direction": "down"}, "caption": "Origami: Pull File from Pane Below" }, + { "command": "pull_file_from_pane", "args": {"direction": "left"}, "caption": "Origami: Pull File from Pane on the Left" }, + { "command": "destroy_pane", "args": {"direction": "up"}, "caption": "Origami: Destroy Pane Above" }, { "command": "destroy_pane", "args": {"direction": "right"}, "caption": "Origami: Destroy Pane on the Right" }, { "command": "destroy_pane", "args": {"direction": "down"}, "caption": "Origami: Destroy Pane Below" }, diff --git a/origami.py b/origami.py index 124bf41..f009b1e 100644 --- a/origami.py +++ b/origami.py @@ -485,6 +485,19 @@ def destroy_pane(self, direction): layout = {"cols": cols, "rows": rows, "cells": cells} fixed_set_layout(window, layout) + def pull_file_from_pane(self, direction): + adjacent_cell = self.adjacent_cell(direction) + + if adjacent_cell: + cells = self.get_cells() + group_index = cells.index(adjacent_cell) + + view = self.window.active_view_in_group(group_index) + + if view: + active_group_index = self.window.active_group() + self.window.set_view_index(view, active_group_index, 0) + class TravelToPaneCommand(PaneCommand): def run(self, direction): @@ -513,6 +526,11 @@ def run(self, direction): self.clone_file_to_pane(direction) +class PullFileFromPaneCommand(PaneCommand): + def run(self, direction): + self.pull_file_from_pane(direction) + + class ZoomPaneCommand(PaneCommand): def run(self, fraction=None): self.zoom_pane(fraction)