SublimeText / VintageEx

An implementation of Vim's command-line mode for Sublime Text 2
MIT License
381 stars 51 forks source link

Window management commands #15

Open thegrubbsian opened 11 years ago

thegrubbsian commented 11 years ago

I know almost nothing about Python OR the internals of SublimeText otherwise I'd do this as a pull request but I'd love to see window management commands such as :vs and :sp added. The basic windowing approach seems somewhat different from vim so this may not be able to work exactly as vim does but being able to open a new file in a vertical or horizontal split window would be fantastic.

barneywilliams commented 11 years ago

JC,

I have been wanting that support for a long while and definitely +1 this. The window vim-ish window splitting should work just fine in Sublime. I have used it a little in the past, so I might take a crack at it if I can dig up some free time. Not quite sure when that may be though... ;) Maybe someone else will beat me to it.

Greg

On Tue, Sep 11, 2012 at 9:05 PM, JC Grubbs notifications@github.com wrote:

I know almost nothing about Python OR the internals of SublimeText otherwise I'd do this as a pull request but I'd love to see window management commands such as :vs and :sp added. The basic windowing approach seems somewhat different from vim so this may not be able to work exactly as vim does but being able to open a new file in a vertical or horizontal split window would be fantastic.

— Reply to this email directly or view it on GitHubhttps://github.com/SublimeText/VintageEx/issues/15.

Greg Williams | Embedded Craftsman Atomic Embedded | http://atomicembedded.com [Ph] +1 616 264 3734 [Fx] +1 616 776 6015

masukomi commented 11 years ago

according to this post it should be doable with something like this:

import sublime_plugin

class CloneFileToGroupCommand(sublime_plugin.WindowCommand):
    def run(self):
        if self.window.num_groups() == 1:
            self.window.run_command('set_layout',
                            {
                                "cols": [0.0, 0.5, 1.0],
                                "rows": [0.0, 1.0],
                                "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
                            })
        self.window.run_command('clone_file')
        self.window.run_command('move_to_group', {"group": 1})