autoload/splicelib/util/keys.py @ 12d0ec667b63
Implement crash solution given in Google group.
link for Google group:
https://groups.google.com/forum/#!topic/vim_dev/HgKdV33Jy5I
author |
killphi <killphi@gmx.de> |
date |
Fri, 23 Aug 2013 17:07:07 +0200 |
parents |
e73227e8f1f9 |
children |
136a9256bec2 |
from __future__ import with_statement
import vim
from bufferlib import buffers
from ..settings import setting
def bind(key, to, options='', mode=None, leader=None):
if not leader:
leader = setting('prefix', '-')
vim.command('nnoremap %s %s%s %s' % (options, leader, key, to))
def unbind(key, options='', leader=None):
if not leader:
leader = setting('prefix', '-')
vim.command('unmap %s %s%s' % (options, leader, key))
def bind_for_all(key, to, options='', mode=None, leader=None):
if not leader:
leader = setting('prefix', '-')
with buffers.remain():
for b in buffers.all:
b.open()
bind(key, to, options, mode, leader)
def unbind_for_all(key, options='', leader=None):
if not leader:
leader = setting('prefix', '-')
with buffers.remain():
for b in buffers.all:
b.open()
unbind(key, options, leader)