vim9 :0put puts after the first line

10 views
Skip to first unread message

JohnBeckett

unread,
Feb 7, 2022, 1:16:15 AM2/7/22
to vim_dev
I think this is a Vim 8.2.4293 bug but as it's from my first vim9script it might be me. Save the following to a file and source it (:so %).

vim9script
def Main(): void
  @a = "one\ntwo\nthree"
  new
  put =@a
  :1d
  :0put ='This should be the first line.'
enddef
Main()

The result is:

one
This should be the first line.
two
three

Using :1put! instead of :0put gives the same result.

Sourcing the following shows the correct order.

function Main()
  let @a = "one\ntwo\nthree"
  new
  put =@a
  :1d
  :0put ='This should be the first line.'
endfunction
call Main()

John
Reply all
Reply to author
Forward
0 new messages