René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Writing to a VIM buffer with the ruby interface | ||
fu! WriteToBuffer_1(bufno) ruby<<E___ bno = VIM::evaluate("a:bufno").to_i bno = bno - 1 # vim: 1 based array, ruby:0 based array! buf = VIM::Buffer[bno] buf.append(0, 'used buf no is: ' + bno.to_s) E___ endfu fu! WriteToBuffer_2(bufno) ruby<<E___ bno=VIM::evaluate("a:bufno").to_i VIM::command("bu " + bno.to_s) VIM::command('1') VIM::command("norm i hello from WriteToBuffer_2\n") E___ endfu |