autoload/threesomelib/util/keys.py @ 61c6ca7b2d8a

Fix the binding of \u in grid/other modes.
author Steve Losh <steve@stevelosh.com>
date Thu, 30 Jun 2011 18:53:30 -0400
parents cefc901de8a2
children b8aab52392ea
import vim
from bufferlib import buffers


def bind(key, to, options='', mode=None, leader='<localleader>'):
    vim.command('nnoremap %s %s%s %s' % (options, leader, key, to))

def unbind(key, options='', leader='<localleader>'):
    vim.command('unmap %s %s%s' % (options, leader, key))

def bind_for_all(key, to, options='', mode=None, leader='<localleader>'):
    with buffers.remain():
        for b in buffers.all:
            b.open()
            bind(key, to, options, mode, leader)

def unbind_for_all(key, options='', leader='<localleader>'):
    with buffers.remain():
        for b in buffers.all:
            b.open()
            unbind(key, options, leader)