Due to a syntax change between python 2 and python 3, there is no way to insert a new line at an arbitrary line number into a buffer using the python interface without using undocumented parameters in the buffer.append() method.
In the existing python 2 interface, the way to insert a line according to the documentation is: :py b[n:n] = ["a new line at line number n"] In python 3 you are no longer allowed to assign to a slice, so this doesn't work anymore. There is an undocumented second parameter to buffer.append() which allows you to add a line number where the new line should be added. However this diverges from the standard set of python list methods. If the vim module wants to emulate a python list, it should have buffer.insert(n, "new line at n"). Otherwise the extra param in append() should be documented. I'll throw in a patch for the new buffer.insert() method if people think it's a good idea. Nico -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php