def __setitem__(self, a, b): if isinstance(a, slice): vim.current.buffer[a.start:a.stop] = make_suitable_for_vim(b) else: vim.current.buffer[a] = make_suitable_for_vim(b) # Open any folds this might have created vim.current.window.cursor = a.start + 1, 0 vim.command("normal zv")
def __setitem__(self, a, b): if isinstance(a,slice): vim.current.buffer[a.start:a.stop] = make_suitable_for_vim(b) else: vim.current.buffer[a] = make_suitable_for_vim(b) # Open any folds this might have created vim.current.window.cursor = a.start + 1, 0 vim.command("normal zv")
def _ask_snippets(self, snippets): """ Given a list of snippets, ask the user which one they want to use, and return it. """ # make a python list display = [ "%i: %s" % (i+1,s.description) for i,s in enumerate(snippets)] try: # let vim_string format it as a vim list rv = vim.eval(make_suitable_for_vim(as_unicode("inputlist(%s)") % vim_string(display))) if rv is None or rv == '0': return None rv = int(rv) if rv > len(snippets): rv = len(snippets) return snippets[rv-1] except vim.error as e: if str(e) == 'invalid expression': return None raise