Skip to content

Commit

Permalink
Merge pull request #84 from Kl0tl/feat/pull-file-from-pane
Browse files Browse the repository at this point in the history
Add PullFileFromPaneCommand
  • Loading branch information
adzenith committed Jun 29, 2015
2 parents e0a2118 + 3209cee commit 5ea3457
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
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 @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5ea3457

Please sign in to comment.