I want a simple command that changes the range that the user selected to a constant string I set (with possibly differently number of lines) - effectively adding lines if the constant string has more. The following code does nothing but randomly inserts newline. What went wrong?
class Plugin(object):
def __init__(self, nvim):
self.nvim = nvim
@neovim.command("MyCommand", range="", nargs="*", sync=True)
def my_command(self, args, range):
start_line, end_line = range
region = self.nvim.current.buffer.range(start_line-1, end_line)
aa="string \r ssss"
if len(aa)>0:
region[:] = '\r'.split(aa)