autoload/splicelib/util/windows.py @ e31bbce52b3f
Added tag v1.0.1 for changeset 86a478f40df6
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 12 Dec 2012 13:13:04 -0500 |
parents |
0013f7e01b6e |
children |
4578b7ee5905 |
import vim
def focus(winnr):
vim.command('%dwincmd w' % winnr)
def close(winnr):
focus(winnr)
vim.command('wincmd c')
def close_all():
for winnr in range(len(vim.windows) - 1):
close(winnr)
def split():
vim.command('wincmd s')
def vsplit():
vim.command('wincmd v')
def currentnr():
return int(vim.eval('winnr()'))
def pos():
return vim.current.window.cursor
class remain:
def __enter__(self):
self.curwindow = currentnr()
self.pos = pos()
def __exit__(self, type, value, traceback):
focus(self.curwindow)
vim.current.window.cursor = self.pos