Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PullFileFromPaneCommand #84

Merged
merged 1 commit into from
Jun 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -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": {} },

Expand Down
4 changes: 4 additions & 0 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -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": {} },

Expand Down
4 changes: 4 additions & 0 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -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": {} },

Expand Down
10 changes: 10 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
]
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions Origami.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
18 changes: 18 additions & 0 deletions origami.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,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):
Expand Down Expand Up @@ -511,6 +524,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)
Expand Down